-
Notifications
You must be signed in to change notification settings - Fork 0
fix(logging): enable redaction by default when global rules exist #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: p3-4/ui/docs
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce38317fcb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ce38317 to
de20be3
Compare
de20be3 to
8e14398
Compare
Add early return when redaction.enabled is explicitly false, so loggers can opt out even when global redaction rules exist. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Greptile Summary
|
| Filename | Overview |
|---|---|
packages/logging/src/index.ts |
Modified redaction logic to automatically apply global rules without requiring explicit enabled: true flag |
packages/logging/src/__tests__/logging.test.ts |
Added test cases validating automatic redaction and explicit opt-out behaviors |
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it fixes a security vulnerability and improves user experience
- Score reflects strong implementation with proper edge case handling and comprehensive test coverage, but slight complexity in the redaction logic could benefit from additional review
- Pay close attention to the redaction logic in
packages/logging/src/index.tsto verify the conditional checks are correct
Sequence Diagram
sequenceDiagram
participant User
participant Logger as "LoggerInstance"
participant ProcessMeta as "processMetadata()"
participant RedactionCheck as "redactValue()"
participant Sink
participant Formatter
User->>Logger: "logger.info(message, metadata)"
Logger->>Logger: "shouldLog(level, minLevel)"
Logger->>ProcessMeta: "processMetadata(metadata, redactionConfig)"
ProcessMeta->>ProcessMeta: "Check explicit enabled: false"
ProcessMeta->>ProcessMeta: "Check global patterns/keys exist"
alt Global rules exist OR redaction enabled
ProcessMeta->>RedactionCheck: "redactValue(metadata, keys, patterns)"
RedactionCheck-->>ProcessMeta: "redacted metadata"
end
ProcessMeta-->>Logger: "processed metadata"
Logger->>Logger: "Create LogRecord"
loop For each sink
Logger->>Formatter: "format(record)"
Formatter-->>Logger: "formatted string"
Logger->>Sink: "write(record, formatted)"
end
8e14398 to
f363099
Compare
142ebf6 to
72d9f7e
Compare
|
Updated redaction tests to ensure enabled:false still opts out even when global rules are configured after logger creation. |
|
Checked for new feedback; no changes needed. Stack still up to date. |

Summary
When
configureRedaction()is called with patterns or keys, redaction now applies automatically to all loggers — no need to explicitly passredaction: { enabled: true }tocreateLogger().Problem
Previously, redaction was gated on
redactionConfig?.enabled:Solution
Check if global rules exist before skipping redaction:
Now the same code works as expected:
Test plan
Fixes #40
🤖 Generated with Claude Code