-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
logging: add a filter for query parameters #4424
Conversation
91f2c7f
to
5fff505
Compare
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.
LGTM! Just a couple comments
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.
Chapeau bas for the idea and initiative. I just saw you mention the PR on twitter, am not really involved with caddy – feel free to ignore my comment.
Maybe that's taking the second step before the first, but my first reaction when seeing the "REDACTED" value was thinking: this is going to be confusing sooner or later. Maybe the better way would be to anonymize/pseudonymize the data (i.e. not having the same log value for all incoming values, as seen in graylog, elastic). Does that resonate with you? Would you see this as an extra feature or an alternative, indeed?
@wiese What would be the use case? Other similar software seems to redact and not to anonymize: Also, it's how the current filters (replace and delete) work. |
The use case, like for the current implementation, would be making sure the original values are not contained in the logs but (for pseudonymization) with the added benefit that
Of course, this functionality could totally exist in addition to redacting as is and added later if there is a demand. No worries, I just wanted to run the thought in case you say "oh, that's actually closer to what I want". |
We could do a thing where if the replacement value is the string Obviously it should be noted that this isn't a good idea for passwords for example, i.e. anything where brute-forcing the value would be problematic. In which case, simply redacting is better. |
Or maybe could we just add an extra action called |
Maybe could we add this feature in a follow-up PR? (I will do it, but it will be easier to add hash support everywhere when the pending PRs will be merged). |
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.
Hey Kevin, thanks for the contribution! I like where this is going.
Just wondering... could both replace
and delete
actions be reduced to a single replace
action? Since deleting could be replacing with an empty string, and you wouldn't need different action types and stuff. It'd be simpler. You could then just list the replacements you want to perform on the query string.
Edit: I submitted this as "request changes" but I guess I should have just posted this as a regular comment. Sorry.
Hi Matt, This is possible but it could get messy if we add more actions such as Currently:
With your suggestion:
I find the first one more readable but I'm ok to update the PR to use the second option if you prefer. Also, in we implement your solution, maybe should we also deprecate the existing WDYT? |
Thanks for the extra information. That's very interesting! As discussed in Slack, I think the current approach is fine, since it allows other actions to be configured like hashing. It's also easier to read. Thanks! |
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.
Just one thing I noticed. Looking good though.
1ad91db
to
bd8c3a3
Compare
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.
Thanks!
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.
Thank you! LGTM except a little nit on naming / exporting one identifier.
Co-authored-by: Matt Holt <[email protected]>
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.
Thanks!
Even if it's considered a bad security practice, it's common that query parameters contain sensitive information. Some examples:
This PR adds the possibility to redact such sensitive information from the logs.