Skip to content

fix(store): redact environment values in the 1.7 JSON store - #1533

Merged
scttbnsn merged 6 commits into
dev/v1.7from
fix/v1.7-store-env
Oct 31, 2026
Merged

scttbnsn merged 6 commits into
dev/v1.7from
fix/v1.7-store-env

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

The 1.7 Loki JSON store still saves secret environment values in container records and update-operation snapshots. This backports write redaction and a startup scrub that must save successfully before initialization completes.

Environment reveal now inspects the exact live Docker ID locally or through the owning authenticated agent. Older agents and edge connections return an explicit unsupported response. Runtime comparisons use the same redaction to avoid repeated change events, and agent round trips preserve classification for masked credential URLs.

Unknown secret names and older backup files remain outside this pattern-based cleanup. Secret-only value changes no longer count as runtime-detail changes. The rc.4 notes cover these limits and the agent upgrade requirement.

Validation: the full normal push gate passed, including local Qlty, lint, Knip, script/workflow checks, app/UI builds and 100% configured app/UI coverage. All 14,307 backend and 5,135 UI tests pass. CodeRabbit CLI reviewed all 21 files on the current head; both comments were checked against the implementation and need no change.

Refs #1523.

Changelog

  • 🔒 Redact recognized secret environment values before storing container records and operation snapshots.
  • 🔒 Scrub legacy values in the JSON store during startup. Save the scrubbed data before initialization completes.
  • ✨ Add authenticated GET /api/containers/:id/env endpoints for live environment retrieval by exact container ID.
  • ✨ Reveal live values through the owning agent when available. Return explicit unsupported errors for older agents and edge connections.
  • 🔧 Compare runtime details after redaction to avoid change events caused only by recognized secret-value changes.
  • ✨ Add regression tests for persistence, startup cleanup, live reveal, agent routing, and runtime comparisons.
  • 🔧 Document redaction and reveal limits in the v1.7.1-rc.4 notes.

Concerns

  • Unknown secret names and older backup files are not covered by pattern-based cleanup.
  • Older agents and edge connections cannot reveal environment values.
  • Changes limited to recognized secret values do not count as runtime-detail changes.
  • Validation results are reported by the PR author: 14,307 backend tests and 5,135 UI tests passed. Review finding counts are unavailable.

@scttbnsn

Copy link
Copy Markdown
Contributor Author

CodeRabbit CLI reviewed exact head 2b1ec4237755a7ebfd0f7367e3f1945bdd16dee4, with coverage verified against all 21 changed files. This was the second CLI pass. Both reported comments were checked:

  • The startup collection lookup uses a real Loki 1.5.12 instance, which always provides getCollection. The adjacent session guard is explicitly for incomplete test doubles. The doubles implement the real method, and real-Loki startup tests cover durable cleanup and save failure.
  • Operation insert redacts the snapshot before storage. Every subsequent write uses persistOperationPatch, which redacts the snapshot before reinserting it. Both updateOperation and markOperationTerminal delegate to that boundary. Serialized insert/update regressions pass.

No production change is needed for either comment. The normal local push gate passed, including local Qlty, builds and 100% configured coverage. All 14,307 backend and 5,135 UI tests pass.

@scttbnsn

Copy link
Copy Markdown
Contributor Author

@greptileai Review exact head 2b1ec4237755a7ebfd0f7367e3f1945bdd16dee4. Threat model: self-hosted controller with authenticated operators and trusted agents. Focus on secret env persistence in Loki records and operation snapshots, durable startup scrub and save failures, exact-ID live reveal without cached/name fallback, authenticated agent routing and safe older-agent behavior. Verify exploitable leaks and cross-file regressions in this security backport.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5a22c7e and 2b1ec42.

Files ignored due to path filters: 1
  • CHANGELOG.md is excluded by !CHANGELOG.md
Files selected for processing: 20
  • app/agent/AgentClient.test.ts
  • app/agent/AgentClient.ts
  • app/agent/api/container.test.ts
  • app/agent/api/container.ts
  • app/agent/api/index.test.ts
  • app/agent/api/index.ts
  • app/api/container.test.ts
  • app/api/container/crud.test.ts
  • app/api/container/handlers/actions.ts
  • app/api/container/shared.ts
  • app/store/container-persistence.test.ts
  • app/store/container.test.ts
  • app/store/container.ts
  • app/store/index.runtime-env.test.ts
  • app/store/index.test.ts
  • app/store/index.ts
  • app/store/update-operation.ts
  • app/watchers/providers/docker/runtime-details.test.ts
  • app/watchers/providers/docker/runtime-details.ts
  • content/docs/current/updates/index.mdx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The change redacts recognized environment secrets before storing container records and update-operation snapshots, and scrubs existing records during store initialization. It adds authenticated agent and controller paths that retrieve environment values from live containers. Runtime-detail comparisons redact values before comparison. Release notes describe the redaction behavior, reveal limitations, and backup scope.

Possibly related issues

  • Issue 1523 — Reports plaintext container runtime environment values in the JSON store; this change adds write-time redaction and startup cleanup.

Possibly related PRs

  • CodesWhat/drydock#1527: Covers the same environment redaction, live reveal, and runtime comparison behavior.
  • CodesWhat/drydock#1433: Adds the same environment endpoint, agent routing, and Docker-ID inspection flow.
  • CodesWhat/drydock#1408: Tests redacted secret values in lifecycle events and previews, related to the redaction behavior here.

Suggested labels: second-opinion

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 2b1ec

No actionable merge-blocking risk remains. The startup scrub completes before the API serves requests.

Pre-merge checks: Passed 2
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@biggest-littlest biggest-littlest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checked the JSON write boundaries, durable startup cleanup and exact-ID local/agent reveal. The full local gate passes with 100% configured coverage. The two CLI comments are covered by the existing Loki and operation persistence contracts. Required hosted checks and bot review still need to finish before merge.

@scttbnsn
scttbnsn enabled auto-merge (squash) October 31, 2026 18:58
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttbnsn
scttbnsn merged commit 2b351e6 into dev/v1.7 Oct 31, 2026
30 of 31 checks passed
@scttbnsn
scttbnsn deleted the fix/v1.7-store-env branch October 31, 2026 19:14
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.

2 participants