-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enhance logging by adding content field redaction #1100
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -78,7 +78,10 @@ function ResultDisplay({ | |||||||||
| } | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <HoverCard content={<ResultDisplayContent result={result} />}> | ||||||||||
| <HoverCard | ||||||||||
| content={<ResultDisplayContent result={result} />} | ||||||||||
| className="w-80" | ||||||||||
| > | ||||||||||
| <Badge color={rule ? "green" : "red"} className="whitespace-nowrap"> | ||||||||||
| {rule | ||||||||||
| ? rule.name | ||||||||||
|
|
@@ -136,7 +139,9 @@ export function ResultDisplayContent({ result }: { result: RunRulesResult }) { | |||||||||
| type: action.type, | ||||||||||
| label: action.label, | ||||||||||
| folderName: action.folderName, | ||||||||||
| content: action.content, | ||||||||||
| content: | ||||||||||
| action.content + | ||||||||||
| "https://www.google.comasdjhgaghjdsghjasdgjasdjhasd", | ||||||||||
|
Comment on lines
+142
to
+144
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest removing the hardcoded URL concatenation to
Suggested change
|
||||||||||
| to: action.to, | ||||||||||
| subject: action.subject, | ||||||||||
| cc: action.cc, | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -219,9 +219,13 @@ const REDACTED_FIELD_NAMES = new Set([ | |||||
| "authorization", | ||||||
| ]); | ||||||
|
|
||||||
| // Fields containing email/message content - redacted in production unless debug logs enabled | ||||||
| const CONTENT_FIELD_NAMES = new Set(["text", "body"]); | ||||||
|
|
||||||
| /** | ||||||
| * Recursively processes an object to protect sensitive data: | ||||||
| * - REDACTED_FIELD_NAMES: Replaced with boolean (never logged) | ||||||
| * - CONTENT_FIELD_NAMES: Replaced with boolean in production (unless debug logs enabled) | ||||||
| * - SENSITIVE_FIELD_NAMES: Hashed in production (raw in dev/test) | ||||||
| * | ||||||
| * Only works server-side - client-side logs are visible in browser anyway. | ||||||
|
|
@@ -247,6 +251,10 @@ function hashSensitiveFields<T>(obj: T, depth = 0): T { | |||||
| if (REDACTED_FIELD_NAMES.has(key)) { | ||||||
| processed[key] = !!value; | ||||||
| } | ||||||
| // Redact content fields in production (unless debug logs enabled) | ||||||
| else if (CONTENT_FIELD_NAMES.has(key) && !env.ENABLE_DEBUG_LOGS) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Code doesn't match documented behavior: comment says content fields are "redacted in production" but the condition doesn't check for production environment. This will redact content in dev/test when Prompt for AI agents |
||||||
| processed[key] = !!value; | ||||||
| } | ||||||
| // Hash emails in production only (server-side only) | ||||||
| else if ( | ||||||
| SENSITIVE_FIELD_NAMES.has(key) && | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
P0: Debug/test code left in production: This line appends a hardcoded nonsensical URL string to
action.content, corrupting the displayed content. This appears to be accidental test data that should be removed.Prompt for AI agents