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

security: prevent secrets / private keys / passwords from being committed #5656

Open
2 of 7 tasks
ntimo opened this issue Jan 6, 2019 · 7 comments
Open
2 of 7 tasks
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@ntimo
Copy link

ntimo commented Jan 6, 2019

Description

It is currently possible to commit secrets like a ssh private key, this should not be possible and should be forbidden by default. I think I don't have to say why having a private SSH-Key in git is not a good idea.

Maybe an option for the administrator of the Gitea instance would be good to enable/disable the committing of secrets (with the default set to disable)

@clarfonthey
Copy link
Contributor

clarfonthey commented Jan 7, 2019

Perhaps this could be enabled by default and the way of opting out for a repo is to create some file in the repo that indicates that you're opting out? e.g. a file named THIS_REPO_CONTAINS_SECRETS

OpenSSL has very standardised formats for private keys so I think it should be pretty easy to detect. We obviously can't detect all kinds of secrets but I would say that this is good to include by default.

@ntimo
Copy link
Author

ntimo commented Jan 7, 2019

@clarcharr I think it would be better to have a settings button inside the Gitea repo settings to change this behavior. Having to commit a file to turn it off feels wrong to me. And indeed since the OpenSSL Keys have a pretty standardized format detection should be possible.

@techknowlogick techknowlogick added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Jan 7, 2019
@techknowlogick
Copy link
Member

In the interim, you could use githooks in Gitea, and https://github.com/awslabs/git-secrets to block secrets from being committed.

@0x5c
Copy link
Contributor

0x5c commented Jan 7, 2019

To complement @ntimo's comment, it seems to me like opt-out-by-file would make it possible for anyone with merge/commit abilities to sneak-in the file, which would be a major security issue, and would require adding checks for the addition of the file, which would require......
Repository settings are perfect that things like this opt-out.


I could be a good thing to be able to change the key-detection filter for a repo, in-case is creates false positives on clean files.

@silverwind
Copy link
Member

I'm strongly against gitea rejecting any content in the default configuration. There are valid use cases of commiting private keys like test fixtures or self-signed cert/key pairs.

git-secrets sounds like a good tool to use, if it can be applied in a server-side hook.

@0x5c
Copy link
Contributor

0x5c commented Jan 7, 2019

@silverwind
Although, that's an edge-case, and a switch in the settings of a repo is a minor hassle, at worse. Especially if the default is a security measure.

@TankTheFrank
Copy link

Unexpected behaviour from "opinionated" tools is the highlight of my day.

The default should be the expected behaviour and when deciding what expected implies keep in mind that gitea is a self-hosted tool not a public SaaS service.

@wxiaoguang wxiaoguang changed the title security: prevent private keys from being committed security: prevent secrets / private keys from being committed Apr 13, 2022
@wxiaoguang wxiaoguang changed the title security: prevent secrets / private keys from being committed security: prevent secrets / private keys / passwords from being committed Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

6 participants