Skip to content

fix(stack): redact env in PATCH /stacks/:slug/env response + panic-safe audit#217

Merged
mastermanas805 merged 2 commits into
masterfrom
fix/bugbash-stack-env-redaction
Jun 2, 2026
Merged

fix(stack): redact env in PATCH /stacks/:slug/env response + panic-safe audit#217
mastermanas805 merged 2 commits into
masterfrom
fix/bugbash-stack-env-redaction

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

Two bug-bash (2026-06-02) findings on the stack env handler.

P1 — secret leak in response: PATCH /stacks/:slug/env echoed the full merged env map verbatim, unlike DeployHandler.UpdateEnv which redacts. Setting one harmless key returned ALL prior values (credential URLs, secret-keyed values from stacks.env_vars) in cleartext into logs/transcripts. Now redactEnvVars(merged) — stored value stays unredacted, only the response is masked.

P2 — unrecovered goroutine: the audit-emit go func had no panic recovery; switched to safego.Go.

Local: build + vet clean. 🤖 Generated with Claude Code

…fe audit

Two bug-bash (2026-06-02) findings on the stack env-update handler:

- The response echoed the full merged env map verbatim (`"env": merged`),
  unlike DeployHandler.UpdateEnv which redacts the same shape. A PATCH setting
  one harmless key returns ALL previously-set values — including credential
  URLs and secret-keyed values carried over in stacks.env_vars — in cleartext
  into proxy logs / browser panels / agent transcripts. Now returns
  redactEnvVars(merged) (stored value stays unredacted; only the response is
  masked).
- The audit-emit goroutine was a bare `go func` with no panic recovery; switch
  to safego.Go to match runStackDeploy/runStackRedeploy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 2, 2026 16:33
Update TestStack_PatchEnv_PersistsAndReturns to expect the response to mask
DATABASE_URL to "***" (key contains "URL") while NODE_ENV passes through —
matching the bug-bash #1 redaction fix. The DB round-trip assertions still
verify the STORED value is the unredacted "postgres://example".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit fcc0063 into master Jun 2, 2026
18 checks passed
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.

1 participant