Skip to content

fix: redact sensitive tool-call logs - #575

Open
Soumyajit2288 wants to merge 1 commit into
wonderwhy-er:mainfrom
Soumyajit2288:agent/redact-tool-call-logs
Open

fix: redact sensitive tool-call logs#575
Soumyajit2288 wants to merge 1 commit into
wonderwhy-er:mainfrom
Soumyajit2288:agent/redact-tool-call-logs

Conversation

@Soumyajit2288

@Soumyajit2288 Soumyajit2288 commented Jul 11, 2026

Copy link
Copy Markdown

Summary

  • recursively redact command, content, environment, credential, and token values before tool arguments are serialized
  • retain non-sensitive structural fields such as paths and offsets for debugging
  • create and tighten the active tool-call log with owner-only 0600 permissions
  • preserve private permissions after log rotation
  • add regression coverage for nested secret removal and file permissions

Security boundary

Tool arguments can contain shell commands, file contents, environment variables, and credentials. Those values previously reached claude_tool_call.log verbatim and the file used ambient umask permissions. Logging now records only type/length placeholders for sensitive fields and explicitly restricts the destination file.

Fixes #506.

Validation

  • npm run build
  • node test/test-tool-call-log-security.js
  • git diff --check

Summary by CodeRabbit

  • Security Enhancements
    • Sensitive tool-call arguments are now redacted before being written to logs.
    • Nested objects and arrays are sanitized to help prevent accidental exposure of secrets.
    • Log files are created with restrictive access permissions.
  • Tests
    • Added coverage verifying sensitive values are excluded from logs and log files use secure permissions.

@Soumyajit2288

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5891ac1a-643c-4ec9-94a1-8e5b2a3e1d64

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Tool-call logging now recursively redacts sensitive argument values, preserves safe values, and ensures log files use owner-only permissions. A security test validates redaction, file creation, permissions, cleanup, and successful completion.

Changes

Tool-call log security

Layer / File(s) Summary
Argument sanitization
src/utils/trackTools.ts, test/test-tool-call-log-security.js
Sensitive argument keys are replaced with type-and-length placeholders, including within nested objects and arrays; tests verify redacted and preserved values.
Secure log write path
src/utils/trackTools.ts, test/test-tool-call-log-security.js
trackToolCall logs sanitized arguments, ensures the log file exists with mode 0o600, appends with restrictive mode options, and tests file permissions and cleanup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title concisely matches the main change: redacting sensitive tool-call logs.
Linked Issues check ✅ Passed The PR redacts sensitive arguments recursively, preserves non-sensitive fields, hardens log-file permissions, and adds security tests.
Out of Scope Changes check ✅ Passed The added test and permission-hardening changes are directly tied to the logging redaction work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

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.

Redact sensitive values and restrict tool-call log permissions

1 participant