Skip to content

fix(security): require MNEMONIC env var, remove hardcoded default#247

Open
JackBinswitch-btc wants to merge 1 commit intoaibtcdev:mainfrom
JackBinswitch-btc:fix/remove-hardcoded-mnemonic
Open

fix(security): require MNEMONIC env var, remove hardcoded default#247
JackBinswitch-btc wants to merge 1 commit intoaibtcdev:mainfrom
JackBinswitch-btc:fix/remove-hardcoded-mnemonic

Conversation

@JackBinswitch-btc
Copy link

Summary

  • Remove the hardcoded testnet mnemonic from DEFAULT_CONFIG in src/utilities.ts
  • Require the MNEMONIC environment variable to be set, throwing a clear error if missing
  • Prevents silent fallback to a publicly-known mnemonic phrase

What changed

In src/utilities.ts:

  1. DEFAULT_CONFIG.MNEMONIC changed from the hardcoded testnet mnemonic "crater office wreck aunt lumber casino veteran mixed float arrive lens final" to an empty string "".

  2. loadConfig() MNEMONIC resolution changed from:

    MNEMONIC: process.env.MNEMONIC || DEFAULT_CONFIG.MNEMONIC,

    to:

    MNEMONIC: (() => {
      const m = process.env.MNEMONIC;
      if (!m) throw new Error("MNEMONIC environment variable is required. Set it in your .env file.");
      return m;
    })(),

This ensures that if MNEMONIC is not set in the environment, the application fails fast with a descriptive error instead of silently using a publicly-known key.

Test plan

  • Verify build passes with MNEMONIC env var set
  • Verify application throws a clear error when MNEMONIC is not set
  • Verify no other files were modified
  • Confirm existing tests pass with MNEMONIC provided via .env

Closes #245.

🤖 Generated with Claude Code

Require MNEMONIC env var instead of silently falling back to
a publicly-known default mnemonic. Closes aibtcdev#245.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

security: hardcoded testnet mnemonic in default config (utilities.ts)

1 participant