Security Architecture & Threat Model
This document describes the security architecture, trust boundaries, authentication mechanisms, and threat model for easyeda-mcp-pro. It is intended for maintainers, security reviewers, and production deployers.
1. Deployment Modes
The server supports four deployment modes, each with a distinct security posture:
| Mode | Transport | Authentication | Trust Boundary | Threat Level |
|---|---|---|---|---|
| Local stdio | stdio | None (process-local) | OS process boundary | Low |
| Local HTTP | http (127.0.0.1) | Optional OAuth, default loopback-only | Loopback network | Low-Medium |
| Remote HTTP | http (non-loopback) | OAuth required | External network | High |
| Dev bridge | WebSocket (bridge) | Optional challenge/response pairing | Local machine | Low-Medium |
1.1 Local stdio (default)
- The server spawns as a child process of the MCP client (Claude Desktop, Cursor, etc.).
- Communication occurs over standard input/output — no network socket is opened.
- No authentication is needed because the OS process boundary provides isolation.
- Trust model: The MCP client is trusted. Any process that can interact with the server's stdin/stdout has full access.
1.2 Local HTTP
- The server listens on
127.0.0.1(loopback only) by default. - Rate limiting is applied (default 100 req/min per IP).
- Security headers are added to all responses.
- OAuth is optional in loopback mode;
HTTP_AUTH_DISABLEDcan be set totrueonly for non-production local development. - Trust model: Only processes on the same machine can reach the server. This is suitable for local AI assistants and custom integrations.
1.3 Remote HTTP
- The server binds to a non-loopback address (e.g.,
0.0.0.0or a specific LAN IP). - OAuth is mandatory for non-loopback hosts. The server refuses to start without OAuth configuration (see §6).
- Origin validation and DNS rebinding protection are enforced.
- Trust model: The network is untrusted. All requests must present a valid bearer token.
1.4 Dev Bridge
- A WebSocket server listens on
127.0.0.1for the EasyEDA Pro bridge extension to connect. - When
BRIDGE_HOSTis non-loopback andBRIDGE_TOKENis set, a challenge/response pairing handshake is required. - All bridge messages are validated against a Zod schema before processing.
- Payload size is enforced (default max 1 MiB).
- Trust model: The bridge extension is authenticated via pairing when enabled; otherwise, loopback-only binding provides implicit trust.
2. Authentication & Authorization
2.1 OAuth 2.0 / OpenID Connect (HTTP transport)
When OAUTH_ENABLED=true, every request to /mcp must include an Authorization: Bearer <token> header.
Validation flow:
- Token is extracted from the
Authorizationheader. - Token is verified using
jose.jwtVerifyagainst a configured JWKS endpoint. - Supported signature algorithms: RS256, RS384, RS512, ES256, ES384, ES512.
- The following claims are validated:
iss(issuer) — must matchOAUTH_ISSUER.aud(audience) — must matchOAUTH_AUDIENCE(defaulteasyeda-mcp-pro).exp(expiration) — token must not be expired.
- Token type (
typheader) is checked — non-JWT tokens are rejected. - Required scopes from
OAUTH_REQUIRED_SCOPESare enforced againstscope,scp,permissions, orrolesclaims. - On validation failure, detailed error codes are returned:
token_expired,invalid_issuer,invalid_audience,invalid_signature,missing_auth,insufficient_scope.
Configuration requirements for non-loopback HTTP:
OAUTH_ENABLED=true
OAUTH_ISSUER=https://your-idp.example.com
OAUTH_AUDIENCE=easyeda-mcp-pro
OAUTH_JWKS_URI=https://your-idp.example.com/.well-known/jwks.json
OAUTH_REQUIRED_SCOPES=easyeda:readThe server enforces startup safety checks in every environment: non-loopback HTTP without complete OAuth is rejected, ALLOWED_ORIGINS=* is rejected remotely, and HTTP_AUTH_DISABLED=true is rejected for production or non-loopback HTTP.
2.2 Bridge Pairing Authentication
When the bridge runs on a non-loopback host and BRIDGE_TOKEN is configured, a challenge/response pairing handshake occurs:
- Server sends a
pairing_challengemessage with a random UUID to the connecting client. - Client must respond with a
pairing_responsecontaining:- The echoed
challengeUUID. - The correct
sessionTokenmatching the server'sBRIDGE_TOKEN.
- The echoed
- If the response is missing, mismatched, or times out (10 s), the connection is closed with code
4001. - After successful pairing, the client proceeds to the
handshakephase where the session token is validated again. - Pending challenges are cleaned up on disconnect or timeout.
Sequence:
Server → Client: { type: "pairing_challenge", challenge: "<uuid>" }
Client → Server: { type: "pairing_response", challenge: "<uuid>", sessionToken: "<token>" }
── pairing complete ──
Client → Server: { type: "handshake", protocolVersion: "1.0.0", sessionToken: "<token>", ... }
Server → Client: { type: "hello", bridgeVersion: "1.0.0", capabilities: [...], ... }2.3 Tool Profile Authorization
Tools are organized into hierarchical profiles: core < pro < full < dev < experimental.
- The
TOOL_PROFILEenvironment variable selects which tools are enabled. - Each tool definition declares a minimum
profilelevel. - Only tools at or below the active profile are registered on the MCP server. The exact counts below are generated from the runtime registry:
| Profile | Registered tools |
|---|---|
core | 84 |
pro | 115 |
full | 132 |
dev | 137 |
experimental | 140 |
coreis the default high-confidence workflow surface.proadds manufacturing exports, compound workflows, autorouting, and offline SPICE verification.fulladds the controlledeasyeda_api_callsurface and CircuitIR-driven floorplanning.devadds runtime probes for bridge and component diagnostics.experimentalcurrently registers the same standard tool set asdev; separately gated raw-execution and hot-swap tools are excluded from these counts.
Security principle: Privilege escalation is prevented because tool registration happens at startup. Changing the active profile requires a server restart.
3. Tool-Level Safety Controls
3.1 confirmWrite Gate
Tools that can mutate EasyEDA project/design state declare confirmWrite: true in their definition. Export tools that only create files under ARTIFACT_DIR are classified separately as artifact writes and do not use the design-mutation confirmation gate.
At runtime, the ToolRegistry.registerAllOnServer() wrapper:
- Checks whether
confirmWrite === truein the tool definition. - If so, inspects the incoming call parameters for
confirmWrite: true. - If absent, returns a structured error
ERR_CONFIRM_WRITE_REQUIREDwithout executing the handler.
This prevents LLMs from accidentally mutating design state without explicit user acknowledgment.
Mutation tools also support a registry-level write transaction flow through writeMode:
writeMode=planvalidates the tool input and returns a structured transaction plan without calling the bridge.writeMode=previewreturns a structured preview checkpoint without calling the bridge.writeMode=applyis the default execution mode and still requiresconfirmWrite=true.writeMode=verifyreturns a non-mutating verification checkpoint; callers should follow it with read-only diagnostics after applying a change.
The safe sequence for agents is: plan → preview → user confirmation → apply with confirmWrite=true → verify with read-only checks.
Agent schematic write safety loop
Agents that author schematics should not treat a successful write call as proof that the electrical intent is correct. Use this loop for placement and connectivity:
- Read placement context with
easyeda_schematic_sheet_infoand existing design state witheasyeda_schematic_components/easyeda_schematic_nets. - Choose parts with
easyeda_schematic_search_deviceand check normalizedpin_count/symbol_typebefore selecting a symbol. - Preview placement with
easyeda_schematic_place_componentusingdryRun=trueandcheckPlacementCollision=true. Reviewplacement_guard.warningsandnearby_componentsbefore applying. - Apply the placement only after explicit confirmation with
confirmWrite=true. SetverifyAfterWrite=trueto read back component count and surface whether read-back verification was available. - After wiring/net assignment, verify connectivity with
easyeda_schematic_validate_netlistand, when appropriate,easyeda_semantic_erc_validatebefore continuing to board or export workflows.
dryRun=true does not mutate the design. It returns the requested placement preview and optional collision warning data. verifyAfterWrite=true performs a read-back pass after the write and reports component-count delta evidence. These checks are guardrails, not a substitute for final human design review.
Risk tiers:
| Effect class | Examples | Local confirmWrite | Remote Relay approval |
|---|---|---|---|
| Read-only | easyeda_health_check, easyeda_schematic_nets | No | No after authentication and pairing |
| Design mutation | easyeda_schematic_place_component, easyeda_pcb_add_track | Yes | Yes |
| Artifact write | easyeda_export_gerbers, easyeda_export_pdf | No; the design is not mutated | Yes, with export risk and easyeda.export scope |
| Controlled API mutation | mutating easyeda_api_call paths | Yes | Strong approval according to the resolved risk |
3.2 Explicit side-effect classification
Tool metadata distinguishes the operation's effect from its UI/documentation group:
read-only: no persistent project or filesystem change;design-mutation: changes EasyEDA project state and requiresconfirmWrite=true;artifact-write: creates a file inside the configured artifact directory but does not mutate the design;local-state-write: changes local cache/database state;external-action: triggers a state change outside the local project.
Legacy tool definitions without an explicit sideEffect retain fail-safe behavior: confirmWrite=true implies design-mutation; otherwise they default to read-only. Remote Relay authorization uses the resolved side effect rather than the broad tool group, so read-only reports in the export group are not mislabeled as manufacturing exports. Actual file exporters remain export risk and require a bound human approval before relay dispatch.
3.3 Structured Error Handling
All tools return structured errors with machine-readable codes:
| Code | Meaning |
|---|---|
ERR_CONFIRM_WRITE_REQUIRED | Mutation tool called without confirmWrite=true |
ERR_BRIDGE_DISCONNECTED | Bridge connection is not available |
ERR_TOOL_EXECUTION | Handler threw an unexpected error |
ERR_TOOL_NOT_FOUND | Tool name does not match a registered tool |
ERR_INVALID_INPUT | Zod schema validation failed on input parameters |
3.4 Tool Registration Uniqueness
The ToolRegistry enforces unique tool names at registration time — duplicate registration throws an error, preventing tool shadowing or override attacks.
4. Network Security
4.1 HTTP Transport Security
Rate limiting:
- Per-IP sliding window rate limiter (default 100 requests per minute).
- Returns
429 Too Many RequestswithretryAfterMsandX-RateLimit-*headers. - Active entries are cleaned up when the store exceeds 1000 entries.
Security headers (applied to all HTTP responses):
| Header | Value | Purpose |
|---|---|---|
X-Content-Type-Options | nosniff | Prevents MIME type sniffing |
X-Frame-Options | DENY | Prevents clickjacking |
X-XSS-Protection | 0 | Disables legacy XSS filter (prevents XSS in modern browsers) |
Referrer-Policy | strict-origin-when-cross-origin | Controls referrer header leakage |
Origin validation (CORS):
- Loopback mode: accepts loopback
http:///https://origins with or without explicit ports,null, and the legacyCORS_ORIGINvalue. - Non-loopback mode: requires an explicit comma-separated
ALLOWED_ORIGINSallowlist. Wildcard (*) is rejected at startup. - Requests without an
Originheader (non-browser clients) pass origin validation, but they still require OAuth authentication on every non-loopback deployment; theHostheader is also validated. - Unknown origins receive
403 Origin not allowed. - DNS rebinding protection validates the
Hostheader in both loopback and non-loopback modes. Loopback binds only accept loopback hostnames/IPs. - CORS preflight is handled after origin validation but before OAuth token validation, so browser preflight can succeed without weakening authenticated routes.
Health endpoints:
/healthz— liveness probe (returns{ status: "ok", version })./readyz— readiness probe (returns{ status: "ok", uptime }).- These endpoints do not expose sensitive information.
4.2 Bridge (WebSocket) Security
Payload size enforcement:
- Messages exceeding
BRIDGE_MAX_PAYLOAD_SIZE(default 1 MiB) are rejected and the connection is closed with code4009. - The internal local follower relay uses the same aggregate payload ceiling as the owner bridge path and only accepts registered EasyEDA bridge method names.
Schema validation:
- Every incoming bridge message is parsed against a Zod schema before processing.
- Unknown message types, malformed JSON, or invalid schemas are logged and rejected.
Handshake validation:
- Protocol version must be in the supported set (
["1.0.0"]). - Session token (if configured) must match exactly.
- Extension version mismatch produces a warning log but does not block the connection.
Stale request sweep:
- A periodic timer (every 30 s) sweeps the pending-request map for leaked timeouts — defence-in-depth against timer drift.
Heartbeat:
- Periodic heartbeats (interval configurable via
BRIDGE_HEARTBEAT_MS, default 10 s) detect dead connections. - Failed heartbeat delivery triggers a clean disconnect.
Reconnect backoff:
- Exponential backoff: 1 s → 2 s → 4 s → 8 s → 16 s → 30 s (capped).
- Reconnect attempts continue while the server remains active; no max-attempt environment control is exposed.
5. Secrets Management
5.1 Environment Variables
All sensitive credentials are read from environment variables at startup:
| Category | Variables |
|---|---|
| Reserved AI configuration | None — AI_API_KEY is accepted for compatibility but is not consumed |
| JLCPCB | JLCPCB_CLIENT_ID, JLCPCB_CLIENT_SECRET |
| LCSC | LCSC_API_KEY |
| Mouser | MOUSER_API_KEY |
| DigiKey | DIGIKEY_CLIENT_ID, DIGIKEY_CLIENT_SECRET |
| Bridge | BRIDGE_TOKEN |
| OAuth | (derived from JWKS token, not stored in env) |
5.2 Log Redaction
The redactObject() and redactSecrets() utilities in src/utils/redaction.ts automatically redact sensitive values from logs and diagnostic output:
- Regex patterns match:
api_key,client_secret,token,password,bearer, PEM private keys, andauthorizationheaders. - Object keys containing
key,secret,token,password,credential,authorization, orcookieare replaced with[REDACTED]. - The
easyeda_get_server_configtool returns only safe configuration variables (port, transport, environment) — credentials are never exposed.
5.3 Config Validation at Startup
The Zod schema in src/config/env.ts validates all environment variables at startup:
- Type coercion and range checks (e.g., ports 1-65535, rate limits 1-10000, timeouts within bounds).
- Unknown project-prefixed env vars produce startup warnings to catch typos.
- Production mode enforced checks:
BRIDGE_RAW_EXEC_ENABLEDmust befalse.JLCPCB_ENABLE_ORDERINGrequiresJLCPCB_MODE=approved_api.- Non-loopback HTTP without OAuth is rejected.
- Test mode (
NODE_ENV=test) allows safe overrides for testing.
6. Safe Defaults vs Unsafe Overrides
Every unsafe configuration override has a safe default. The following table documents each override, its risk, and when it is appropriate:
AI_ALLOW_DESIGN_MUTATIONS and MCP_TASKS_ENABLED are reserved compatibility settings. Setting them does not enable AI design mutation or MCP Tasks, and they are therefore not listed as active unsafe overrides.
| Variable | Safe Default | Unsafe Override | Risk | When Appropriate |
|---|---|---|---|---|
HTTP_HOST | 127.0.0.1 | Non-loopback (e.g., 0.0.0.0) | High — exposes server to network | Remote deployment behind auth/reverse proxy |
OAUTH_ENABLED | false | true | High — mandatory for every non-loopback HTTP listener | Remote HTTP access with proper IdP |
BRIDGE_RAW_EXEC_ENABLED | false | true | Critical — enables raw JavaScript execution | Development/testing only |
BRIDGE_TOKEN | '' | Set to a shared secret | Medium — enables bridge pairing | Non-loopback bridge connections |
EASYEDA_DEV_BRIDGE | false | true | Medium — enables dev bridge features | Development only |
HTTP_AUTH_DISABLED | false | true | High — disables all HTTP auth | Non-production loopback development only |
NODE_ENV | development | production | Medium — enables production safety checks | Production deployment |
JLCPCB_ENABLE_ORDERING | false | true | High — enables ordering via API | When JLCPCB ordering is needed |
TOOL_PROFILE | core | full, dev, experimental | Varies — grants access to more tools | When broader tool access is needed |
CORS_ORIGIN | '' | Set to an origin | Low — local dev only | Legacy CORS configuration |
ALLOWED_ORIGINS | '' | Comma-separated origins | Medium — restricts cross-origin access | Remote HTTP with known browser clients |
7. Supplier API Security
7.1 LCSC (jlcsearch)
- Enabled by default (
JLCSEARCH_ENABLED=true). - Uses a public search API endpoint — no credentials required for basic search.
- An API key can be configured for the optional authenticated fallback path.
7.2 JLCPCB
- Disabled by default (
JLCPCB_MODE=disabled). - Three modes:
disabled,mock,approved_api. JLCPCB_ENABLE_ORDERINGrequiresapproved_apimode (enforced at startup in production).- API credentials (
JLCPCB_CLIENT_ID,JLCPCB_CLIENT_SECRET) are required forapproved_apimode.
7.3 Mouser
- Disabled by default (
MOUSER_ENABLED=false). - Requires
MOUSER_API_KEYto be configured. - Uses
https://api.mouser.comas the API base URL.
7.4 DigiKey
- Disabled by default (
DIGIKEY_ENABLED=false). - Requires OAuth2 client credentials (
DIGIKEY_CLIENT_ID,DIGIKEY_CLIENT_SECRET). - Defaults to sandbox mode (
DIGIKEY_SANDBOX=true).
Data privacy: Only explicitly initiated supplier queries are sent over the network. No design geometry, netlist data, or board layout is ever uploaded to supplier APIs.
8. Data at Rest
| Data Type | Location | Protection |
|---|---|---|
| Configuration | .env file | File system permissions; never committed to git |
| SQLite database | SQLITE_PATH (default <DATA_DIR>/easyeda-mcp-pro.sqlite) | File system permissions |
| Artifacts (exports) | ARTIFACT_DIR (default <DATA_DIR>/artifacts/) | Path traversal validation at the tool level |
| Cache | CACHE_DIR (default <DATA_DIR>/cache/) | File system permissions |
DATA_DIR defaults to ~/.easyeda-mcp-pro and is resolved before the subordinate defaults. Setting only DATA_DIR therefore relocates all writable state. Explicit subordinate overrides remain independent, including relative paths, and changing the configuration does not migrate existing files.
Path traversal protection is enforced in all export tools — artifact paths are validated against the resolved ARTIFACT_DIR before read or write operations, whether that directory was derived from DATA_DIR or explicitly configured.
9. CI/CD Security
9.1 GitHub Actions
The required quality gate runs pnpm check:architecture against .github/architecture-boundaries.json. The current executable boundary keeps foundational config, observability, runtime, safety, schemas, and transactions modules independent from orchestration and transport areas such as tools, server, bridge, live, and workflows. Boundary changes therefore require an explicit policy diff rather than silently introducing a reverse dependency.
- All action references are pinned to full 40-character commit SHAs.
- Workflows default to
permissions: contents: read(least privilege). - The release workflow has elevated permissions scoped to the specific job.
- Concurrency limits cancel in-progress runs on the same branch/tag.
- CodeQL analysis runs on every push and PR (security-extended + security-and-quality queries).
- Repository-owned Semgrep rules run on staged files locally and in a full CI scan; trusted CI events upload SARIF to code scanning.
- The Snyk GitHub App scans pull requests, while an authenticated high-severity Snyk Open Source scan runs at pre-push.
- SonarQube Cloud remains advisory pull-request analysis through GitHub App automatic analysis; local Vitest thresholds/report validation own the blocking coverage gate, while Codecov remains advisory coverage telemetry and SonarQube for IDE Connected Mode provides editor-time feedback.
- Socket.dev scans every PR for dependency vulnerabilities.
9.2 Dependency Management
- Renovate policy is defined in
.github/renovate.json; hosted-provider activation must be verified independently through a Renovate Dependency Dashboard or Renovate-authored update activity. pnpm security:auditfails closed if a registry-backedpnpm audit --jsonattempt exceeds 300 seconds. A structured audit error payload is retried exactly once; a second error still fails closed and emits JSON/summary evidence. CI applies an 11-minute step timeout across both bounded attempts.DEPENDENCY_AUDIT_TIMEOUT_MSis available only as a bounded per-attempt operational override (1–900 seconds).- Runtime dependencies require manual review — never auto-merged.
- When the hosted Renovate provider is active, patch/minor devDependencies may auto-merge only if CI passes.
- Vulnerability alerts via OSV database.
9.3 Branch Protection
mainis protected by the active repository rulesetmain-standard. One existing owner-onlypull_requestbypass exception is configured; it is not approval to bypass routine CI/review. Any actual use must follow the documented emergency exception and audit procedure in Repository Governance.- The current solo-maintainer policy has required human approvals:
0. Independent approval becomes mandatory when a second eligible human maintainer has review access, as defined in Repository Governance. - Required status checks must pass on an up-to-date head:
quality (24),codeql,semgrep,Socket Security: Project Report, anddependency-review. - Pull requests must resolve review conversations before merge.
- Linear history is enforced and the allowed merge method is squash; force pushes and branch deletion are blocked.
10. Threat Model
10.1 Trust Boundaries
┌─────────────────────────────────────────────────────────┐
│ Trusted (OS Boundary) │
│ │
│ ┌──────────────┐ stdio ┌───────────────────┐ │
│ │ MCP Client │◄───────────►│ easyeda-mcp-pro │ │
│ │ (Claude, etc.)│ │ (MCP Server) │ │
│ └──────────────┘ └──────────┬──────────┘ │
│ │ │
│ WebSocket (loopback) │
│ │ │
│ ┌───────────────────────────────────────┴──────────┐ │
│ │ EasyEDA Pro Bridge Extension │ │
│ └──────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────┐
│ Semi-Trusted │
│ │
│ ┌──────────────┐ HTTP (loopback) ┌────────────┐ │
│ │ Local Scripts │◄───────────────────►│ MCP Server │ │
│ └──────────────┘ └────────────┘ │
└────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────┐
│ Untrusted │
│ │
│ ┌──────────────┐ HTTP (network) ┌────────────┐ │
│ │ Remote Client │◄──────────────────►│ MCP Server │ │
│ │ │ (OAuth Required) │ (OAuth) │ │
│ └──────────────┘ └────────────┘ │
│ │
│ ┌──────────────┐ HTTPS API ┌────────────┐ │
│ │ MCP Server │◄──────────────────►│ Supplier │ │
│ │ │ │ APIs │ │
│ └──────────────┘ └────────────┘ │
└────────────────────────────────────────────────────────┘10.2 Threat Scenarios
T1: Credential leakage via logs
- Risk: API keys or tokens appear in log output.
- Mitigation: Automatic redaction of
key,secret,token,password,bearer, andauthorizationpatterns inredactSecrets()andredactObject(). - Residual risk: Low. Custom env vars not following naming conventions could leak.
T2: Unauthorized bridge command execution
- Risk: An attacker sends malicious commands through the bridge WebSocket.
- Mitigation: Schema validation on all messages, payload size enforcement, pairing challenge for non-loopback connections, session token validation, known-method allowlist.
- Residual risk: Low. Loopback-only default prevents remote access.
T3: Supplier API key exposure
- Risk: JLCPCB/Mouser/DigiKey credentials exposed in tool output or logs.
- Mitigation: Secrets never returned in tool output; redacted from config dumps and logs.
- Residual risk: Low.
T4: Unsanctioned design mutation by AI
- Risk: An LLM mutates schematic or PCB state without user consent.
- Mitigation:
confirmWritegate requires explicit acknowledgment for all mutation tools. Tool profiles gate access by risk tier. - Residual risk: Low. The gate is enforced at the registry level before any handler executes.
T5: Local file system traversal via artifact paths
- Risk: A crafted export tool call reads or writes files outside the artifact directory.
- Mitigation: Paths validated against
ARTIFACT_DIRat the tool level. Artifact directory is configurable. - Residual risk: Low.
T6: OAuth token forgery or replay
- Risk: An attacker forges a JWT or replays a captured token.
- Mitigation: JWKS-based signature verification,
iss/aud/expclaim validation, supported algorithm restriction, token type checking. Token expiry limits the replay window. - Residual risk: Medium. Token lifetime depends on IdP configuration — short-lived tokens with rotation are recommended.
T7: DNS rebinding attack
- Risk: Attacker-controlled DNS resolves to the server's IP, bypassing same-origin policy.
- Mitigation: Host header validation on non-loopback deployments checks against the configured
HTTP_HOST. - Residual risk: Low on loopback; Medium on non-loopback without strict Host header checks.
T8: Dependency supply chain attack
- Risk: Compromised dependency introduces malicious code.
- Mitigation: SHA-pinned actions, manual review of runtime dependency and automation upgrades, OSV vulnerability scanning, Socket.dev PR scanning, and blocking dependency audit/Dependency Review gates.
- Residual risk: Low-Medium. Zero-day in a widely-used dependency may not be detected immediately.
T9: Bridge connection hijacking
- Risk: Another process on the same machine connects to the bridge WebSocket before the legitimate EasyEDA Pro extension.
- Mitigation: Session token validation during handshake. Pairing challenge/response for non-loopback. Loopback-only binding by default.
- Residual risk: Low. On a shared machine with
BRIDGE_TOKENunset, the first connection wins.
11. Security Checklists
11.1 Enabling HTTP Mode
- [ ] Set
TRANSPORT=http. - [ ] For loopback (127.0.0.1): OK with defaults. Optionally set
HTTP_AUTH_DISABLED=trueonly for non-production local tooling. - [ ] For remote access:
- [ ] Set
HTTP_HOSTto the bind address (e.g.,0.0.0.0or LAN IP). - [ ] Configure OAuth:
- [ ]
OAUTH_ENABLED=true - [ ]
OAUTH_ISSUER— valid IdP issuer URL. - [ ]
OAUTH_JWKS_URI— valid JWKS endpoint. - [ ]
OAUTH_AUDIENCE— expected audience (defaulteasyeda-mcp-pro).
- [ ]
- [ ] Set an explicit, non-wildcard
ALLOWED_ORIGINSvalue for every non-loopback HTTP listener. - [ ] Configure
HTTP_RATE_LIMIT_MAXif the default 100 req/min is too restrictive.
- [ ] Set
- [ ] Restart the server and verify:
- [ ] Server starts without SAFETY errors.
- [ ]
/healthzreturns200 OK. - [ ] Authenticated request to
/mcpreturns valid MCP response. - [ ] Unauthenticated request to
/mcpreturns401. - [ ] Request from unknown
Originreturns403.
11.2 Enabling Project-Changing Operations
- [ ] Select the appropriate tool profile (
TOOL_PROFILE):- [ ]
core— schematic reads, diagnostics, BOM (no mutations). - [ ]
pro— adds manufacturing exports. - [ ]
full— addseasyeda_api_callfor controlled EasyEDA API access. - [ ]
dev— adds runtime diagnostic probes.
- [ ]
- [ ] Confirm that your AI assistant's system prompt or tool use policy includes asking for user confirmation before calling mutation tools.
- [ ] Verify
confirmWriteis respected:- [ ] Call a mutation tool without
confirmWrite— expectERR_CONFIRM_WRITE_REQUIRED. - [ ] Call a mutation tool with
confirmWrite=true— expect successful execution.
- [ ] Call a mutation tool without
- [ ] (Optional) Enable
AI_ALLOW_DESIGN_MUTATIONS=trueonly if you understand the risks of AI-driven design edits. - [ ] Audit the active tool profile with
easyeda_get_tool_profiles.
11.3 Handling Generated Design & Export Files
- [ ] Set
DATA_DIRorARTIFACT_DIRto a dedicated location (ARTIFACT_DIRdefaults to<DATA_DIR>/artifacts/). - [ ] Verify that export tools write to the artifact directory.
- [ ] Verify path traversal protection: a tool call with
../../../etc/passwdshould be rejected. - [ ] Clean up the artifact directory periodically (exports are not auto-deleted).
- [ ] If sensitive designs are exported, ensure the artifact directory has restricted file system permissions.
- [ ] When using export manifest validation (see export-manifest.md):
- [ ] Define expected artifacts before generating exports.
- [ ] Validate exports against the manifest after generation.
- [ ] Verify checksums if integrity checking is required.
11.4 Production Deployment Readiness
- [ ] Set
NODE_ENV=production. - [ ] Set
LOG_LEVEL=infoorwarn(notdebugortrace). - [ ] Verify safe config:
- [ ]
BRIDGE_RAW_EXEC_ENABLED=false. - [ ]
JLCPCB_ENABLE_ORDERING→ requiresJLCPCB_MODE=approved_api. - [ ]
HTTP_HOSTis loopback OR OAuth is enabled with JWKS, issuer, audience, and a non-wildcard origin allowlist. - [ ]
HTTP_AUTH_DISABLEDisfalsefor production and for any non-loopback HTTP.
- [ ]
- [ ] Run full CI gate locally:
- [ ]
pnpm install --frozen-lockfile - [ ]
pnpm format:check - [ ]
pnpm typecheck - [ ]
pnpm lint(0 errors) - [ ]
pnpm test - [ ]
pnpm build - [ ]
pnpm build:extension+pnpm verify:extension
- [ ]
- [ ] Verify no open security alerts on the GitHub Security tab.
- [ ] Review dependency dashboard for pending critical updates.
12. Related Documentation
- Safety Model — Tool risk classifications,
confirmWritedetails, data privacy. - Export Manifest — Validation rules for manufacturing export artifacts.
- Repository Governance — Branch protection, dependency management policies.
- Release CI Runbook — CI failure triage, release verification checklist.
- Security Policy — Vulnerability reporting, supported versions, scope.
- Configuration Guide — Complete env variable reference.