Skip to content
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

Feature/masking #74

Merged
merged 8 commits into from
May 18, 2019
Merged

Feature/masking #74

merged 8 commits into from
May 18, 2019

Conversation

trusche
Copy link
Owner

@trusche trusche commented May 13, 2019

No description provided.

@trusche
Copy link
Owner Author

trusche commented May 13, 2019

Hi @bustikiller, I re-implemented your feature requests slightly differently - would you mind taking a look and let me know a) what you think and b) if this works for your use case?

Thanks!

string_classes << URI::HTTP if defined?(URI::HTTP)
string_classes << HTTP::FormData::Urlencoded if defined?(HTTP::FormData::Urlencoded)
string_classes
end
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is important to avoid dependencies on http libraries that are not used...

case msg
when *string_classes
config.filter_parameters.reduce(msg) do |m,key|
m.to_s.gsub(/(#{key})=[^&]+/i, "#{key}=#{PARAM_MASK}")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit more robust, just \w+ would only replace up to the first possible whitespace, URL encoded or not. Not terribly pretty but is might suffice and is less complex than parsing the full query string into a hash.

@trusche trusche requested a review from bustikiller May 13, 2019 16:43
@trusche trusche merged commit 97762b2 into master May 18, 2019
@trusche trusche deleted the feature/masking branch January 11, 2020 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant