DIS-003: sanitizedEnv() -- Secrets aus Child-Env entfernen #22

Closed
dev wants to merge 2 commits from phase-0/sanitize-env into main
Owner

Summary

  • src/runtime/env.ts (neu): pure sanitizedEnv() — entfernt DISCORD_BOT_TOKEN, SECRET_/TOKEN_/API_KEY_*-Pattern, setzt CI=true/DISCLAW_AGENT=1
  • src/config/loader.ts: optionales env_blocklist-Feld ergänzt
  • src/agent/runner.ts: process.env-Passthrough durch sanitizedEnv() ersetzt
  • 7 neue Unit-Tests, alle grün (inkl. Mutation-Guard)

Closes

Closes #4

Test Plan

  • npm run build grün
  • npm test — 7/7 sanitize-env + 5/5 resolve-claude Tests grün
  • process.env wird nicht mutiert (Test vorhanden)

Breaking Changes

Nein.

Reviewer-Checkliste

  • Kein shell: true in src/
  • Kein process.env direkt im Runner (nur via sanitizedEnv)
  • Tests decken Error-Cases ab
  • Kein console.* im Produktionscode
## Summary - `src/runtime/env.ts` (neu): pure `sanitizedEnv()` — entfernt DISCORD_BOT_TOKEN, SECRET_*/TOKEN_*/API_KEY_*-Pattern, setzt CI=true/DISCLAW_AGENT=1 - `src/config/loader.ts`: optionales `env_blocklist`-Feld ergänzt - `src/agent/runner.ts`: `process.env`-Passthrough durch `sanitizedEnv()` ersetzt - 7 neue Unit-Tests, alle grün (inkl. Mutation-Guard) ## Closes Closes #4 ## Test Plan - [x] `npm run build` grün - [x] `npm test` — 7/7 sanitize-env + 5/5 resolve-claude Tests grün - [x] `process.env` wird nicht mutiert (Test vorhanden) ## Breaking Changes Nein. ## Reviewer-Checkliste - [x] Kein `shell: true` in `src/` - [x] Kein `process.env` direkt im Runner (nur via `sanitizedEnv`) - [x] Tests decken Error-Cases ab - [x] Kein `console.*` im Produktionscode
dev added the
phase:0
priority:p0
security
type:fix
labels 2026-04-09 08:40:08 +00:00
dev added 1 commit 2026-04-09 08:40:09 +00:00
Introduces src/runtime/env.ts with a pure sanitizedEnv() function that
strips DISCORD_BOT_TOKEN, DISCORD_CLIENT_SECRET, DISCORD_PUBLIC_KEY, and
all keys matching /^(DISCLAW_SECRET_|SECRET_|TOKEN_|API_KEY_?)/i before
passing the environment to spawned Claude Code child processes. Adds
optional env_blocklist field to DisclawConfig. Runner now passes
DISCLAW_AGENT_NAME and respects the blocklist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev added 1 commit 2026-04-09 09:00:54 +00:00
dev closed this pull request 2026-04-09 09:03:12 +00:00
dev deleted branch phase-0/sanitize-env 2026-04-09 09:03:52 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.