Repository navigation
fix(security): strip plaintext credentials from the tree - #1258
Conversation
Replace hardcoded secrets with environment-variable references: - AMD/Xilinx account e-mail and password in the Vivado AuthTokenGen expect script -> $env(AMD_ACCOUNT_EMAIL) / $env(AMD_ACCOUNT_PASSWORD), failing fast when unset. - DeepSeek API key in four book generator scripts -> os.environ. - Kaggle API token (24 scripts) and a z.ai-style model proxy key (5 scripts) under targets/kaggle -> read from the environment. - Telegram bot tokens in two ralph scripts and one default in ralph-cron.sh -> required env var / empty default. - A fallback API key in docs/docs/development/ralph.md -> placeholder with a note to read it from Railway or Infisical. - Untrack .trinity/ralph/queue/.creds and gitignore it. Credentials must be rotated; history still contains them. This change only removes them from the current tree; no history was rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bee review: head
|
fix(security): strip plaintext credentials from the tree (#1258) Replace hardcoded secrets with environment-variable references: - AMD/Xilinx account e-mail and password in the Vivado AuthTokenGen expect script -> $env(AMD_ACCOUNT_EMAIL) / $env(AMD_ACCOUNT_PASSWORD), failing fast when unset. - DeepSeek API key in four book generator scripts -> os.environ. - Kaggle API token (24 scripts) and a z.ai-style model proxy key (5 scripts) under targets/kaggle -> read from the environment. - Telegram bot tokens in two ralph scripts and one default in ralph-cron.sh -> required env var / empty default. - A fallback API key in docs/docs/development/ralph.md -> placeholder with a note to read it from Railway or Infisical. - Untrack .trinity/ralph/queue/.creds and gitignore it. Credentials must be rotated; history still contains them. This change only removes them from the current tree; no history was rewritten. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Removes plaintext credentials from the current tree of
main, replacing each with an environment-variable reference. Credentials must be rotated; history still contains them. No history was rewritten and nothing was force-pushed. No secret value appears in this PR body or in the commit message.Credentials found (file:line on
main@ cd5e41f, TYPE only)fpga/fly-vivado/setup_and_synth.exp:9$env(AMD_ACCOUNT_EMAIL)fpga/fly-vivado/setup_and_synth.exp:11$env(AMD_ACCOUNT_PASSWORD), script exits 1 if either is unsetdocs/book/book/generator/coptic_mega_translator.py:13sk-)os.environ.get("DEEPSEEK_API_KEY", "")docs/book/book/generator/llm_book_generator.py:15docs/book/book/generator/llm_deep_generator.py:14docs/book/book/generator/llm_parallel_generator.py:14.trinity/ralph/scripts/report.sh:5${TELEGRAM_BOT_TOKEN:?...}fpga/tools/ralph-cron.sh:53${RALPH_TELEGRAM_BOT_TOKEN:-}.trinity/ralph/scripts/test_telegram.sh:4${TELEGRAM_BOT_TOKEN:?...}targets/kaggle/kaggle/*.py(24 files, line 2-15 each)KGAT_, two distinct tokens)os.environ[...] = ...line; read from the environmenttargets/kaggle/kaggle/{explore_benchmark_creation.py:7, test_full_run.py:4, test_full_run2.py:4, test_full_run3.py:4, test_models2.py:4}MODEL_PROXY_API_KEY)docs/docs/development/ralph.md:476.trinity/ralph/queue/.creds:1git rm --cached) and added to.gitignoreKaggle files touched:
check_benchmark_api.py,check_benchmark_button.py,check_dataset_status.py,check_dataset_via_api.py,check_kaggle_user.py,check_kbench3.py,check_kbench4.py,create_benchmark.py,create_benchmark_api.py,create_dataset.py,create_kaggle_dataset.py,create_test_benchmark.py,explore_benchmark_creation.py,explore_kaggle_api.py,test_full.py,test_full_run.py,test_full_run2.py,test_full_run3.py,test_kaggle_api.py,test_kaggle_cli.py,test_kaggle_modules.py,test_models.py,test_models2.py,test_register.py.Owner action: rotate all of these
/revoke).MODEL_PROXY_API_KEY,FALLBACK_API_KEY,.credsAPI_KEY).After rotation, store new values in Railway/Infisical under:
AMD_ACCOUNT_EMAIL,AMD_ACCOUNT_PASSWORD,DEEPSEEK_API_KEY,TELEGRAM_BOT_TOKEN/RALPH_TELEGRAM_BOT_TOKEN,KAGGLE_API_TOKEN,MODEL_PROXY_API_KEY.Not changed (checked, not live secrets)
deploy/trinity-nexus/ralph/queue/.api_keys.conf(keys empty),.env.examplefiles (placeholders),tools/telegram-bridge/internal/config/config_test.go(dummy local DB URL),src/*/crypto.zig,src/*/agent.zig(test literals),deploy/trinity-nexus/vibee/archive/ai_security_scanner.vibee:360(an obvioussk-1234567890...sample).Pre-existing (not introduced here):
targets/kaggle/kaggle/create_kaggle_dataset.pyandcreate_test_benchmark.pyalready failpy_compileonmain.{ "version": 1, "head_sha": "e56321c9dd199c9a9494e9196a226c76cbea8d91", "summary": "Removes plaintext credentials (AMD account password, DeepSeek key, Telegram bot tokens, Kaggle tokens, z.ai-style keys) from the current tree and replaces them with environment-variable references; history is untouched and rotation is required.", "changes": [ "The Vivado AuthTokenGen expect script reads the AMD account e-mail and password from the environment and fails fast when they are unset.", "Four book generator scripts read the DeepSeek API key from the environment instead of a hardcoded literal.", "Twenty-four Kaggle scripts no longer assign a hardcoded Kaggle token or model proxy key into os.environ.", "Three ralph shell scripts take the Telegram bot token from the environment with no embedded default.", "The ralph documentation example uses a placeholder key, and the tracked ralph queue credentials file is untracked and gitignored." ], "tests": [ { "command": "git show HEAD | grep '^+' | grep -cE 'KGAT_|sk-[A-Za-z0-9]{20}|[0-9]{8,10}:AA|[0-9a-f]{32}\\.'", "result": "Zero added lines match any of the credential patterns that were found.", "status": "passed", "evidence": "The command printed 0 on the pushed head commit." }, { "command": "git grep -nIE 'KGAT_[A-Za-z0-9]{20,}|sk-[A-Za-z0-9]{20,}|[0-9]{8,10}:AA[A-Za-z0-9_-]{30,}|[0-9a-f]{32}\\.[A-Za-z0-9]{16}'", "result": "No remaining matches anywhere in the tree after the change.", "status": "passed", "evidence": "Empty output on the branch head after untracking the credentials file." }, { "command": "bash -n .trinity/ralph/scripts/report.sh .trinity/ralph/scripts/test_telegram.sh fpga/tools/ralph-cron.sh && python3 -m py_compile <changed .py files>", "result": "Shell scripts parse; all changed Python files compile except two that already failed on main.", "status": "passed", "evidence": "create_kaggle_dataset.py and create_test_benchmark.py fail identically on main before this change." }, { "command": "expect fpga/fly-vivado/setup_and_synth.exp", "result": "Not executed because it needs the Vivado installer and a real AMD account.", "status": "not_run", "evidence": "The change only swaps two send literals for env lookups plus an unset guard." } ], "limitations": [ "Git history still contains every removed value, so each credential must be rotated by the owner.", "Scripts that relied on the embedded values now need the matching environment variables set from Railway or Infisical." ], "tags": ["security", "secrets", "credentials"], "blog": { "title": "Plaintext credentials removed from the trinity tree", "summary": "An earlier review found an AMD account password and a DeepSeek key in plaintext; a sweep found Telegram, Kaggle and z.ai-style keys too, and all now come from the environment.", "outline": [ "What the sweep looked for, which patterns it used, and which credential types it found in the current tree of main.", "How each value was replaced with an environment-variable reference written in the language of the file that held it.", "Why git history was left alone, no force push was used, and why rotating every key is the real remedy for a leak." ] } }🤖 Generated with Claude Code