Skip to content

feat(pkg/history): redact secrets in command history#2892

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/a770644694719aa4
May 26, 2026
Merged

feat(pkg/history): redact secrets in command history#2892
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/a770644694719aa4

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented May 26, 2026

Command history should never contain secrets. This change routes all history entries through portcullis.Redact before storing them, ensuring that API tokens and other credentials pasted at the prompt never reach the in-memory slice or the ~/.cagent/history file.

The history package now redacts entries when adding them and when migrating from the legacy history file. A critical fix ensures that pre-existing secrets in the old ~/.cagent/history.json format are redacted on migration, closing a gap where secrets could be copied verbatim into the new format on first launch.

The remaining commits consolidate test setup code and clean up redundant parsing logic, improving maintainability with no behavioral change.

@dgageot dgageot requested a review from a team as a code owner May 26, 2026 07:49
@rumpl

This comment was marked as outdated.

docker-agent

This comment was marked as outdated.

@aheritier aheritier added area/security Authentication, authorization, secrets, vulnerabilities area/config For configuration parsing, YAML, environment variables kind/feat PR adds a new feature (maps to feat: commit prefix) labels May 26, 2026
@dgageot dgageot force-pushed the board/a770644694719aa4 branch from 4db1879 to e7d2667 Compare May 26, 2026 09:33
@dgageot

This comment was marked as outdated.

@rumpl

This comment was marked as outdated.

@dgageot dgageot force-pushed the board/a770644694719aa4 branch from e7d2667 to 1e36dc6 Compare May 26, 2026 14:12
@dgageot

This comment was marked as outdated.

rumpl
rumpl previously approved these changes May 26, 2026
…history entries through portcullis.Redact before storing them

Signed-off-by: David Gageot <david.gageot@docker.com>
@dgageot dgageot merged commit a8949f6 into docker:main May 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config For configuration parsing, YAML, environment variables area/security Authentication, authorization, secrets, vulnerabilities kind/feat PR adds a new feature (maps to feat: commit prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants