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

Extend approval options #3348

Merged
merged 43 commits into from
Nov 18, 2024
Merged

Extend approval options #3348

merged 43 commits into from
Nov 18, 2024

Conversation

anbraten
Copy link
Member

@anbraten anbraten commented Feb 7, 2024

related to #336

To protect secrets and (agents) it should be possible to require approvals for potential harmful pipelines like PRs. To not require every pipeline to be approved the existing gated mode was replaced with 3 options addressing most common cases:

  • allow every pipeline except PRs from forks
  • require approval for all PRs (new default)
  • require approval for every pipeline (current require approval / gated mode)

Those modes could later on be extended. Additionally a webhook extension could be added to get the approval state from an external service.

Changes

  • replace IsGated with RequireApproval
  • migrate old settings to RequireApproval
  • adjust docs

@anbraten anbraten added enhancement improve existing features ux user experience labels Feb 7, 2024
@woodpecker-bot
Copy link
Contributor

woodpecker-bot commented Feb 7, 2024

Deployment of preview was torn down

@qwerty287
Copy link
Contributor

qwerty287 commented Feb 8, 2024

Actually it seems a quite small list of options could solve most common cases as well:

In my opinion, we should support more here.

For a lot of different ideas here see #2293.
My main point is: You can use the approve feature also as a feature if you don't want to run all pipelines to save resources. Having as many options as possible could help here.

Can't you create an interface which just checks whether the pipeline needs approval or not so we can easily extend the feature by adding a new implementation? Maybe also with support for an external http extension?

@xoxys
Copy link
Member

xoxys commented Mar 18, 2024

Can't you create an interface which just checks whether the pipeline needs approval or not so we can easily extend the feature by adding a new implementation? Maybe also with support for an external http extension?

If we need that level of flexibility, why not use something like open policy agent, as proposed in the issue? Approval rules can be written by users via the UI or CLI by repo admins without writing external services and without blowing up the server code for every single use case that we have not yet thought about.

@anbraten

This comment was marked as off-topic.

@xoxys

This comment was marked as off-topic.

@6543
Copy link
Member

6543 commented Sep 29, 2024

i still want to have the gated feature to be extendable

@xoxys
Copy link
Member

xoxys commented Sep 29, 2024

Yes, please... if we dont want to have more options in woodpecker core (I still dont understand why) please provide an http interface like drone ci does so users can implement validation.

@anbraten anbraten added this to the 2.7.2 milestone Oct 14, 2024
@anbraten anbraten changed the title Rework repo security levels Require approvals for fork PRs Oct 27, 2024
@xoxys
Copy link
Member

xoxys commented Nov 5, 2024

I'm confused about the milestone. Is this one targeted for v3 now or 2.8? And if the target for v3 is correct, why is there a backport-required label also present? See #2142 (reply in thread)

@6543 6543 modified the milestones: 3.0.0, 2.8.0 Nov 5, 2024
@6543
Copy link
Member

6543 commented Nov 5, 2024

@anbraten I think you can merge it any time now :)

@6543
Copy link
Member

6543 commented Nov 15, 2024

conflicts :/

@6543 6543 enabled auto-merge (squash) November 18, 2024 13:40
@6543 6543 merged commit 5e2fa81 into woodpecker-ci:main Nov 18, 2024
9 checks passed
@6543
Copy link
Member

6543 commented Nov 18, 2024

please backport :)

@woodpecker-bot woodpecker-bot mentioned this pull request Nov 18, 2024
1 task
@xoxys
Copy link
Member

xoxys commented Nov 18, 2024

please backport :)

This is IMO pretty bad practice. If we merge the PR from someone else, we can't expect that the other one will be able to create the backport soon.

@xoxys
Copy link
Member

xoxys commented Nov 18, 2024

@6543 See discussion in #3348 (comment)

Migrating a public, not gated repo to RequiredForkApproval is by definition a breaking change as it changes the behavior for users. Yes, you can argue that for security reasons we accept this tradeoff, but then this should get a pretty clear note in the release notes and proper documentation.

6543 pushed a commit that referenced this pull request Nov 18, 2024
@6543 6543 added highlight and removed backport-needed indicates that this pull should be packported labels Nov 18, 2024
@qwerty287 qwerty287 mentioned this pull request Nov 18, 2024
@6543 6543 modified the milestones: 2.8.0, 3.0.0 Nov 21, 2024
anbraten added a commit to anbraten/woodpecker that referenced this pull request Nov 21, 2024
@6543 6543 added backport-done indicates that this pull has been backported and removed highlight labels Nov 25, 2024
anbraten added a commit that referenced this pull request Nov 25, 2024
Co-authored-by: 6543 <6543@obermui.de>
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 25, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done indicates that this pull has been backported enhancement improve existing features security ux user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants