-
Notifications
You must be signed in to change notification settings - Fork 40
feat: add organization setting to restrict project-scoped contracts #2602
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
base: main
Are you sure you want to change the base?
Conversation
| var projectID *uuid.UUID | ||
| if req.ProjectReference.IsSet() { | ||
| // Check if organization prevents project-scoped contracts | ||
| if org.PreventProjectScopedContracts { |
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.
is this the only place a contract is created? can you check during attestation init?
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.
We need to double check that a contract can only be created on-demand from this use case. I remember it was also created during a workflow creation, or attestation init.
Would you mind posting there an evaluation of those entrypoints and how this feature will work with the other preventWorkflowCreation feature?
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 don't think this is what we want. What we want is to only allow administrators to create contracts if this setting is set
|
also, what's the use-case here? Can anybody create project contracts? can admins do it? |
migmartri
left a comment
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.
See my inline coments
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
|
Updated with what have discussed.
We could also restrict creation of the default contract that is created when no contract was specified in workflow creation, but is that desired behavior? |
I think so yes The idea of this feature is to prevent contract sprawl, and the main source of sprawl is the attestation process. |
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Alright, added validation to |
Thanks Does it work in |
This PR adds a new organization-level setting that allows administrators to restrict contract creation to be only available for organization admins, preventing their creation by org members and project admins.
When setting is enabled and non-admin user tries to run
att initwithout specifying contract an error is returned: