🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

fix: redact env var values in agent debug manifest endpoint - #26904

Merged
sreya merged 2 commits into
mainfrom
agent-env-vars
Jul 1, 2026
Merged

fix: redact env var values in agent debug manifest endpoint#26904
sreya merged 2 commits into
mainfrom
agent-env-vars

Conversation

@sreya

@sreya sreya commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

The unauthenticated /debug/manifest endpoint on the agent debug server (127.0.0.1:2113 by default) JSON-encoded the full manifest, including EnvironmentVariables values. Because the endpoint is reachable by any process in the workspace regardless of Unix user, template-provided values that may carry credentials were readable across users.

Redact the environment variable values in the debug manifest response while preserving the keys, so operators can still confirm which variables are configured. This matches the existing support-bundle behavior, which already redacts these values via sanitizeEnv.

The unauthenticated /debug/manifest endpoint on the agent debug server
(127.0.0.1:2113 by default) JSON-encoded the full manifest, including
EnvironmentVariables values. Because the endpoint is reachable by any
process in the workspace regardless of Unix user, template-provided
values that may carry credentials were readable across users.

Redact the environment variable values in the debug manifest response
while preserving the keys, so operators can still confirm which
variables are configured. This matches the existing support-bundle
behavior, which already redacts these values via sanitizeEnv.
@sreya
sreya requested a review from johnstcn July 1, 2026 00:26
@sreya

sreya commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-07-01 00:59 UTC by @sreya
Spend: $24.77 / $100.00

Review history
  • R1 (2026-07-01): 13 reviewers, 3 Nit, 1 Note, 2 P3, COMMENT. Review
  • R2 (2026-07-01): 13 reviewers, 3 Nit, 1 Note, 2 P3, APPROVE. Review

deep-review v0.9.0 | Round 2 | 3d966d4..8f4d8b3

Last posted: Round 2, 6 findings (2 P3, 3 Nit, 1 Note), APPROVE. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (8f4d8b3) agent/agent.go:2317 Redaction sentinel "*redacted*" differs from "***REDACTED***" in support/support.go R1 Netero P3, Ryosuke Nit Yes
CRF-2 P3 Author fixed (8f4d8b3) agent/agent.go:2294 Block comment inflates a two-sentence insight to six lines R1 Gon Yes
CRF-3 Nit Author fixed (8f4d8b3) agent/agent.go:2315 Doc comment on redactedManifestEnvValue restates the constant name R1 Gon Yes
CRF-4 Nit Author fixed (8f4d8b3) agent/agent_test.go:3821 Test comments at lines 3821 and 3828 restate what test name and assertions show R1 Gon Yes
CRF-5 Nit Author fixed (8f4d8b3) agent/agent_test.go:3675 Shared sentinel value between ManifestSecretsStripped and ManifestEnvVarValuesRedacted weakens failure diagnosis R1 Chopper Yes
CRF-6 Note Author fixed (8f4d8b3) agent/agent.go:2303 Empty-value env vars are redacted, diverging from sanitizeEnv which preserves them R1 Hisoka, Ryosuke Yes
CRF-7 Note Dropped by orchestrator (informational; code correct per 3+ reviewers) agent/agent.go:2300 Shallow copy shares reference-type fields with live manifest R1 Ryosuke No

Contested and acknowledged

(none)

Round log

Round 1

Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Gon, Leorio, Kurapika, Ging-Go, Komugi, Chopper, Ryosuke, Meruem (wildcard). Netero pre-panel. 2 P3, 3 Nit, 1 Note new. 1 Note dropped. Reviewed against 3d966d4..7bc3785.

Round 2

Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Gon, Leorio, Kurapika, Ging-Go, Komugi, Chopper, Ryosuke, Kite (wildcard). Netero pre-panel. CRF-1 through CRF-6 all verified fixed by multiple reviewers. 2 Gon Nits (marginal comment trim) dropped by orchestrator (12/13 reviewers found no issues; one-clause restatements within editorial judgment). No new findings. Reviewed against 3d966d4..8f4d8b3.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-tasks

coder-tasks Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/reference/agent-api/debug.md - The "Get debug manifest" section should note that EnvironmentVariables values are redacted (keys are preserved). This is a behavioral change to a documented endpoint that operators may rely on for debugging.

Automated review via Coder Agents

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean security fix. The shallow copy + map replacement correctly avoids mutating the atomic-loaded manifest that other goroutines read. The test covers both directions: secret absent from body, key preserved with redacted value. Three reviewers independently verified the concurrency safety of the approach. Pariston built four adversarial framings and concluded the problem is correctly understood and the fix is at the right causal level.

2 P3, 3 Nit, 1 Note.

"Pulled the threads. The code does what it says. ♦" (Hisoka)

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/agent.go Outdated
Comment thread agent/agent.go Outdated
Comment thread agent/agent.go Outdated
Comment thread agent/agent_test.go Outdated
Comment thread agent/agent_test.go
Comment thread agent/agent.go Outdated
Address review feedback on the debug manifest redaction:

- Use the same "***REDACTED***" marker as sanitizeEnv in
  support/support.go so a support bundle and the debug endpoint agree.
- Preserve empty env values as empty, matching sanitizeEnv, so an
  explicitly empty variable is not mistaken for one carrying a value.
- Trim comments and use a distinct sentinel value in the test so a
  redaction failure cannot be confused with ManifestSecretsStripped.
@sreya sreya changed the title fix(agent): redact env var values in debug manifest endpoint fix: redact env var values in agent debug manifest endpoint Jul 1, 2026
@sreya

sreya commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All six R1 findings addressed in a single clean commit. Sentinel aligned with sanitizeEnv, comments trimmed, test sentinels made distinct, empty-value behavior matched.

Multiple reviewers independently verified the concurrency safety (shallow copy + new map, atomic load, no mutation of live manifest), confirmed redaction covers both the unauthenticated debug server and the tailnet API handler, and traced the edge case (empty env vars preserved, matching sanitizeEnv).

No new findings.

"I tried to build a case against this change and could not. The problem is correctly understood, the solution is proportional, and the fix is at the right causal level." (Pariston)

🤖 This review was automatically generated with Coder Agents.

@sreya
sreya merged commit b33ff2d into main Jul 1, 2026
32 of 33 checks passed
@sreya
sreya deleted the agent-env-vars branch July 1, 2026 15:46
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants