-
Notifications
You must be signed in to change notification settings - Fork 0
feat(logging): add DEFAULT_PATTERNS for common secret redaction #73
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
Open
galligan
wants to merge
1
commit into
graphite-base/73
Choose a base branch
from
p3-11/logging/default-patterns
base: graphite-base/73
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+401
−2
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jan 23, 2026
Contributor
Author
This was referenced Jan 23, 2026
ad3fdae to
ce86912
Compare
05957f2 to
cc258f2
Compare
3 tasks
cc258f2 to
d1b8000
Compare
ce86912 to
1578d94
Compare
This was referenced Jan 23, 2026
1578d94 to
c187efe
Compare
d1b8000 to
a213cf7
Compare
This was referenced Jan 23, 2026
Greptile Summary
|
| Filename | Overview |
|---|---|
packages/logging/src/index.ts |
Major enhancement adding DEFAULT_PATTERNS export, child() method to logger interface, and message redaction capabilities |
packages/logging/src/__tests__/redaction-patterns.test.ts |
New comprehensive test suite validating DEFAULT_PATTERNS redaction across all secret types and edge cases |
Confidence score: 4/5
- This PR is safe to merge with good security improvements and comprehensive test coverage
- Score reflects well-tested functionality but complexity in redaction logic and interface changes that could affect existing consumers
- Pay close attention to the logger interface changes in
packages/logging/src/index.tsto ensure backward compatibility
Sequence Diagram
sequenceDiagram
participant User
participant LoggerInstance
participant processMetadata
participant applyPatterns
participant DEFAULT_PATTERNS
participant Sink
participant Formatter
User->>LoggerInstance: "info(message, metadata)"
LoggerInstance->>LoggerInstance: "shouldLog(level, minLevel)"
LoggerInstance->>processMetadata: "processMetadata(metadata, redactionConfig)"
processMetadata->>processMetadata: "redactValue(value, keys, patterns, replacement)"
processMetadata->>applyPatterns: "applyPatterns(value, patterns, replacement)"
applyPatterns->>DEFAULT_PATTERNS: "pattern.replace(value, replacement)"
DEFAULT_PATTERNS-->>applyPatterns: "redacted value"
applyPatterns-->>processMetadata: "redacted value"
processMetadata-->>LoggerInstance: "processed metadata"
LoggerInstance->>applyPatterns: "applyPatterns(message, patterns, replacement)"
applyPatterns->>DEFAULT_PATTERNS: "pattern.replace(message, replacement)"
DEFAULT_PATTERNS-->>applyPatterns: "redacted message"
applyPatterns-->>LoggerInstance: "redacted message"
LoggerInstance->>LoggerInstance: "create LogRecord"
LoggerInstance->>Sink: "write(record, formatted)"
Sink->>Formatter: "format(record)"
Formatter-->>Sink: "formatted string"
Sink->>Sink: "output to destination"
a213cf7 to
7f9c8de
Compare
c187efe to
3df0449
Compare
3df0449 to
8166f4f
Compare
Contributor
Author
|
Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR. |
Adds child() method to LoggerInstance that: - Merges parent context with child bindings (child takes precedence) - Returns new logger instance with combined context - Preserves level, redaction, sinks from parent - Supports nested children (composable) Fixes P1 review feedback from PR #69 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
8166f4f to
bf9ec8e
Compare
d23a2c1 to
9d8690a
Compare
Contributor
Author
|
Resubmitted after restack. This PR includes Logger.child in logging, which resolves the contracts compatibility note from PR #69. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Exports DEFAULT_PATTERNS constant with regex patterns for common
secrets: Bearer tokens, API keys, GitHub PATs (ghp/gho/ghs/ghr),
and private keys. Used with createRedactor for safe logging.
Closes #49
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com