Fix 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 <xiaolunwen@gmail.com>
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 <108022276+shashank-netapp@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
…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 <xiaolunwen@gmail.com>
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 <108022276+shashank-netapp@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
… (#10550) Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10550 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com> (cherry picked from commit 2db3715)
… (#10550) Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10550 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com> (cherry picked from commit 2db3715)
… (#10550) Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10550 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com> (cherry picked from commit 2db3715)
… (#10550) Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10550 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
…tea/gitea!35584) (#10553) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/10550 Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10553 Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
…tea/gitea!35584) (#10554) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/10550 Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10554 Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
…tea/gitea!35584) (#10555) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/10550 Link to original PR: go-gitea/gitea#35584 Original Author: https://github.com/shashank-netapp Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10555 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Summary
The Gitea codebase was logging
ElasticsearchandMeilisearchconnection 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