Skip to content

🔐 Fix: Remove hardcoded development secrets [#6]#7

Open
Jerrycyborg wants to merge 2 commits intomainfrom
fix/issue-6-hardcoded-secrets
Open

🔐 Fix: Remove hardcoded development secrets [#6]#7
Jerrycyborg wants to merge 2 commits intomainfrom
fix/issue-6-hardcoded-secrets

Conversation

@Jerrycyborg
Copy link
Owner

Summary

Implements fix for Issue #6 - removes hardcoded development secrets that could be exploited in production.

Changes

  1. New utility: src/utils/secrets.ts

    • Added requireSecretInProduction() function
    • Validates secrets are provided in production environments
    • Falls back to dev defaults only when NODE_ENV !== 'production'
  2. Updated: src/security.ts

    • JobTokenManager constructor uses utility for EDGEMESH_JOB_TOKEN_SECRET
    • NodeJwtManager constructor uses utility for EDGEMESH_NODE_JWT_SECRET
    • NodeTrustManager constructor uses utility for EDGEMESH_BOOTSTRAP_SECRET
  3. Updated: src/control-plane.ts

    • Added import for requireSecretInProduction
    • adminSecret initialization uses utility for EDGEMESH_ADMIN_SECRET

Behavior

  • Development: Works as before with sensible defaults
  • Production: Throws descriptive error if required secrets are missing
    Error: EDGEMESH_ADMIN_SECRET must be set in production. 
    Set the environment variable or NODE_ENV to non-production for development.
    

Testing

  • Existing tests should pass (dev defaults still work)
  • Production deployments will fail-fast if secrets not configured
  • Can test locally by setting NODE_ENV=production without secrets

Closes

Next Steps

After merging, update deployment documentation to highlight required environment variables for production.

Jerrycyborg and others added 2 commits March 2, 2026 11:52
- Add requireSecretInProduction() utility in src/utils/secrets.ts
- Update JobTokenManager, NodeJwtManager, NodeTrustManager to fail-fast in production when secrets are missing
- Secrets fall back to dev defaults only when NODE_ENV !== 'production'
- Prevents accidental deployment with weak default credentials

Closes #6
- Add import for requireSecretInProduction utility
- Update adminSecret initialization to fail-fast in production
- Consistent pattern with security.ts changes
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.

🔴 CRITICAL: Remove hardcoded development secrets in production code

1 participant