This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
security: redact unrecognized auth HTTP headers from logs (#46112)
* security: redact unrecognized auth HTTP headers from logs When the Authentication middleware stumbled across a HTTP Header set to `Authorization: [name value]` and `name` is not one of the recognized Sourcegraph ones (i.e "token" or "sudo-token"), the logs were printing that value in clear. While it's a rather limited concern as the logs are only accessible to ops and the use of custom authentication tokens are not a very frequent, it's still not okay to log them in clear. The present code instead logs a md5sum in place of the value, allowing to still link back to the value we're expecting if we're debugging. If the hashing fails for any reason, the value is simply set to "[REDACTED]". It is to be noted, that there are legitimate cases where can have unrecognized Authorization headers, and we should not log in those cases. As this would require to parse the current config, which requires more work, I decided for keeping this PR simple and focused on the security concern first. * Clarify log message
- Loading branch information