Skip to content

fix: extend trajectory JSONL redaction to cover Google, AWS, Daytona, and header patterns (#537)#585

Open
ElegantLin wants to merge 1 commit into
mainfrom
fix/537-trajectory-redaction
Open

fix: extend trajectory JSONL redaction to cover Google, AWS, Daytona, and header patterns (#537)#585
ElegantLin wants to merge 1 commit into
mainfrom
fix/537-trajectory-redaction

Conversation

@ElegantLin
Copy link
Copy Markdown
Contributor

@ElegantLin ElegantLin commented May 30, 2026

Summary

Trajectory.to_jsonl only redacted two secret patterns (sk-ant-, Bearer). Every other production credential pattern could leak into acp_trajectory.jsonl if it entered trajectory content (e.g. agent running env as a tool call).

Added redaction for:

  • Google AI / Gemini: AIzaSy*
  • AWS access keys: AKIA* / ASIA* (anchored to exact 20-char length to avoid matching ASIAPACIFIC etc.)
  • Daytona: dtn_* (≥16 char suffix to avoid short identifiers)
  • OpenAI project keys: sk-proj-*
  • HTTP headers: x-api-key, api-key (Azure)

Extracted patterns into a compiled _REDACTION_PATTERNS list and a reusable redact_trajectory_text() function for downstream callers.

Test plan

  • 10 parametrized tests covering each secret pattern
  • 7 parametrized false-positive guard tests (English words, hyphenated slugs, short identifiers)
  • End-to-end tests through Trajectory.to_jsonl(redact_keys=True/False)
  • 21/21 trajectory tests pass; ruff clean
  • Self-reviewed for regex correctness and false positives before submitting

Closes #537

🤖 Generated with Claude Code


Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@ElegantLin ElegantLin force-pushed the fix/537-trajectory-redaction branch from 1693596 to 42cf8f8 Compare May 30, 2026 04:07
… and header patterns (#537)

Trajectory.to_jsonl only redacted sk-ant- (Anthropic) and Bearer headers.
Other production credential patterns could leak into acp_trajectory.jsonl
if they entered trajectory content (e.g. agent running `env` as a tool call).

Added redaction for:
- Google AI / Gemini: AIzaSy*
- AWS access keys: AKIA* / ASIA* (anchored to exact 20-char length)
- Daytona: dtn_* (>=16 char suffix to avoid short identifiers)
- OpenAI project keys: sk-proj-*
- HTTP headers: x-api-key, api-key (Azure)

Extracted patterns into a compiled _REDACTION_PATTERNS list and a reusable
redact_trajectory_text() function. All test fixtures use obviously-fake keys.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ElegantLin ElegantLin force-pushed the fix/537-trajectory-redaction branch from 42cf8f8 to 030a52c Compare May 30, 2026 05:26
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.

Trajectory JSONL redaction can miss Google AIza, AWS AKIA, x-api-key, Daytona dtn_ patterns

1 participant