-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add instance-level secrets #27725
base: main
Are you sure you want to change the base?
Add instance-level secrets #27725
Conversation
ba6d1ea
to
908834a
Compare
908834a
to
2403ceb
Compare
2403ceb
to
921bc07
Compare
88ef9f1
to
15d6d7c
Compare
Fixed a little mistake when you deleting user secrets via the API. Found it when working on #27725. It should be backported to 1.21 I think.
Fixed a little mistake when you deleting user secrets via the API. Found it when working on go-gitea#27725. It should be backported to 1.21 I think.
15d6d7c
to
f5c9464
Compare
f5c9464
to
869efc6
Compare
Is it ok to be merged ? |
@go-gitea/technical-oversight-committee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope we can add a warning when adding a global secret in the UI. Like
"
Although secrets will be masked if users try to print them in Actions workflows, this is not absolutely secure. Users can still obtain the contents of secrets by writing malicious workflows, so please ensure that global secrets are not used by people you do not trust. Otherwise, please use organization/user-level or repository-level secrets to limit their scope of use. Alternatively, if it's acceptable to expose their contents, please use global variables.
"
Or it will be terrible if someone adds a global secret to a public instance and thinks it will be safe just because it's labeled as "secret".
@jbgomond will you add the change, or should someone else take over? |
No pb, I'll do it tomorrow |
b56057a
to
158bb9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two problems:
- For public instances this a Anti-Feature. Even for closed instances, org secrets should be enough
- No one knows about possible existing global secrets. But we have this problem already with org/user secrets.
{{if .ctxData.Secrets}} | ||
{{range .ctxData.Secrets}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, {{range }}
supports {{else}}
.
Wait, we already have instance level variables. |
Fixed a little mistake when you deleting user secrets via the API. Found it when working on go-gitea#27725. It should be backported to 1.21 I think.
This pull request has a last call and has not had any activity in the past two weeks. Consider it to be a polite refusal. 🍵 |
Reopening. While we have instance wide variables, having instance wide secrets would be useful for a specific use case, if the instance is targeted to specific user group then this could work. As it is possible to extract secrets through various ways if you have access the be able to run a workflow, so it wouldnt work to protect a secret on a public instance or on one with untrusted users. Previously when I used drone I did something like this to store docker hub secrets as I had repos in different orgs, but they all needed to push to the same place. And having this allowed me not to have to duplicate a secret. This only worked as I was the only one on the instance. The above is to say I am welcoming of this PR, and would love to see it get in, I’m thinking it just needs some guide rails on it to ensure when people use it they are aware of the caveats. |
per #27725 (review), I think maybe we can close this one. |
I disagree on that one. For public instances sure, it's useless. But Gitea is used by small firms or groups to have a private Git solution, and projects are separated in different "organisations", as are "workspaces" in Bitbucket, to separate the clients / projects. In that type of situation (it's my case), we have single Docker instance, and we need to store passwords across all ""organisations"" because it's the same account. Using variables is not the solution, because they are shown plain text in the action logs. Without instance level secrets, the only solution is to duplicate secrets in all organisations, and in case of changes, to update all of them. It's not feasable, I have more than 100 organisations (projects) created. I understand that the secret system is flawed at its core, but in that case, it is the same with organisation secrets. Maybe there's room to improve that then ? Also, if we are scared about public instances, maybe a startup option would be the solution ? So that administrators are voluntarily enabling the feature ? |
@jbgomond I think we pretty much have the same use case for this. |
Maybe we can have a configuration item so users can chose enable/disable it? |
Fine for me, a good intermediate solution |
This PR adds instance-level secrets, and so closes #27373.
I did the implementation next to the current secrets code. I was wondering though if it was intentional that the code was outside the action files or legacy ? (it's out of the scope of this PR, but I was wondering)