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

Shadow the password on cache and session config on admin panel #7300

Merged
merged 4 commits into from
Jun 26, 2019

Conversation

lunny
Copy link
Member

@lunny lunny commented Jun 26, 2019

will fix #7147

@lunny lunny added the topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! label Jun 26, 2019
@lunny lunny added this to the 1.9.0 milestone Jun 26, 2019
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jun 26, 2019
@codecov-io
Copy link

codecov-io commented Jun 26, 2019

Codecov Report

Merging #7300 into master will increase coverage by 0.03%.
The diff coverage is 78.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7300      +/-   ##
==========================================
+ Coverage    41.2%   41.23%   +0.03%     
==========================================
  Files         464      464              
  Lines       62788    62832      +44     
==========================================
+ Hits        25873    25911      +38     
- Misses      33524    33529       +5     
- Partials     3391     3392       +1
Impacted Files Coverage Δ
routers/admin/admin.go 16.66% <78.26%> (+16.66%) ⬆️
modules/log/event.go 65.64% <0%> (+1.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42729b7...f0f43ca. Read the comment docs.

@@ -202,6 +202,17 @@ func SendTestMail(ctx *context.Context) {
ctx.Redirect(setting.AppSubURL + "/admin/config")
}

func shadowPassword(cfgItem string) string {
fields := strings.Split(cfgItem, ",")
Copy link
Member

Choose a reason for hiding this comment

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

I think there need to be more than one check, since the config strings can be different for MySQL and redis. This seems to fix for redis, but not MySQL. In the example from #7147, the session provider connection string is:

someclient:somepassword@tcp(srv-mysql:3306)/someclient

This format uses DSN, so the password is optional: https://github.com/go-sql-driver/mysql

Maybe it you can also pass in the adapter/provider to shadowPassword and then know if it is Redis/MySQL and check based on that.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. Will fix that.

@lunny
Copy link
Member Author

lunny commented Jun 26, 2019

@mrsdizzie done with test.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 26, 2019
@lunny lunny merged commit 161e12e into go-gitea:master Jun 26, 2019
@lunny lunny deleted the lunny/fix_config_security branch June 26, 2019 16:12
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this pull request Jul 18, 2019
…tea#7300)

* shadow the password on cache and session config on admin panel

* add shadow password of mysql/postgres/couchbase

* fix log import
zeripath added a commit to zeripath/gitea that referenced this pull request Nov 23, 2019
Although go-gitea#7300 properly shadows the password from the virtual session
provider, the template displaying the provider config still presumed
that the config was JSON.

This PR updates the template and properly hides the Virtual Session
provider.

Fixes go-gitea#7127
techknowlogick pushed a commit that referenced this pull request Nov 28, 2019
* Properly fix #7127

Although #7300 properly shadows the password from the virtual session
provider, the template displaying the provider config still presumed
that the config was JSON.

This PR updates the template and properly hides the Virtual Session
provider.

Fixes #7127

* update per @silverwind's suggestion
6543 pushed a commit to 6543-forks/gitea that referenced this pull request Nov 29, 2019
…itea#9137)

* Properly fix go-gitea#7127

Although go-gitea#7300 properly shadows the password from the virtual session
provider, the template displaying the provider config still presumed
that the config was JSON.

This PR updates the template and properly hides the Virtual Session
provider.

Fixes go-gitea#7127

* update per @silverwind's suggestion
techknowlogick pushed a commit that referenced this pull request Nov 29, 2019
… (#9203)

* Properly fix #7147

Although #7300 properly shadows the password from the virtual session
provider, the template displaying the provider config still presumed
that the config was JSON.

This PR updates the template and properly hides the Virtual Session
provider.

Fixes #7147

* update per @silverwind's suggestion
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/security Something leaks user information or is otherwise vulnerable. Should be fixed!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SessionProvider MySQL credentials are shown in the admin GUI as plaintext
5 participants