You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While most API keys are indeed alphanumeric, some keys/secrets contain periods, dashes, or are entirely base64-encoded.
As a result, I wanted to suggest replacing the \w+ in this regex with [^&]+. (Barring any unforeseen reason on my part why that shouldn't be the case.)
My thinking is that knowing the intricacies of regexes isn't otherwise needed to use this gem, and someone using the gem could very easily copy this from the docs, replacing api_key with any other parameter name (say, password), and think they are fully/securely omitting sensitive data from their logs.
Ideally, perhaps the logger middleware could take a list of param/header names to redact values for, in addition to regexes, (or perhaps even use Rails' by default, if defined?(Rails) && Rails.application.config&.filter_parameters), but that might be considered beyond the scope of this documentation tweak.
The text was updated successfully, but these errors were encountered:
I very much welcome a PR for either improving the doc or adding functionality ("perhaps the logger middleware could take a list of param/header names to redact values for"), but in case of the latter we definitely don't want features to only work under Rails, so that would need a framework-agnostic implementation
The online documentation for the
:logger
middleware contains this block:While most API keys are indeed alphanumeric, some keys/secrets contain periods, dashes, or are entirely base64-encoded.
As a result, I wanted to suggest replacing the
\w+
in this regex with[^&]+
. (Barring any unforeseen reason on my part why that shouldn't be the case.)My thinking is that knowing the intricacies of regexes isn't otherwise needed to use this gem, and someone using the gem could very easily copy this from the docs, replacing
api_key
with any other parameter name (say,password
), and think they are fully/securely omitting sensitive data from their logs.Ideally, perhaps the logger middleware could take a list of param/header names to redact values for, in addition to regexes, (or perhaps even use Rails' by default,
if defined?(Rails) && Rails.application.config&.filter_parameters
), but that might be considered beyond the scope of this documentation tweak.The text was updated successfully, but these errors were encountered: