Skip to content

fix(mcp): extend env drift guard to examples and scripts directories (#413) - #563

Open
sparkysolutions10-pixel wants to merge 1 commit into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:fix/mcp-env-drift-guard-413
Open

sparkysolutions10-pixel wants to merge 1 commit into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:fix/mcp-env-drift-guard-413

Conversation

@sparkysolutions10-pixel

Copy link
Copy Markdown
Contributor

Summary

Closes #413

Extends the repository environment drift guard to scan examples/ and scripts/ directories in addition to src/, ensuring all environment variables (including dangerous mainnet secret keys) are documented in .env.example with clear operational warnings.

Changes

  • Expanded Drift Guard: Updated src/__tests__/envDrift.test.ts to scan source files across src/, examples/, and scripts/.
  • Documented Variables & Warnings in .env.example:
    • Added explicit documentation and warnings for MCP_AGENT_SECRET_KEY_MAINNET stating plainly that it signs transactions on the public network and can spend real funds.
    • Documented ORACLE_RELAY_RPC_URL and ORACLE_RELAY_NETWORK_PASSPHRASE used in examples/oracle-relay/relay.ts.
  • Negative Test Case: Added unit test in src/__tests__/envDrift.test.ts verifying that any un-documented process.env read in examples/ fails the drift guard as expected.

Tests

  • Run npx vitest run src/__tests__/envDrift.test.ts:
    • asserts each process.env read in source appears in .env.example or the allow-list: PASS
    • fails when a new un-documented process.env read is encountered in src/: PASS
    • fails when an un-documented process.env read is encountered in examples/ (#413): PASS
    • requires every allow-list entry to have an explicit rationale: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The MCP environment variables escape the drift guard

1 participant