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

Customize the policy-bot PR title to enable wildcard matching on branches #134

Open
mglazer opened this issue Nov 1, 2019 · 8 comments
Open

Comments

@mglazer
Copy link

mglazer commented Nov 1, 2019

On a repository which I maintain, we have to keep a release branch system, so our release branches are named:

  • release/3.19.10.1
  • release/3.19.10.2
  • release/3.19.10.3
  • ...

In order to get status checks working in Github, I create a pattern branch protection pattern:

release/.*

Which allows me to add checks for everything, except for Policybot, which uniquely names every check as:

policy-bot: release/3.19.10.1
policy-bot: release/3.19.10.2
...

The Github UI unfortunately does not allow me to match on wildcard status checks, so I need the status check name to be constant, which for Policy bot it's not.

@jamestoyer
Copy link
Contributor

The name of the branch in the status check is intentionally to prevent cases where a policy could be updated on a less secure branch without being properly approved. See this comment in #57 for a better explaination

@mglazer
Copy link
Author

mglazer commented Nov 1, 2019

So is the only solution for me to manually go to every release branch in GHE (and remember to do this forever into the future when we cut release branches) and ensure that the status check requirement is checked?

@mglazer
Copy link
Author

mglazer commented Nov 1, 2019

I'm open to other solutions too, I just proposed the first one that came to mind since it was clearly the most obvious one.

@andrey-bolduzev
Copy link

I'm curious if there has been any development in this area. This seems like a pretty major issue for any repository that happens to cut release branches.

@dermyrddin
Copy link

@jamestoyer I understand security concerns, but maybe check name could be made configurable - to contain branch or not? We have about 30 repos with up to 10 hotfix-x.x branches. Right now there is a wildcard filter in the protection rule, it will be quite hard for us to create new rules with every release when we create a new hotfix branch in every repo. And our developers are pretty honest to not do magic with retargeting PRs.

@dermyrddin
Copy link

I'm not sure if @jamestoyer still actively contributing here.

@bluekeyes maybe you can share your thoughts? Is the idea to add an option to remove branch from check name sounds reasonable and if yes - is there a possibility that this could be added in near future?

@asvoboda
Copy link
Member

asvoboda commented Feb 9, 2022

Its configurable at the server level by using the post_insecure_status_checks option.

// PostInsecureStatusChecks enables the sending of a second status using just StatusCheckContext as the context,
// no templating. This is turned off by default. This is to support legacy workflows that depend on the original
// context behaviour, and will be removed in 2.0
PostInsecureStatusChecks bool `yaml:"post_insecure_status_checks"`

Given that this issue is a pretty easy hole to exploit, we're likely not looking to make this option easier to foot gun.

@dermyrddin
Copy link

Thanks @asvoboda, will give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants