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

fix(KONFLUX-4956): redact sensitive header info from logging #141

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

rh-rahulshetty
Copy link
Contributor

This PR adds a preprocessing to mask sensitive information from headers (like Authorization,Set-Cookie, X-API-Key, Cookie) before logging it into debug output. The header values are replaced with keyword <REDACTED>.

Log Output after masking:

Exception: Request failed
2024-10-10 11:29:31,482 root MainThread ERROR URL = https://thanos-querier-openshift-monitoring.apps.stone-stg-rh01.l2vh.p1.openshiftapps.com:443/api/v1/query_range?query=sum%28+rate%28container_network_transmit_packets_dropped_total%7Bnamespace%3D%27tekton-results%27%2C+pod%3D~%27tekton-results-watcher-.%2A%27%7D%5B80s%5D%29+%2B+rate%28container_network_receive_packets_dropped_total%7Bnamespace%3D%27tekton-results%27%2C+pod%3D~%27tekton-results-watcher-.%2A%27%7D%5B80s%5D%29+%29&step=80&start=1728378208.0&end=1728384371.0
2024-10-10 11:29:31,482 root MainThread ERROR Request headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': '<REDACTED>'}
2024-10-10 11:29:31,482 root MainThread ERROR Response headers = {'content-type': 'text/plain; charset=utf-8', 'x-content-type-options': 'nosniff', 'content-length': '13', 'date': 'Thu, 10 Oct 2024 11:29:31 GMT', 'strict-transport-security': 'max-age=31536000;preload', 'set-cookie': '<REDACTED>'}

Copy link
Contributor

@jhutar jhutar left a comment

Choose a reason for hiding this comment

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

Cool!

@jhutar jhutar merged commit 7d7c71b into redhat-performance:main Oct 15, 2024
1 check passed
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.

2 participants