-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Allow some paths to be redacted and some to be removed #84
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1947556
feat: Redact or remove paths
ConradLang 1470729
refactor: Use map instead of includes
ConradLang 19b77a5
refactor: Handle non-standard property names
ConradLang 150481e
refactor: Rename addRemovePathsCensor
ConradLang aa16fcb
refactor: Use set instead of map
ConradLang 91a9f13
refactor: Orchestrate redact configuration
ConradLang 8bcb486
Feat: Enable configuring default remove paths
ConradLang a4cc18b
fix: Input censor is always preserved for redact
ConradLang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { keyFromPath } from '.'; | ||
|
||
it.each` | ||
paths | path | ||
${['data', 'top', 'prop1']} | ${'data.top.prop1'} | ||
${['data', 'top.prop1']} | ${'data["top.prop1"]'} | ||
${['headers', 'x-request-id']} | ${'headers["x-request-id"]'} | ||
${['_start', '$with', 'allowed', 'Char']} | ${'_start.$with.allowed.Char'} | ||
${['-start', '.with', '4notAllowed', '~Char']} | ${'["-start"][".with"]["4notAllowed"]["~Char"]'} | ||
${['con-tain', 'not!', 'allow∑∂', 'Chår']} | ${'["con-tain"]["not!"]["allow∑∂"]["Chår"]'} | ||
`(`should convert '$paths' to '$path'`, ({ paths, path }) => { | ||
const result = keyFromPath(paths); | ||
|
||
expect(result).toBe(path); | ||
}); |
Oops, something went wrong.
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.
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.
Are there sensible defaults that we should be thinking of bundling into this package, rather than expecting each team to manually review and add
removePaths
?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.
There are some
x-envoy-*
headers likely related to internal routing but I'm not sure if these should be blanket added for all services.Also, being OSS, should we add default headers for removal or is it ok since it's a SEEK opinionated logger?
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.
It's SEEK opinionated so I'd be fine with any configuration that is not sensitive, and I reckon headers for an OSS project like Envoy would be fine.
Do we have an example of a SEEK application that would be impaired by having
x-envoy-*
removed by default? We'd presumably allow them to override/disable the defaults if needed.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.
I've asked cloud platform about the
x-envoy-*
headers so we'll have to wait for an answer.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.
Ah apologies if I was vague here; I meant adding logic here to remove the headers from logs by default, not changing our infra to stop attaching the headers.
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.
@72636c : I've just pushed a change that allows us to add default paths for removal.
Caveat: Since the
defaultRemovePaths
is empty, it isn't really tested, but you can pull this branch, add a path e.g.req.headers["x-envoy-peer-metadata"]
and see theshould remove default paths when ignoreDefaultRemovePaths is missing
test result.You might need to
console.log({input, log})
in thetestLog
function to observe.You can also
ignoreDefaultRemovePaths
if you don't want the default remove paths to be added.I had to refactor the
addDefaultRedactPathStrings
(and rename toappendDefaultRedactAndRemove
) to get this working.Something I'm wondering is should we only override the
censor
when it isundefined
with the caveat that theremove
may not work proper?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.
I've updated this so that the input
censor
is used for redaction butremovePaths
properties are still removed.