-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Fixing issue #35530: Password Leak in Log Messages #35584
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
Fixing issue #35530: Password Leak in Log Messages #35584
Conversation
…contained in the connString
It's better to call |
That seems more secure, but again this would be adding a few bit of lines to all the log statements and for the majority of time we may not even need it. Is this extra cost acceptable ? |
Personally I think it's worth to make the logger system more secure, but I am fine with either (current approach, or calling SanitizeCredentialURLs for all log messages). It's up to the reviewers. @lunny @techknowlogick |
I think as a quick patch, this is enough. Adding a log level check requires balancing performance and security. Most log format arguments don’t need such checks, but verifying the log level can help prevent potential leaks of sensitive information. Alternatively, we could introduce a dedicated type, for example, |
I sent #35594 as an example how it might be. |
* giteaofficial/main: Fixing issue go-gitea#35530: Password Leak in Log Messages (go-gitea#35584) Move some functions to gitrepo package (go-gitea#35543) feat: adds option to force update new branch in contents routes (go-gitea#35592) Move archive function to repo_model and gitrepo (go-gitea#35514) Use `inputs` context when parsing workflows (go-gitea#35590)
…35584) The Gitea codebase was logging `Elasticsearch` and `Meilisearch` connection strings directly to log files without sanitizing them. Since connection strings often contain credentials in the format `protocol://username:password@host:port`, this resulted in passwords being exposed in plain text in log output. Fix: - wrapped all instances of setting.Indexer.RepoConnStr and setting.Indexer.IssueConnStr with the `util.SanitizeCredentialURLs()` function before logging them. Fixes: go-gitea#35530 Co-authored-by: Lunny Xiao <[email protected]>
Backport #35584 by @shashank-netapp # Summary The Gitea codebase was logging `Elasticsearch` and `Meilisearch` connection strings directly to log files without sanitizing them. Since connection strings often contain credentials in the format `protocol://username:password@host:port`, this resulted in passwords being exposed in plain text in log output. Fix: - wrapped all instances of setting.Indexer.RepoConnStr and setting.Indexer.IssueConnStr with the `util.SanitizeCredentialURLs()` function before logging them. Fixes: #35530 Co-authored-by: shashank-netapp <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
Summary
The Gitea codebase was logging
Elasticsearch
andMeilisearch
connection strings directly to log files without sanitizing them. Since connection strings often contain credentials in the formatprotocol://username:password@host:port
, this resulted in passwords being exposed in plain text in log output.Fix:
util.SanitizeCredentialURLs()
function before logging them.Fixes: #35530