You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Sandra Parsick <sa...@parsick.dev> on 2025/07/30 11:02:01 UTC

[DISCUSS] Branch Protection Rules

Hi,

I have taken a more in-depth look at the branch protection checks of the 
OpenSSF scorecard best-practices, and I'd like to discuss two topics:
	1. Do we want to enable GH rules to pass some of them?
	2. How do we want to enable the GH rules?

In their documentation [0] , following checks are documented, when the 
score card checks are running without admin permissions:

> This check determines whether a project's default and release branches are protected with GitHub's branch protection or repository rules settings. [....] Each tier must be fully satisfied to achieve points at the next tier. 
> 
> Tier 1 Requirements (3/10 points):
> - Prevent force push
> - Prevent branch deletion
> 
> Tier 2 Requirements (6/10 points):
> - Require at least 1 reviewer for approval before merging
>   
> Tier 3 Requirements (8/10 points):
> - Require branch to pass at least 1 status check before merging
> 
> Tier 4 Requirements (9/10 points):
> - Require at least 2 reviewers for approval before merging
> - Require review from code owners
> 
> Tier 5 Requirements (10/10 points):
>  *Only affected when scorecard check runs with admin priviledged*


Of course, the main critism can be "why to invest time in implementing 
branch protection rules? Only for earning points to get a nice 'trophy'?"

 From the user perspective, having an OpenSSF badge with a good score on 
the README can help the user to decide if it is valuable to take a 
deeper look at the project. In our case, it would also show that the 
Maven project cares about supply chain security.

 From the maintainer perspective, we should look at every check and 
decide check by check if they really help us in our daily work and how 
high the effort is to implement passing the check.

Here is a first review of the best practices proposed by OpenSSF Scorecard:

  - Prevent force push
This check can be satisfied with the GH branch rule 'Block force 
pushes'. This rule prevents that someone or an automatismn can overwrite 
the repository history accidentally (or consciously)

- Prevent branch deletion
This check can be satisfied with the GH branch rule 'Restrict 
deletions'. This rule prevents that someone or an automatismn can delete 
the master branch accidentally (or consciously)

- Require at least 1/2 reviewer for approval before merging.
This check can be satisfied with the GH branch rule 'Require a pull 
request before merging' in combination with the setting 'Required 
approvals = 1/2'. This rule in combination with that setting enforces 
that at least one or two reviewer on every pull request. It can help to 
reduce human failure like "This is only a small change, I don't need a 
code review"

- Require branch to pass at least 1 status check before merging
This check can be satisfied with the GH branch rule 'Require status 
checks to pass'. This rule enforces that merging a pull request is only 
allowed when at least one status check is passed. It can help to reduce 
human failure like "This is only a small change. It will not break 
anything. Therefore, I don't want to wait until the check is done."

- Require review from code owners
This check can be satisfied with the introduction of a CODEOWNERS file 
in every repository.

According to an initial check [1], currently no branch protection checks 
are passed. But we have at least a rule that prevents force push on the 
master branch.

 From my perspective, passing the following checks can help us to avoid 
typical human failures that are done mostly accidentally:
    - Prevent force push
    - Prevent branch deletion
    - Require at least 1 reviewer for approval before merging.
    - Require branch to pass at least 1 status check before merging

For passing the check 'Prevent force push' and 'Prevent branch 
deletion', we need a refactoring of the current implementation using GH 
repository rules [2], [3]. This refactoring would help to make it 
visible from outside.

Passing the check 'Require review from code owners', a CODEOWNERS file 
is needed in every repository. Maintaining such a file in every 
repository that related to Maven could be painful. It belongs to Tier 4 
and to pass Tier 4 all previous tiers have to be satisfied. Therefore, 
IMHO, we should concentrate on the other ones.

Passing the check 'Require at least 1 reviewer for approval before 
merging', the GH rule 'Require a pull request before merging' is needed 
and that will be have an impact on the release process (m-release-plugin 
is pushing changes directly to master branch). We can avoid this impact 
if we maintain a bypass list so this rule can be worked around in 
specific cases, or we can use this situation and rethink the release 
process.

IMHO, we can decide rule by rule if one is helpful for us or not. I 
don't think we need to decide like 'implement all rules or nothing.' It 
also helps only to implement a few of them.

If we conclude that it is a good idea to implement such kind of rules. 
The next question is how to enable the GH rules.

Thanks to Piotr, who mentions [4] the possibility of GH repository rules 
[5], that can be implemented by calling a REST API. He also drew my 
attention to the fact that ASF infrastructure already has support for 
branch protection in .asf.yaml [6], [7] (but it seems we are not using 
it in the Maven project). One idea could be to refactor this script 
using repository rules (of course, we should also discuss it with ASF 
infra). In case of we have reason not using ASF infra script, we can 
implement such script by ourselves for the Maven source repositories 
(similar to the shared GH action). Or maybe some one has another idea.

Best regards,

Sandra


[0] 
https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection 
(opened on 2025-07-29)
[1] 
https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven-dependency-plugin 
    (OpenSSF score card for m-dependency-plugin)
[2] 
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
[3] 
https://github.blog/news-insights/product-news/github-repository-rules-are-now-generally-available/
[4] https://github.com/support-and-care/maven-support-and-care/issues/107
[5] https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28
[6]  https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml
[7] 
https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/feature/github/branch_protection.py


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Sandra Parsick <sa...@parsick.dev>.
Thanks Maarten,

Good catch with the sync between Gitbox and GitHub. It seems, IMHO, we 
need a mechanism that ensures that both sides have the same protection 
rules. I will put it on my list of open questions.

Thanks,

Sandra



Am 30.07.25 um 21:45 schrieb Maarten Mulders:
> Hi Sandra,
> 
> Thanks for bringing this up! It sounds very interesting, I haven't heard 
> much about this before but I could see there are benefits in enabling 
> some of these protections.
> 
> I'm curious, since we have bidirectional sync between GitHub and the 
> Apache Gitbox. How effective would these measures be? Could one (a 
> malevolent actor) perform a force-push against a branch on the Gitbox 
> which would then nevertheless end up on GitHub as well? Or delete a 
> branch? Or... (you get the idea).
> 
> 
> Thanks,
> 
> Maarten
> 
> On 30/07/2025 13:02, Sandra Parsick wrote:
>> Hi,
>>
>> I have taken a more in-depth look at the branch protection checks of 
>> the OpenSSF scorecard best-practices, and I'd like to discuss two topics:
>>      1. Do we want to enable GH rules to pass some of them?
>>      2. How do we want to enable the GH rules?
>>
>> In their documentation [0] , following checks are documented, when the 
>> score card checks are running without admin permissions:
>>
>>> This check determines whether a project's default and release 
>>> branches are protected with GitHub's branch protection or repository 
>>> rules settings. [....] Each tier must be fully satisfied to achieve 
>>> points at the next tier.
>>> Tier 1 Requirements (3/10 points):
>>> - Prevent force push
>>> - Prevent branch deletion
>>>
>>> Tier 2 Requirements (6/10 points):
>>> - Require at least 1 reviewer for approval before merging
>>> Tier 3 Requirements (8/10 points):
>>> - Require branch to pass at least 1 status check before merging
>>>
>>> Tier 4 Requirements (9/10 points):
>>> - Require at least 2 reviewers for approval before merging
>>> - Require review from code owners
>>>
>>> Tier 5 Requirements (10/10 points):
>>>  *Only affected when scorecard check runs with admin priviledged*
>>
>>
>> Of course, the main critism can be "why to invest time in implementing 
>> branch protection rules? Only for earning points to get a nice 'trophy'?"
>>
>>  From the user perspective, having an OpenSSF badge with a good score 
>> on the README can help the user to decide if it is valuable to take a 
>> deeper look at the project. In our case, it would also show that the 
>> Maven project cares about supply chain security.
>>
>>  From the maintainer perspective, we should look at every check and 
>> decide check by check if they really help us in our daily work and how 
>> high the effort is to implement passing the check.
>>
>> Here is a first review of the best practices proposed by OpenSSF 
>> Scorecard:
>>
>>   - Prevent force push
>> This check can be satisfied with the GH branch rule 'Block force 
>> pushes'. This rule prevents that someone or an automatismn can 
>> overwrite the repository history accidentally (or consciously)
>>
>> - Prevent branch deletion
>> This check can be satisfied with the GH branch rule 'Restrict 
>> deletions'. This rule prevents that someone or an automatismn can 
>> delete the master branch accidentally (or consciously)
>>
>> - Require at least 1/2 reviewer for approval before merging.
>> This check can be satisfied with the GH branch rule 'Require a pull 
>> request before merging' in combination with the setting 'Required 
>> approvals = 1/2'. This rule in combination with that setting enforces 
>> that at least one or two reviewer on every pull request. It can help 
>> to reduce human failure like "This is only a small change, I don't 
>> need a code review"
>>
>> - Require branch to pass at least 1 status check before merging
>> This check can be satisfied with the GH branch rule 'Require status 
>> checks to pass'. This rule enforces that merging a pull request is 
>> only allowed when at least one status check is passed. It can help to 
>> reduce human failure like "This is only a small change. It will not 
>> break anything. Therefore, I don't want to wait until the check is done."
>>
>> - Require review from code owners
>> This check can be satisfied with the introduction of a CODEOWNERS file 
>> in every repository.
>>
>> According to an initial check [1], currently no branch protection 
>> checks are passed. But we have at least a rule that prevents force 
>> push on the master branch.
>>
>>  From my perspective, passing the following checks can help us to 
>> avoid typical human failures that are done mostly accidentally:
>>     - Prevent force push
>>     - Prevent branch deletion
>>     - Require at least 1 reviewer for approval before merging.
>>     - Require branch to pass at least 1 status check before merging
>>
>> For passing the check 'Prevent force push' and 'Prevent branch 
>> deletion', we need a refactoring of the current implementation using 
>> GH repository rules [2], [3]. This refactoring would help to make it 
>> visible from outside.
>>
>> Passing the check 'Require review from code owners', a CODEOWNERS file 
>> is needed in every repository. Maintaining such a file in every 
>> repository that related to Maven could be painful. It belongs to Tier 
>> 4 and to pass Tier 4 all previous tiers have to be satisfied. 
>> Therefore, IMHO, we should concentrate on the other ones.
>>
>> Passing the check 'Require at least 1 reviewer for approval before 
>> merging', the GH rule 'Require a pull request before merging' is 
>> needed and that will be have an impact on the release process (m- 
>> release-plugin is pushing changes directly to master branch). We can 
>> avoid this impact if we maintain a bypass list so this rule can be 
>> worked around in specific cases, or we can use this situation and 
>> rethink the release process.
>>
>> IMHO, we can decide rule by rule if one is helpful for us or not. I 
>> don't think we need to decide like 'implement all rules or nothing.' 
>> It also helps only to implement a few of them.
>>
>> If we conclude that it is a good idea to implement such kind of rules. 
>> The next question is how to enable the GH rules.
>>
>> Thanks to Piotr, who mentions [4] the possibility of GH repository 
>> rules [5], that can be implemented by calling a REST API. He also drew 
>> my attention to the fact that ASF infrastructure already has support 
>> for branch protection in .asf.yaml [6], [7] (but it seems we are not 
>> using it in the Maven project). One idea could be to refactor this 
>> script using repository rules (of course, we should also discuss it 
>> with ASF infra). In case of we have reason not using ASF infra script, 
>> we can implement such script by ourselves for the Maven source 
>> repositories (similar to the shared GH action). Or maybe some one has 
>> another idea.
>>
>> Best regards,
>>
>> Sandra
>>
>>
>> [0] https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch- 
>> protection (opened on 2025-07-29)
>> [1] https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven- 
>> dependency-plugin    (OpenSSF score card for m-dependency-plugin)
>> [2] https://docs.github.com/en/repositories/configuring-branches-and- 
>> merges-in-your-repository/managing-rulesets/about-rulesets
>> [3] https://github.blog/news-insights/product-news/github-repository- 
>> rules-are-now-generally-available/
>> [4] https://github.com/support-and-care/maven-support-and-care/issues/107
>> [5] https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28
>> [6]  https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml
>> [7] https://github.com/apache/infrastructure-asfyaml/blob/main/ 
>> asfyaml/ feature/github/branch_protection.py
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Sandra Parsick <sa...@parsick.dev>.
Thanks for your input. Let me try to summarize the current state of 
discussion:

- It seems we have consensus that implementing Tier 1 (Prevent force 
push + Prevent branch deletion) is a good idea
- The rules should be synced between Gitbox and GitHub
- We need more time to evaluate which consequence implementing "Require 
at least 1 reviewer for approval before merging" and more will have.

I will open a vote for introducing "Prevent force push + Prevent branch 
deletion" via .asf.yaml


Am 03.08.25 um 18:15 schrieb Maarten Mulders:
> Hi Piotr,
> 
> Thanks for pointing me to that announcement. I must've missed it. But 
> indeed it seems like one thing less to worry about - which is great!
> 
> 
> Maarten
> 
> On August 01, 2025 at 08:09, Piotr P. Karwasz wrote:
>> Hi Maarten,
>>
>> On 30.07.2025 21:45, Maarten Mulders wrote:
>>> I'm curious, since we have bidirectional sync between GitHub and the
>>> Apache Gitbox. How effective would these measures be? Could one (a
>>> malevolent actor) perform a force-push against a branch on the Gitbox
>>> which would then nevertheless end up on GitHub as well? Or delete a
>>> branch? Or... (you get the idea).
>>
>> You raise a very good point!
>>
>> Until recently, you were absolutely right: pushing to GitBox was indeed
>> a way to bypass GitHub’s branch protection rules. I’ve personally done
>> it myself: I once accidentally bricked the `logging-log4j2` repository
>> by specifying the wrong “required check” name in the `.asf.yaml` file,
>> and had to use GitBox to fix it.
>>
>> However, as of May (see Daniel's announcement [1]), this loophole has
>> been closed. The INFRA team has since updated the system so that branch
>> protection rules now propagate from GitHub to GitBox, preventing direct
>> pushes (including force-pushes) on protected branches via GitBox.
>>
>> Piotr
>>
>> References:
>> [1] https://lists.apache.org/thread/fgbr2y0r8yn9dj8myd8csk85ybf3mm48
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Maarten Mulders <mt...@apache.org>.
Hi Piotr,

Thanks for pointing me to that announcement. I must've missed it. But 
indeed it seems like one thing less to worry about - which is great!


Maarten

On August 01, 2025 at 08:09, Piotr P. Karwasz wrote:
> Hi Maarten,
> 
> On 30.07.2025 21:45, Maarten Mulders wrote:
>> I'm curious, since we have bidirectional sync between GitHub and the
>> Apache Gitbox. How effective would these measures be? Could one (a
>> malevolent actor) perform a force-push against a branch on the Gitbox
>> which would then nevertheless end up on GitHub as well? Or delete a
>> branch? Or... (you get the idea).
> 
> You raise a very good point!
> 
> Until recently, you were absolutely right: pushing to GitBox was indeed
> a way to bypass GitHub’s branch protection rules. I’ve personally done
> it myself: I once accidentally bricked the `logging-log4j2` repository
> by specifying the wrong “required check” name in the `.asf.yaml` file,
> and had to use GitBox to fix it.
> 
> However, as of May (see Daniel's announcement [1]), this loophole has
> been closed. The INFRA team has since updated the system so that branch
> protection rules now propagate from GitHub to GitBox, preventing direct
> pushes (including force-pushes) on protected branches via GitBox.
> 
> Piotr
> 
> References:
> [1] https://lists.apache.org/thread/fgbr2y0r8yn9dj8myd8csk85ybf3mm48
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by "Piotr P. Karwasz" <pi...@mailing.copernik.eu>.
Hi Maarten,

On 30.07.2025 21:45, Maarten Mulders wrote:
> I'm curious, since we have bidirectional sync between GitHub and the
> Apache Gitbox. How effective would these measures be? Could one (a
> malevolent actor) perform a force-push against a branch on the Gitbox
> which would then nevertheless end up on GitHub as well? Or delete a
> branch? Or... (you get the idea).

You raise a very good point!

Until recently, you were absolutely right: pushing to GitBox was indeed
a way to bypass GitHub’s branch protection rules. I’ve personally done
it myself: I once accidentally bricked the `logging-log4j2` repository
by specifying the wrong “required check” name in the `.asf.yaml` file,
and had to use GitBox to fix it.

However, as of May (see Daniel's announcement [1]), this loophole has
been closed. The INFRA team has since updated the system so that branch
protection rules now propagate from GitHub to GitBox, preventing direct
pushes (including force-pushes) on protected branches via GitBox.

Piotr

References:
[1] https://lists.apache.org/thread/fgbr2y0r8yn9dj8myd8csk85ybf3mm48

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Maarten Mulders <mt...@apache.org>.
Hi Sandra,

Thanks for bringing this up! It sounds very interesting, I haven't heard 
much about this before but I could see there are benefits in enabling 
some of these protections.

I'm curious, since we have bidirectional sync between GitHub and the 
Apache Gitbox. How effective would these measures be? Could one (a 
malevolent actor) perform a force-push against a branch on the Gitbox 
which would then nevertheless end up on GitHub as well? Or delete a 
branch? Or... (you get the idea).


Thanks,

Maarten

On 30/07/2025 13:02, Sandra Parsick wrote:
> Hi,
> 
> I have taken a more in-depth look at the branch protection checks of the 
> OpenSSF scorecard best-practices, and I'd like to discuss two topics:
>      1. Do we want to enable GH rules to pass some of them?
>      2. How do we want to enable the GH rules?
> 
> In their documentation [0] , following checks are documented, when the 
> score card checks are running without admin permissions:
> 
>> This check determines whether a project's default and release branches 
>> are protected with GitHub's branch protection or repository rules 
>> settings. [....] Each tier must be fully satisfied to achieve points 
>> at the next tier.
>> Tier 1 Requirements (3/10 points):
>> - Prevent force push
>> - Prevent branch deletion
>>
>> Tier 2 Requirements (6/10 points):
>> - Require at least 1 reviewer for approval before merging
>> Tier 3 Requirements (8/10 points):
>> - Require branch to pass at least 1 status check before merging
>>
>> Tier 4 Requirements (9/10 points):
>> - Require at least 2 reviewers for approval before merging
>> - Require review from code owners
>>
>> Tier 5 Requirements (10/10 points):
>>  *Only affected when scorecard check runs with admin priviledged*
> 
> 
> Of course, the main critism can be "why to invest time in implementing 
> branch protection rules? Only for earning points to get a nice 'trophy'?"
> 
>  From the user perspective, having an OpenSSF badge with a good score on 
> the README can help the user to decide if it is valuable to take a 
> deeper look at the project. In our case, it would also show that the 
> Maven project cares about supply chain security.
> 
>  From the maintainer perspective, we should look at every check and 
> decide check by check if they really help us in our daily work and how 
> high the effort is to implement passing the check.
> 
> Here is a first review of the best practices proposed by OpenSSF Scorecard:
> 
>   - Prevent force push
> This check can be satisfied with the GH branch rule 'Block force 
> pushes'. This rule prevents that someone or an automatismn can overwrite 
> the repository history accidentally (or consciously)
> 
> - Prevent branch deletion
> This check can be satisfied with the GH branch rule 'Restrict 
> deletions'. This rule prevents that someone or an automatismn can delete 
> the master branch accidentally (or consciously)
> 
> - Require at least 1/2 reviewer for approval before merging.
> This check can be satisfied with the GH branch rule 'Require a pull 
> request before merging' in combination with the setting 'Required 
> approvals = 1/2'. This rule in combination with that setting enforces 
> that at least one or two reviewer on every pull request. It can help to 
> reduce human failure like "This is only a small change, I don't need a 
> code review"
> 
> - Require branch to pass at least 1 status check before merging
> This check can be satisfied with the GH branch rule 'Require status 
> checks to pass'. This rule enforces that merging a pull request is only 
> allowed when at least one status check is passed. It can help to reduce 
> human failure like "This is only a small change. It will not break 
> anything. Therefore, I don't want to wait until the check is done."
> 
> - Require review from code owners
> This check can be satisfied with the introduction of a CODEOWNERS file 
> in every repository.
> 
> According to an initial check [1], currently no branch protection checks 
> are passed. But we have at least a rule that prevents force push on the 
> master branch.
> 
>  From my perspective, passing the following checks can help us to avoid 
> typical human failures that are done mostly accidentally:
>     - Prevent force push
>     - Prevent branch deletion
>     - Require at least 1 reviewer for approval before merging.
>     - Require branch to pass at least 1 status check before merging
> 
> For passing the check 'Prevent force push' and 'Prevent branch 
> deletion', we need a refactoring of the current implementation using GH 
> repository rules [2], [3]. This refactoring would help to make it 
> visible from outside.
> 
> Passing the check 'Require review from code owners', a CODEOWNERS file 
> is needed in every repository. Maintaining such a file in every 
> repository that related to Maven could be painful. It belongs to Tier 4 
> and to pass Tier 4 all previous tiers have to be satisfied. Therefore, 
> IMHO, we should concentrate on the other ones.
> 
> Passing the check 'Require at least 1 reviewer for approval before 
> merging', the GH rule 'Require a pull request before merging' is needed 
> and that will be have an impact on the release process (m-release-plugin 
> is pushing changes directly to master branch). We can avoid this impact 
> if we maintain a bypass list so this rule can be worked around in 
> specific cases, or we can use this situation and rethink the release 
> process.
> 
> IMHO, we can decide rule by rule if one is helpful for us or not. I 
> don't think we need to decide like 'implement all rules or nothing.' It 
> also helps only to implement a few of them.
> 
> If we conclude that it is a good idea to implement such kind of rules. 
> The next question is how to enable the GH rules.
> 
> Thanks to Piotr, who mentions [4] the possibility of GH repository rules 
> [5], that can be implemented by calling a REST API. He also drew my 
> attention to the fact that ASF infrastructure already has support for 
> branch protection in .asf.yaml [6], [7] (but it seems we are not using 
> it in the Maven project). One idea could be to refactor this script 
> using repository rules (of course, we should also discuss it with ASF 
> infra). In case of we have reason not using ASF infra script, we can 
> implement such script by ourselves for the Maven source repositories 
> (similar to the shared GH action). Or maybe some one has another idea.
> 
> Best regards,
> 
> Sandra
> 
> 
> [0] https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch- 
> protection (opened on 2025-07-29)
> [1] https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven- 
> dependency-plugin    (OpenSSF score card for m-dependency-plugin)
> [2] https://docs.github.com/en/repositories/configuring-branches-and- 
> merges-in-your-repository/managing-rulesets/about-rulesets
> [3] https://github.blog/news-insights/product-news/github-repository- 
> rules-are-now-generally-available/
> [4] https://github.com/support-and-care/maven-support-and-care/issues/107
> [5] https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28
> [6]  https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml
> [7] https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/ 
> feature/github/branch_protection.py
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Michael Bien <mb...@gmail.com>.
On 7/31/25 17:59, Elliotte Rusty Harold wrote:
> On Thu, Jul 31, 2025 at 8:50 AM Konrad Windszus <kw...@apache.org> wrote:
>> Hi,
>> Please note that only those branch protection rules which are enforced by both GitHub and GitBox matter. As long as I can easily bypass the branch protection rules by working with GitBox there is little point in enabling those.
> Not necessarily. On more than one occasion I've accidentally pushed to
> master out of simple confusion about which branch I was on locally,
happened to me too more than once.

Since then I changed how I push and it never happened again so far.

If everything is set explicitly and nothing is taken from the context
not much can go wrong:

git push git@github.com:user/repo local_branch:remote_branch

(local and remote branch would be the same in most cases)

(branch protection is still a good thing though!)

best regards,
michael


> and then had to roll back. This would prevent such faux pas. Don't let
> the perfect be the enemy of the good.
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Elliotte Rusty Harold <el...@ibiblio.org>.
On Thu, Jul 31, 2025 at 8:50 AM Konrad Windszus <kw...@apache.org> wrote:
>
> Hi,
> Please note that only those branch protection rules which are enforced by both GitHub and GitBox matter. As long as I can easily bypass the branch protection rules by working with GitBox there is little point in enabling those.

Not necessarily. On more than one occasion I've accidentally pushed to
master out of simple confusion about which branch I was on locally,
and then had to roll back. This would prevent such faux pas. Don't let
the perfect be the enemy of the good.


-- 
Elliotte Rusty Harold
elharo@ibiblio.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Konrad Windszus <kw...@apache.org>.
Hi,
Please note that only those branch protection rules which are enforced by both GitHub and GitBox matter. As long as I can easily bypass the branch protection rules by working with GitBox there is little point in enabling those.
AFAIK only the prevent force push is now is now enforced: https://github.com/apache/infrastructure-asfyaml/issues/72

Konrad

> On 30. Jul 2025, at 13:02, Sandra Parsick <sa...@parsick.dev> wrote:
> 
> Hi,
> 
> I have taken a more in-depth look at the branch protection checks of the OpenSSF scorecard best-practices, and I'd like to discuss two topics:
> 	1. Do we want to enable GH rules to pass some of them?
> 	2. How do we want to enable the GH rules?
> 
> In their documentation [0] , following checks are documented, when the score card checks are running without admin permissions:
> 
>> This check determines whether a project's default and release branches are protected with GitHub's branch protection or repository rules settings. [....] Each tier must be fully satisfied to achieve points at the next tier. Tier 1 Requirements (3/10 points):
>> - Prevent force push
>> - Prevent branch deletion
>> Tier 2 Requirements (6/10 points):
>> - Require at least 1 reviewer for approval before merging
>>  Tier 3 Requirements (8/10 points):
>> - Require branch to pass at least 1 status check before merging
>> Tier 4 Requirements (9/10 points):
>> - Require at least 2 reviewers for approval before merging
>> - Require review from code owners
>> Tier 5 Requirements (10/10 points):
>> *Only affected when scorecard check runs with admin priviledged*
> 
> 
> Of course, the main critism can be "why to invest time in implementing branch protection rules? Only for earning points to get a nice 'trophy'?"
> 
> From the user perspective, having an OpenSSF badge with a good score on the README can help the user to decide if it is valuable to take a deeper look at the project. In our case, it would also show that the Maven project cares about supply chain security.
> 
> From the maintainer perspective, we should look at every check and decide check by check if they really help us in our daily work and how high the effort is to implement passing the check.
> 
> Here is a first review of the best practices proposed by OpenSSF Scorecard:
> 
> - Prevent force push
> This check can be satisfied with the GH branch rule 'Block force pushes'. This rule prevents that someone or an automatismn can overwrite the repository history accidentally (or consciously)
> 
> - Prevent branch deletion
> This check can be satisfied with the GH branch rule 'Restrict deletions'. This rule prevents that someone or an automatismn can delete the master branch accidentally (or consciously)
> 
> - Require at least 1/2 reviewer for approval before merging.
> This check can be satisfied with the GH branch rule 'Require a pull request before merging' in combination with the setting 'Required approvals = 1/2'. This rule in combination with that setting enforces that at least one or two reviewer on every pull request. It can help to reduce human failure like "This is only a small change, I don't need a code review"
> 
> - Require branch to pass at least 1 status check before merging
> This check can be satisfied with the GH branch rule 'Require status checks to pass'. This rule enforces that merging a pull request is only allowed when at least one status check is passed. It can help to reduce human failure like "This is only a small change. It will not break anything. Therefore, I don't want to wait until the check is done."
> 
> - Require review from code owners
> This check can be satisfied with the introduction of a CODEOWNERS file in every repository.
> 
> According to an initial check [1], currently no branch protection checks are passed. But we have at least a rule that prevents force push on the master branch.
> 
> From my perspective, passing the following checks can help us to avoid typical human failures that are done mostly accidentally:
>   - Prevent force push
>   - Prevent branch deletion
>   - Require at least 1 reviewer for approval before merging.
>   - Require branch to pass at least 1 status check before merging
> 
> For passing the check 'Prevent force push' and 'Prevent branch deletion', we need a refactoring of the current implementation using GH repository rules [2], [3]. This refactoring would help to make it visible from outside.
> 
> Passing the check 'Require review from code owners', a CODEOWNERS file is needed in every repository. Maintaining such a file in every repository that related to Maven could be painful. It belongs to Tier 4 and to pass Tier 4 all previous tiers have to be satisfied. Therefore, IMHO, we should concentrate on the other ones.
> 
> Passing the check 'Require at least 1 reviewer for approval before merging', the GH rule 'Require a pull request before merging' is needed and that will be have an impact on the release process (m-release-plugin is pushing changes directly to master branch). We can avoid this impact if we maintain a bypass list so this rule can be worked around in specific cases, or we can use this situation and rethink the release process.
> 
> IMHO, we can decide rule by rule if one is helpful for us or not. I don't think we need to decide like 'implement all rules or nothing.' It also helps only to implement a few of them.
> 
> If we conclude that it is a good idea to implement such kind of rules. The next question is how to enable the GH rules.
> 
> Thanks to Piotr, who mentions [4] the possibility of GH repository rules [5], that can be implemented by calling a REST API. He also drew my attention to the fact that ASF infrastructure already has support for branch protection in .asf.yaml [6], [7] (but it seems we are not using it in the Maven project). One idea could be to refactor this script using repository rules (of course, we should also discuss it with ASF infra). In case of we have reason not using ASF infra script, we can implement such script by ourselves for the Maven source repositories (similar to the shared GH action). Or maybe some one has another idea.
> 
> Best regards,
> 
> Sandra
> 
> 
> [0] https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection (opened on 2025-07-29)
> [1] https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven-dependency-plugin    (OpenSSF score card for m-dependency-plugin)
> [2] https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
> [3] https://github.blog/news-insights/product-news/github-repository-rules-are-now-generally-available/
> [4] https://github.com/support-and-care/maven-support-and-care/issues/107
> [5] https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28
> [6]  https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml
> [7] https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/feature/github/branch_protection.py
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Slawomir Jaranowski <s....@gmail.com>.
On Thu, 11 Sept 2025 at 16:09, Sandra Parsick <sa...@parsick.dev> wrote:
>
> Hi,
>
> I'd like to revive the topic with the focus on the following checks:
> - Require at least 1 reviewer for approval before merging.
> - Require the branch to pass at least 1 status check before merging.

I prepared a test in maven-site.
We have a branch master-test which has enabled required checks to pass.

With such configuration direct push to branch is forbidden, all
commits must pass by PR with build pass.
In the first step we don't require PR to be reviewed.

I hope that we can start with this project, as we don't do releases in
it and should not block anything.

Test PRs:
https://github.com/apache/maven-site/pull/1390
https://github.com/apache/maven-site/pull/1391

>
> As Herve mentioned, these checks can be tested in maven-studies. I'd
> like to discuss creating an experiment: We enable these checks in one or
> two repositories and collect experience on how they work in reality.
>
> There are, IMHO, two possibilities to implement:
> 1) We test every check separately.
> 2) We test both checks together.
>
> Introducing 'Require at least 1 reviewer for approval before merging'
> needs the GH rule 'Require a pull request before merging' and that will
> have an impact on the release process (m-release-plugin is pushing
> changes directly to the master branch). We can avoid this impact if we
> maintain a bypass list so this rule can be worked around in specific
> cases, or we can use this situation and rethink the release process.
>
> What do you think?
>
> Sandra
>
>
> Am 07.08.25 um 13:31 schrieb Sandra Parsick:
> > It's a good idea to use test branches in maven-studies to check the
> > rules. I'd like to go a step further. I think that we should pick a
> > repository and apply a certain rule to it.
> >
> > We can see if this rule works for us in real life.
> > If not, the change can be reversed. If it is successful, we can roll out
> > the rule to other repositories.
> >
> > Sandra
> >
> > Am 02.08.25 um 23:15 schrieb Hervé Boutemy:
> >> thanks a lot Piotr for this return on experience: this help me a lot
> >> anticipating reality vs theory!
> >>
> >> this makes me feel we should try on maven-studies.git = the perfect
> >> location to do stupid tests
> >>
> >> I'll have a look at how things are configured in Log4j2 and try to
> >> play with test branches in maven-studies
> >>
> >> please others don't hesitate to test for yourself what we can
> >> implement vs what we dream then reading OpensSSF Scorecard and other
> >> best practices
> >>
> >> Regards,
> >>
> >> Hervé
> >>
> >> On 2025/08/01 07:18:36 "Piotr P. Karwasz" wrote:
> >>> Hi Hervé,
> >>>
> >>> On 30.07.2025 19:02, Hervé Boutemy wrote:
> >>>> for "Require at least 1 reviewer for approval before merging", IIUC it
> >>>> combines 2 steps:
> >>>> - reject direct commits to maintenance branches: require use of PR +
> >>>> merge
> >>>> - and PR requires more than self review
> >>>>
> >>>> I'm not absolutely against, just dislike:
> >>>> 1. the overhead
> >>>> 2. the bad habits this will promote
> >>>> 3. it will break maven-release-plugin process that commits directly to
> >>>> maintenance branch
> >>>>
> >>>>
> >>>> explanation:
> >>>> 1. overhead of for PR + merge: on simple typos, i'll have in
> >>>> addition to
> >>>> select a PR label to NOT list the PR in the release notes
> >>>> 2. bad habits:
> >>>> requiring review even on simple typos, I will find a buddy to
> >>>> quickly pair
> >>>> review everything small I do (in the same timezone as me, and we'll
> >>>> help each
> >>>> other at reviewing quickly)
> >>>> The bad habit comes here: my buddy will quickly review everything,
> >>>> small or
> >>>> big...
> >>>> 3. if someone wants to add new features and clarify new steps in the
> >>>> release
> >>>> process
> >>>
> >>> We had a very similar discussion in the Apache Logging project when we
> >>> introduced RTC last year [1], which we formally adopted in April [2].
> >>>
> >>> Even if I was the one to push the issue, I was really scared initially
> >>> that I “killed Log4j” after realizing that many of the +1 voters weren’t
> >>> available to review PRs. Even the PR that enforced RTC was strongly
> >>> delayed.
> >>>
> >>> However, since then I’ve since grown more confident and satisfied with
> >>> how it works in practice:
> >>>
> >>> - My “PR buddy” may not be able to approve PRs immediately, but we have
> >>> regular video syncs to go through open issues and reviews.
> >>>
> >>> - The `2.x` branch is much cleaner, no longer cluttered with
> >>> micro-commits that more often than not weren’t ported to `main`.
> >>>
> >>> - Copilot in the IDE is great at introducing typos. Ironically, Copilot
> >>> as a reviewer catches the typos that were introduced.
> >>>
> >>> - The workflow encourages broader community involvement. I can more
> >>> easily ask a contributor to fix a one-liner, so I can retain the ability
> >>> to review their fixes.
> >>>
> >>> - We can enable auto-merge now. That way, once approved, we don’t have
> >>> to wait for tests to finish to merge a PR manually.
> >>>
> >>> About the overhead for typo fixes:
> >>>
> >>> - I’ve seen plenty of “just a typo” commits break things. Because
> >>> they’re small, people don’t always scrutinize them, but a second pair of
> >>> eyes could have caught those errors.
> >>>
> >>> - The overhead encourages batching. Instead of opening a PR for a single
> >>> typo, you can accumulate fixes in a branch and open one PR when it makes
> >>> sense.
> >>>
> >>> - And of course, reviewing a one-liner typo is about a 10-second task.
> >>> The effort is proportional to the change.
> >>>
> >>> Regarding release process disruptions:
> >>>
> >>> You're absolutely right: this is one of the areas where RTC still feels
> >>> clunky. In Log4j, we create unprotected `release/x.y.z` branches. To
> >>> prevent long round trips, changes there are not submitted via PR. But I
> >>> strictly limit those to documentation or changelog updates.
> >>>
> >>> After the release, that branch is merged back into `main`, helping us
> >>> catch and correct any issues that slipped in.
> >>>
> >>> Best regards,
> >>> Piotr
> >>>
> >>> References:
> >>> [1] https://lists.apache.org/thread/6gbos0rn3k4y3wjb1hcgnnols4ogqckl
> >>> [2] https://lists.apache.org/thread/8ffdw1zqrvwrsdr0ng0m2rgtdnpzg4hk
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: dev-help@maven.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>


-- 
Sławomir Jaranowski

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Sandra Parsick <sa...@parsick.dev>.
Hi,

I'd like to revive the topic with the focus on the following checks:
- Require at least 1 reviewer for approval before merging.
- Require the branch to pass at least 1 status check before merging.

As Herve mentioned, these checks can be tested in maven-studies. I'd 
like to discuss creating an experiment: We enable these checks in one or 
two repositories and collect experience on how they work in reality.

There are, IMHO, two possibilities to implement:
1) We test every check separately.
2) We test both checks together.

Introducing 'Require at least 1 reviewer for approval before merging' 
needs the GH rule 'Require a pull request before merging' and that will 
have an impact on the release process (m-release-plugin is pushing 
changes directly to the master branch). We can avoid this impact if we 
maintain a bypass list so this rule can be worked around in specific 
cases, or we can use this situation and rethink the release process.

What do you think?

Sandra


Am 07.08.25 um 13:31 schrieb Sandra Parsick:
> It's a good idea to use test branches in maven-studies to check the 
> rules. I'd like to go a step further. I think that we should pick a 
> repository and apply a certain rule to it.
> 
> We can see if this rule works for us in real life.
> If not, the change can be reversed. If it is successful, we can roll out 
> the rule to other repositories.
> 
> Sandra
> 
> Am 02.08.25 um 23:15 schrieb Hervé Boutemy:
>> thanks a lot Piotr for this return on experience: this help me a lot 
>> anticipating reality vs theory!
>>
>> this makes me feel we should try on maven-studies.git = the perfect 
>> location to do stupid tests
>>
>> I'll have a look at how things are configured in Log4j2 and try to 
>> play with test branches in maven-studies
>>
>> please others don't hesitate to test for yourself what we can 
>> implement vs what we dream then reading OpensSSF Scorecard and other 
>> best practices
>>
>> Regards,
>>
>> Hervé
>>
>> On 2025/08/01 07:18:36 "Piotr P. Karwasz" wrote:
>>> Hi Hervé,
>>>
>>> On 30.07.2025 19:02, Hervé Boutemy wrote:
>>>> for "Require at least 1 reviewer for approval before merging", IIUC it
>>>> combines 2 steps:
>>>> - reject direct commits to maintenance branches: require use of PR + 
>>>> merge
>>>> - and PR requires more than self review
>>>>
>>>> I'm not absolutely against, just dislike:
>>>> 1. the overhead
>>>> 2. the bad habits this will promote
>>>> 3. it will break maven-release-plugin process that commits directly to
>>>> maintenance branch
>>>>
>>>>
>>>> explanation:
>>>> 1. overhead of for PR + merge: on simple typos, i'll have in 
>>>> addition to
>>>> select a PR label to NOT list the PR in the release notes
>>>> 2. bad habits:
>>>> requiring review even on simple typos, I will find a buddy to  
>>>> quickly pair
>>>> review everything small I do (in the same timezone as me, and we'll 
>>>> help each
>>>> other at reviewing quickly)
>>>> The bad habit comes here: my buddy will quickly review everything, 
>>>> small or
>>>> big...
>>>> 3. if someone wants to add new features and clarify new steps in the 
>>>> release
>>>> process
>>>
>>> We had a very similar discussion in the Apache Logging project when we
>>> introduced RTC last year [1], which we formally adopted in April [2].
>>>
>>> Even if I was the one to push the issue, I was really scared initially
>>> that I “killed Log4j” after realizing that many of the +1 voters weren’t
>>> available to review PRs. Even the PR that enforced RTC was strongly 
>>> delayed.
>>>
>>> However, since then I’ve since grown more confident and satisfied with
>>> how it works in practice:
>>>
>>> - My “PR buddy” may not be able to approve PRs immediately, but we have
>>> regular video syncs to go through open issues and reviews.
>>>
>>> - The `2.x` branch is much cleaner, no longer cluttered with
>>> micro-commits that more often than not weren’t ported to `main`.
>>>
>>> - Copilot in the IDE is great at introducing typos. Ironically, Copilot
>>> as a reviewer catches the typos that were introduced.
>>>
>>> - The workflow encourages broader community involvement. I can more
>>> easily ask a contributor to fix a one-liner, so I can retain the ability
>>> to review their fixes.
>>>
>>> - We can enable auto-merge now. That way, once approved, we don’t have
>>> to wait for tests to finish to merge a PR manually.
>>>
>>> About the overhead for typo fixes:
>>>
>>> - I’ve seen plenty of “just a typo” commits break things. Because
>>> they’re small, people don’t always scrutinize them, but a second pair of
>>> eyes could have caught those errors.
>>>
>>> - The overhead encourages batching. Instead of opening a PR for a single
>>> typo, you can accumulate fixes in a branch and open one PR when it makes
>>> sense.
>>>
>>> - And of course, reviewing a one-liner typo is about a 10-second task.
>>> The effort is proportional to the change.
>>>
>>> Regarding release process disruptions:
>>>
>>> You're absolutely right: this is one of the areas where RTC still feels
>>> clunky. In Log4j, we create unprotected `release/x.y.z` branches. To
>>> prevent long round trips, changes there are not submitted via PR. But I
>>> strictly limit those to documentation or changelog updates.
>>>
>>> After the release, that branch is merged back into `main`, helping us
>>> catch and correct any issues that slipped in.
>>>
>>> Best regards,
>>> Piotr
>>>
>>> References:
>>> [1] https://lists.apache.org/thread/6gbos0rn3k4y3wjb1hcgnnols4ogqckl
>>> [2] https://lists.apache.org/thread/8ffdw1zqrvwrsdr0ng0m2rgtdnpzg4hk
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Sandra Parsick <sa...@parsick.dev>.
It's a good idea to use test branches in maven-studies to check the 
rules. I'd like to go a step further. I think that we should pick a 
repository and apply a certain rule to it.

We can see if this rule works for us in real life.
If not, the change can be reversed. If it is successful, we can roll out 
the rule to other repositories.

Sandra

Am 02.08.25 um 23:15 schrieb Hervé Boutemy:
> thanks a lot Piotr for this return on experience: this help me a lot anticipating reality vs theory!
> 
> this makes me feel we should try on maven-studies.git = the perfect location to do stupid tests
> 
> I'll have a look at how things are configured in Log4j2 and try to play with test branches in maven-studies
> 
> please others don't hesitate to test for yourself what we can implement vs what we dream then reading OpensSSF Scorecard and other best practices
> 
> Regards,
> 
> Hervé
> 
> On 2025/08/01 07:18:36 "Piotr P. Karwasz" wrote:
>> Hi Hervé,
>>
>> On 30.07.2025 19:02, Hervé Boutemy wrote:
>>> for "Require at least 1 reviewer for approval before merging", IIUC it
>>> combines 2 steps:
>>> - reject direct commits to maintenance branches: require use of PR + merge
>>> - and PR requires more than self review
>>>
>>> I'm not absolutely against, just dislike:
>>> 1. the overhead
>>> 2. the bad habits this will promote
>>> 3. it will break maven-release-plugin process that commits directly to
>>> maintenance branch
>>>
>>>
>>> explanation:
>>> 1. overhead of for PR + merge: on simple typos, i'll have in addition to
>>> select a PR label to NOT list the PR in the release notes
>>> 2. bad habits:
>>> requiring review even on simple typos, I will find a buddy to  quickly pair
>>> review everything small I do (in the same timezone as me, and we'll help each
>>> other at reviewing quickly)
>>> The bad habit comes here: my buddy will quickly review everything, small or
>>> big...
>>> 3. if someone wants to add new features and clarify new steps in the release
>>> process
>>
>> We had a very similar discussion in the Apache Logging project when we
>> introduced RTC last year [1], which we formally adopted in April [2].
>>
>> Even if I was the one to push the issue, I was really scared initially
>> that I “killed Log4j” after realizing that many of the +1 voters weren’t
>> available to review PRs. Even the PR that enforced RTC was strongly delayed.
>>
>> However, since then I’ve since grown more confident and satisfied with
>> how it works in practice:
>>
>> - My “PR buddy” may not be able to approve PRs immediately, but we have
>> regular video syncs to go through open issues and reviews.
>>
>> - The `2.x` branch is much cleaner, no longer cluttered with
>> micro-commits that more often than not weren’t ported to `main`.
>>
>> - Copilot in the IDE is great at introducing typos. Ironically, Copilot
>> as a reviewer catches the typos that were introduced.
>>
>> - The workflow encourages broader community involvement. I can more
>> easily ask a contributor to fix a one-liner, so I can retain the ability
>> to review their fixes.
>>
>> - We can enable auto-merge now. That way, once approved, we don’t have
>> to wait for tests to finish to merge a PR manually.
>>
>> About the overhead for typo fixes:
>>
>> - I’ve seen plenty of “just a typo” commits break things. Because
>> they’re small, people don’t always scrutinize them, but a second pair of
>> eyes could have caught those errors.
>>
>> - The overhead encourages batching. Instead of opening a PR for a single
>> typo, you can accumulate fixes in a branch and open one PR when it makes
>> sense.
>>
>> - And of course, reviewing a one-liner typo is about a 10-second task.
>> The effort is proportional to the change.
>>
>> Regarding release process disruptions:
>>
>> You're absolutely right: this is one of the areas where RTC still feels
>> clunky. In Log4j, we create unprotected `release/x.y.z` branches. To
>> prevent long round trips, changes there are not submitted via PR. But I
>> strictly limit those to documentation or changelog updates.
>>
>> After the release, that branch is merged back into `main`, helping us
>> catch and correct any issues that slipped in.
>>
>> Best regards,
>> Piotr
>>
>> References:
>> [1] https://lists.apache.org/thread/6gbos0rn3k4y3wjb1hcgnnols4ogqckl
>> [2] https://lists.apache.org/thread/8ffdw1zqrvwrsdr0ng0m2rgtdnpzg4hk
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Hervé Boutemy <hb...@apache.org>.
thanks a lot Piotr for this return on experience: this help me a lot anticipating reality vs theory!

this makes me feel we should try on maven-studies.git = the perfect location to do stupid tests

I'll have a look at how things are configured in Log4j2 and try to play with test branches in maven-studies

please others don't hesitate to test for yourself what we can implement vs what we dream then reading OpensSSF Scorecard and other best practices

Regards,

Hervé

On 2025/08/01 07:18:36 "Piotr P. Karwasz" wrote:
> Hi Hervé,
> 
> On 30.07.2025 19:02, Hervé Boutemy wrote:
> > for "Require at least 1 reviewer for approval before merging", IIUC it 
> > combines 2 steps:
> > - reject direct commits to maintenance branches: require use of PR + merge
> > - and PR requires more than self review
> > 
> > I'm not absolutely against, just dislike:
> > 1. the overhead
> > 2. the bad habits this will promote
> > 3. it will break maven-release-plugin process that commits directly to 
> > maintenance branch
> > 
> > 
> > explanation:
> > 1. overhead of for PR + merge: on simple typos, i'll have in addition to 
> > select a PR label to NOT list the PR in the release notes
> > 2. bad habits:
> > requiring review even on simple typos, I will find a buddy to  quickly pair 
> > review everything small I do (in the same timezone as me, and we'll help each 
> > other at reviewing quickly)
> > The bad habit comes here: my buddy will quickly review everything, small or 
> > big...
> > 3. if someone wants to add new features and clarify new steps in the release 
> > process
> 
> We had a very similar discussion in the Apache Logging project when we
> introduced RTC last year [1], which we formally adopted in April [2].
> 
> Even if I was the one to push the issue, I was really scared initially
> that I “killed Log4j” after realizing that many of the +1 voters weren’t
> available to review PRs. Even the PR that enforced RTC was strongly delayed.
> 
> However, since then I’ve since grown more confident and satisfied with
> how it works in practice:
> 
> - My “PR buddy” may not be able to approve PRs immediately, but we have
> regular video syncs to go through open issues and reviews.
> 
> - The `2.x` branch is much cleaner, no longer cluttered with
> micro-commits that more often than not weren’t ported to `main`.
> 
> - Copilot in the IDE is great at introducing typos. Ironically, Copilot
> as a reviewer catches the typos that were introduced.
> 
> - The workflow encourages broader community involvement. I can more
> easily ask a contributor to fix a one-liner, so I can retain the ability
> to review their fixes.
> 
> - We can enable auto-merge now. That way, once approved, we don’t have
> to wait for tests to finish to merge a PR manually.
> 
> About the overhead for typo fixes:
> 
> - I’ve seen plenty of “just a typo” commits break things. Because
> they’re small, people don’t always scrutinize them, but a second pair of
> eyes could have caught those errors.
> 
> - The overhead encourages batching. Instead of opening a PR for a single
> typo, you can accumulate fixes in a branch and open one PR when it makes
> sense.
> 
> - And of course, reviewing a one-liner typo is about a 10-second task.
> The effort is proportional to the change.
> 
> Regarding release process disruptions:
> 
> You're absolutely right: this is one of the areas where RTC still feels
> clunky. In Log4j, we create unprotected `release/x.y.z` branches. To
> prevent long round trips, changes there are not submitted via PR. But I
> strictly limit those to documentation or changelog updates.
> 
> After the release, that branch is merged back into `main`, helping us
> catch and correct any issues that slipped in.
> 
> Best regards,
> Piotr
> 
> References:
> [1] https://lists.apache.org/thread/6gbos0rn3k4y3wjb1hcgnnols4ogqckl
> [2] https://lists.apache.org/thread/8ffdw1zqrvwrsdr0ng0m2rgtdnpzg4hk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by "Piotr P. Karwasz" <pi...@mailing.copernik.eu>.
Hi Hervé,

On 30.07.2025 19:02, Hervé Boutemy wrote:
> for "Require at least 1 reviewer for approval before merging", IIUC it 
> combines 2 steps:
> - reject direct commits to maintenance branches: require use of PR + merge
> - and PR requires more than self review
> 
> I'm not absolutely against, just dislike:
> 1. the overhead
> 2. the bad habits this will promote
> 3. it will break maven-release-plugin process that commits directly to 
> maintenance branch
> 
> 
> explanation:
> 1. overhead of for PR + merge: on simple typos, i'll have in addition to 
> select a PR label to NOT list the PR in the release notes
> 2. bad habits:
> requiring review even on simple typos, I will find a buddy to  quickly pair 
> review everything small I do (in the same timezone as me, and we'll help each 
> other at reviewing quickly)
> The bad habit comes here: my buddy will quickly review everything, small or 
> big...
> 3. if someone wants to add new features and clarify new steps in the release 
> process

We had a very similar discussion in the Apache Logging project when we
introduced RTC last year [1], which we formally adopted in April [2].

Even if I was the one to push the issue, I was really scared initially
that I “killed Log4j” after realizing that many of the +1 voters weren’t
available to review PRs. Even the PR that enforced RTC was strongly delayed.

However, since then I’ve since grown more confident and satisfied with
how it works in practice:

- My “PR buddy” may not be able to approve PRs immediately, but we have
regular video syncs to go through open issues and reviews.

- The `2.x` branch is much cleaner, no longer cluttered with
micro-commits that more often than not weren’t ported to `main`.

- Copilot in the IDE is great at introducing typos. Ironically, Copilot
as a reviewer catches the typos that were introduced.

- The workflow encourages broader community involvement. I can more
easily ask a contributor to fix a one-liner, so I can retain the ability
to review their fixes.

- We can enable auto-merge now. That way, once approved, we don’t have
to wait for tests to finish to merge a PR manually.

About the overhead for typo fixes:

- I’ve seen plenty of “just a typo” commits break things. Because
they’re small, people don’t always scrutinize them, but a second pair of
eyes could have caught those errors.

- The overhead encourages batching. Instead of opening a PR for a single
typo, you can accumulate fixes in a branch and open one PR when it makes
sense.

- And of course, reviewing a one-liner typo is about a 10-second task.
The effort is proportional to the change.

Regarding release process disruptions:

You're absolutely right: this is one of the areas where RTC still feels
clunky. In Log4j, we create unprotected `release/x.y.z` branches. To
prevent long round trips, changes there are not submitted via PR. But I
strictly limit those to documentation or changelog updates.

After the release, that branch is merged back into `main`, helping us
catch and correct any issues that slipped in.

Best regards,
Piotr

References:
[1] https://lists.apache.org/thread/6gbos0rn3k4y3wjb1hcgnnols4ogqckl
[2] https://lists.apache.org/thread/8ffdw1zqrvwrsdr0ng0m2rgtdnpzg4hk

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Sandra Parsick <sa...@parsick.dev>.
> And that should be done not only for default branch, but also every 
> maintenance branch when we maintain mutliple branches in parallel (Maven 4.1 
> vs 4.0 vs 3.8 vs 3.8, components or plugins 3 vs 4, Doxia 1.x vs 1.20.x vs 
> 2.x)

Good catch. Yes, I agree that every maintenance branch should be covered 
by branch protection rules.

> 1. overhead of for PR + merge: on simple typos, i'll have in addition to 
> select a PR label to NOT list the PR in the release notes
> 2. bad habits:
> requiring review even on simple typos, I will find a buddy to  quickly pair 
> review everything small I do (in the same timezone as me, and we'll help each 
> other at reviewing quickly)
> The bad habit comes here: my buddy will quickly review everything, small or 


Yes, introducing of security precaution in the process is always a 
trade-off between usability and the risk reduction. So the following 
questions come to my mind:
- How often do we see such kinds of changes?
- Can we have an exception for such kind of changes? (Maybe we feed 
another bad habit with that?)
- Not having such a rule, do we promote other bad habits?
- Which bad habit is okay for us?

At the end, IMHO, we should answer the question:

Does an introduction of such a rule help us to reduce risk in the supply 
chain and the benefit of it is higher then the effort in the process? If 
not, we can skip it.

> 3. if someone wants to add new features and clarify new steps in the release 
> process

Yes, when something changes in the process, we have to relearn the step 
where the change had effects. Therefore, we have to check if a change 
brings a benefit for us. Maybe we do not have a benefit for now, but 
maybe in the future.


> in summary:
> yes for step 1, it's a very good step
> 
> for next steps, please all prepare in depth: maybe I'm just lacking optimism

Yes, step 1 will be a good starting point.

Am 30.07.25 um 19:02 schrieb Hervé Boutemy:
> I'm all in for the first level of OpenSSF scorecard =  "Prevent force push +
> Prevent branch deletion"
> And that should be done not only for default branch, but also every
> maintenance branch when we maintain mutliple branches in parallel (Maven 4.1
> vs 4.0 vs 3.8 vs 3.8, components or plugins 3 vs 4, Doxia 1.x vs 1.20.x vs
> 2.x)
> 
> sadly, I don't know how to implement with .asf.yaml
> 
> 
> for "Require at least 1 reviewer for approval before merging", IIUC it
> combines 2 steps:
> - reject direct commits to maintenance branches: require use of PR + merge
> - and PR requires more than self review
> 
> I'm not absolutely against, just dislike:
> 1. the overhead
> 2. the bad habits this will promote
> 3. it will break maven-release-plugin process that commits directly to
> maintenance branch
> 
> 
> explanation:
> 1. overhead of for PR + merge: on simple typos, i'll have in addition to
> select a PR label to NOT list the PR in the release notes
> 2. bad habits:
> requiring review even on simple typos, I will find a buddy to  quickly pair
> review everything small I do (in the same timezone as me, and we'll help each
> other at reviewing quickly)
> The bad habit comes here: my buddy will quickly review everything, small or
> big...
> 3. if someone wants to add new features and clarify new steps in the release
> process
> 
> 
> in summary:
> yes for step 1, it's a very good step
> 
> for next steps, please all prepare in depth: maybe I'm just lacking optimism
> 
> Regards,
> 
> Hervé
> 
> Le mercredi 30 juillet 2025, 13:02:01 CEST Sandra Parsick a écrit :
>> Hi,
>>
>> I have taken a more in-depth look at the branch protection checks of the
>> OpenSSF scorecard best-practices, and I'd like to discuss two topics:
>> 	1. Do we want to enable GH rules to pass some of them?
>> 	2. How do we want to enable the GH rules?
>>
>> In their documentation [0] , following checks are documented, when the
>>
>> score card checks are running without admin permissions:
>>> This check determines whether a project's default and release branches are
>>> protected with GitHub's branch protection or repository rules settings.
>>> [....] Each tier must be fully satisfied to achieve points at the next
>>> tier.
>>>
>>> Tier 1 Requirements (3/10 points):
>>> - Prevent force push
>>> - Prevent branch deletion
>>>
>>> Tier 2 Requirements (6/10 points):
>>> - Require at least 1 reviewer for approval before merging
>>>
>>> Tier 3 Requirements (8/10 points):
>>> - Require branch to pass at least 1 status check before merging
>>>
>>> Tier 4 Requirements (9/10 points):
>>> - Require at least 2 reviewers for approval before merging
>>> - Require review from code owners
>>>
>>> Tier 5 Requirements (10/10 points):
>>>   *Only affected when scorecard check runs with admin priviledged*
>>
>> Of course, the main critism can be "why to invest time in implementing
>> branch protection rules? Only for earning points to get a nice 'trophy'?"
>>
>>   From the user perspective, having an OpenSSF badge with a good score on
>> the README can help the user to decide if it is valuable to take a
>> deeper look at the project. In our case, it would also show that the
>> Maven project cares about supply chain security.
>>
>>   From the maintainer perspective, we should look at every check and
>> decide check by check if they really help us in our daily work and how
>> high the effort is to implement passing the check.
>>
>> Here is a first review of the best practices proposed by OpenSSF Scorecard:
>>
>>    - Prevent force push
>> This check can be satisfied with the GH branch rule 'Block force
>> pushes'. This rule prevents that someone or an automatismn can overwrite
>> the repository history accidentally (or consciously)
>>
>> - Prevent branch deletion
>> This check can be satisfied with the GH branch rule 'Restrict
>> deletions'. This rule prevents that someone or an automatismn can delete
>> the master branch accidentally (or consciously)
>>
>> - Require at least 1/2 reviewer for approval before merging.
>> This check can be satisfied with the GH branch rule 'Require a pull
>> request before merging' in combination with the setting 'Required
>> approvals = 1/2'. This rule in combination with that setting enforces
>> that at least one or two reviewer on every pull request. It can help to
>> reduce human failure like "This is only a small change, I don't need a
>> code review"
>>
>> - Require branch to pass at least 1 status check before merging
>> This check can be satisfied with the GH branch rule 'Require status
>> checks to pass'. This rule enforces that merging a pull request is only
>> allowed when at least one status check is passed. It can help to reduce
>> human failure like "This is only a small change. It will not break
>> anything. Therefore, I don't want to wait until the check is done."
>>
>> - Require review from code owners
>> This check can be satisfied with the introduction of a CODEOWNERS file
>> in every repository.
>>
>> According to an initial check [1], currently no branch protection checks
>> are passed. But we have at least a rule that prevents force push on the
>> master branch.
>>
>>   From my perspective, passing the following checks can help us to avoid
>> typical human failures that are done mostly accidentally:
>>      - Prevent force push
>>      - Prevent branch deletion
>>      - Require at least 1 reviewer for approval before merging.
>>      - Require branch to pass at least 1 status check before merging
>>
>> For passing the check 'Prevent force push' and 'Prevent branch
>> deletion', we need a refactoring of the current implementation using GH
>> repository rules [2], [3]. This refactoring would help to make it
>> visible from outside.
>>
>> Passing the check 'Require review from code owners', a CODEOWNERS file
>> is needed in every repository. Maintaining such a file in every
>> repository that related to Maven could be painful. It belongs to Tier 4
>> and to pass Tier 4 all previous tiers have to be satisfied. Therefore,
>> IMHO, we should concentrate on the other ones.
>>
>> Passing the check 'Require at least 1 reviewer for approval before
>> merging', the GH rule 'Require a pull request before merging' is needed
>> and that will be have an impact on the release process (m-release-plugin
>> is pushing changes directly to master branch). We can avoid this impact
>> if we maintain a bypass list so this rule can be worked around in
>> specific cases, or we can use this situation and rethink the release
>> process.
>>
>> IMHO, we can decide rule by rule if one is helpful for us or not. I
>> don't think we need to decide like 'implement all rules or nothing.' It
>> also helps only to implement a few of them.
>>
>> If we conclude that it is a good idea to implement such kind of rules.
>> The next question is how to enable the GH rules.
>>
>> Thanks to Piotr, who mentions [4] the possibility of GH repository rules
>> [5], that can be implemented by calling a REST API. He also drew my
>> attention to the fact that ASF infrastructure already has support for
>> branch protection in .asf.yaml [6], [7] (but it seems we are not using
>> it in the Maven project). One idea could be to refactor this script
>> using repository rules (of course, we should also discuss it with ASF
>> infra). In case of we have reason not using ASF infra script, we can
>> implement such script by ourselves for the Maven source repositories
>> (similar to the shared GH action). Or maybe some one has another idea.
>>
>> Best regards,
>>
>> Sandra
>>
>>
>> [0]
>> https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
>> (opened on 2025-07-29)
>> [1]
>> https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven-dependency-plu
>> gin (OpenSSF score card for m-dependency-plugin)
>> [2]
>> https://docs.github.com/en/repositories/configuring-branches-and-merges-in-y
>> our-repository/managing-rulesets/about-rulesets [3]
>> https://github.blog/news-insights/product-news/github-repository-rules-are-n
>> ow-generally-available/ [4]
>> https://github.com/support-and-care/maven-support-and-care/issues/107 [5]
>> https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28 [6]
>> https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml [7]
>> https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/feature/g
>> ithub/branch_protection.py
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Hervé Boutemy <hb...@apache.org>.
I'm all in for the first level of OpenSSF scorecard =  "Prevent force push +  
Prevent branch deletion"
And that should be done not only for default branch, but also every 
maintenance branch when we maintain mutliple branches in parallel (Maven 4.1 
vs 4.0 vs 3.8 vs 3.8, components or plugins 3 vs 4, Doxia 1.x vs 1.20.x vs 
2.x)

sadly, I don't know how to implement with .asf.yaml


for "Require at least 1 reviewer for approval before merging", IIUC it 
combines 2 steps:
- reject direct commits to maintenance branches: require use of PR + merge
- and PR requires more than self review

I'm not absolutely against, just dislike:
1. the overhead
2. the bad habits this will promote
3. it will break maven-release-plugin process that commits directly to 
maintenance branch


explanation:
1. overhead of for PR + merge: on simple typos, i'll have in addition to 
select a PR label to NOT list the PR in the release notes
2. bad habits:
requiring review even on simple typos, I will find a buddy to  quickly pair 
review everything small I do (in the same timezone as me, and we'll help each 
other at reviewing quickly)
The bad habit comes here: my buddy will quickly review everything, small or 
big...
3. if someone wants to add new features and clarify new steps in the release 
process


in summary:
yes for step 1, it's a very good step

for next steps, please all prepare in depth: maybe I'm just lacking optimism

Regards,

Hervé

Le mercredi 30 juillet 2025, 13:02:01 CEST Sandra Parsick a écrit :
> Hi,
> 
> I have taken a more in-depth look at the branch protection checks of the
> OpenSSF scorecard best-practices, and I'd like to discuss two topics:
> 	1. Do we want to enable GH rules to pass some of them?
> 	2. How do we want to enable the GH rules?
> 
> In their documentation [0] , following checks are documented, when the
> 
> score card checks are running without admin permissions:
> > This check determines whether a project's default and release branches are
> > protected with GitHub's branch protection or repository rules settings.
> > [....] Each tier must be fully satisfied to achieve points at the next
> > tier.
> > 
> > Tier 1 Requirements (3/10 points):
> > - Prevent force push
> > - Prevent branch deletion
> > 
> > Tier 2 Requirements (6/10 points):
> > - Require at least 1 reviewer for approval before merging
> > 
> > Tier 3 Requirements (8/10 points):
> > - Require branch to pass at least 1 status check before merging
> > 
> > Tier 4 Requirements (9/10 points):
> > - Require at least 2 reviewers for approval before merging
> > - Require review from code owners
> > 
> > Tier 5 Requirements (10/10 points):
> >  *Only affected when scorecard check runs with admin priviledged*
> 
> Of course, the main critism can be "why to invest time in implementing
> branch protection rules? Only for earning points to get a nice 'trophy'?"
> 
>  From the user perspective, having an OpenSSF badge with a good score on
> the README can help the user to decide if it is valuable to take a
> deeper look at the project. In our case, it would also show that the
> Maven project cares about supply chain security.
> 
>  From the maintainer perspective, we should look at every check and
> decide check by check if they really help us in our daily work and how
> high the effort is to implement passing the check.
> 
> Here is a first review of the best practices proposed by OpenSSF Scorecard:
> 
>   - Prevent force push
> This check can be satisfied with the GH branch rule 'Block force
> pushes'. This rule prevents that someone or an automatismn can overwrite
> the repository history accidentally (or consciously)
> 
> - Prevent branch deletion
> This check can be satisfied with the GH branch rule 'Restrict
> deletions'. This rule prevents that someone or an automatismn can delete
> the master branch accidentally (or consciously)
> 
> - Require at least 1/2 reviewer for approval before merging.
> This check can be satisfied with the GH branch rule 'Require a pull
> request before merging' in combination with the setting 'Required
> approvals = 1/2'. This rule in combination with that setting enforces
> that at least one or two reviewer on every pull request. It can help to
> reduce human failure like "This is only a small change, I don't need a
> code review"
> 
> - Require branch to pass at least 1 status check before merging
> This check can be satisfied with the GH branch rule 'Require status
> checks to pass'. This rule enforces that merging a pull request is only
> allowed when at least one status check is passed. It can help to reduce
> human failure like "This is only a small change. It will not break
> anything. Therefore, I don't want to wait until the check is done."
> 
> - Require review from code owners
> This check can be satisfied with the introduction of a CODEOWNERS file
> in every repository.
> 
> According to an initial check [1], currently no branch protection checks
> are passed. But we have at least a rule that prevents force push on the
> master branch.
> 
>  From my perspective, passing the following checks can help us to avoid
> typical human failures that are done mostly accidentally:
>     - Prevent force push
>     - Prevent branch deletion
>     - Require at least 1 reviewer for approval before merging.
>     - Require branch to pass at least 1 status check before merging
> 
> For passing the check 'Prevent force push' and 'Prevent branch
> deletion', we need a refactoring of the current implementation using GH
> repository rules [2], [3]. This refactoring would help to make it
> visible from outside.
> 
> Passing the check 'Require review from code owners', a CODEOWNERS file
> is needed in every repository. Maintaining such a file in every
> repository that related to Maven could be painful. It belongs to Tier 4
> and to pass Tier 4 all previous tiers have to be satisfied. Therefore,
> IMHO, we should concentrate on the other ones.
> 
> Passing the check 'Require at least 1 reviewer for approval before
> merging', the GH rule 'Require a pull request before merging' is needed
> and that will be have an impact on the release process (m-release-plugin
> is pushing changes directly to master branch). We can avoid this impact
> if we maintain a bypass list so this rule can be worked around in
> specific cases, or we can use this situation and rethink the release
> process.
> 
> IMHO, we can decide rule by rule if one is helpful for us or not. I
> don't think we need to decide like 'implement all rules or nothing.' It
> also helps only to implement a few of them.
> 
> If we conclude that it is a good idea to implement such kind of rules.
> The next question is how to enable the GH rules.
> 
> Thanks to Piotr, who mentions [4] the possibility of GH repository rules
> [5], that can be implemented by calling a REST API. He also drew my
> attention to the fact that ASF infrastructure already has support for
> branch protection in .asf.yaml [6], [7] (but it seems we are not using
> it in the Maven project). One idea could be to refactor this script
> using repository rules (of course, we should also discuss it with ASF
> infra). In case of we have reason not using ASF infra script, we can
> implement such script by ourselves for the Maven source repositories
> (similar to the shared GH action). Or maybe some one has another idea.
> 
> Best regards,
> 
> Sandra
> 
> 
> [0]
> https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
> (opened on 2025-07-29)
> [1]
> https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven-dependency-plu
> gin (OpenSSF score card for m-dependency-plugin)
> [2]
> https://docs.github.com/en/repositories/configuring-branches-and-merges-in-y
> our-repository/managing-rulesets/about-rulesets [3]
> https://github.blog/news-insights/product-news/github-repository-rules-are-n
> ow-generally-available/ [4]
> https://github.com/support-and-care/maven-support-and-care/issues/107 [5]
> https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28 [6] 
> https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml [7]
> https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/feature/g
> ithub/branch_protection.py
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Kemal Soysal <ke...@ls-it-solutions.de>.
Just as a side note: what is the name of the default branch in future?

The release workflow needs a tough change towards maven-CI-friendly-versions… thus what about tags?

Best Regards 
Kemal
> Am 30.07.2025 um 21:04 schrieb Elliotte Rusty Harold <el...@ibiblio.org>:
> 
> I'd start with Tier 1 (I've asked for that before in different
> language) and also Tier 2 and Tier 3. Tier 4 is overkill.
> 
>> On Wed, Jul 30, 2025 at 11:02 AM Sandra Parsick <sa...@parsick.dev> wrote:
>> 
>> Hi,
>> 
>> I have taken a more in-depth look at the branch protection checks of the
>> OpenSSF scorecard best-practices, and I'd like to discuss two topics:
>>        1. Do we want to enable GH rules to pass some of them?
>>        2. How do we want to enable the GH rules?
>> 
>> In their documentation [0] , following checks are documented, when the
>> score card checks are running without admin permissions:
>> 
>>> This check determines whether a project's default and release branches are protected with GitHub's branch protection or repository rules settings. [....] Each tier must be fully satisfied to achieve points at the next tier.
>>> 
>>> Tier 1 Requirements (3/10 points):
>>> - Prevent force push
>>> - Prevent branch deletion
>>> 
>>> Tier 2 Requirements (6/10 points):
>>> - Require at least 1 reviewer for approval before merging
>>> 
>>> Tier 3 Requirements (8/10 points):
>>> - Require branch to pass at least 1 status check before merging
>>> 
>>> Tier 4 Requirements (9/10 points):
>>> - Require at least 2 reviewers for approval before merging
>>> - Require review from code owners
>>> 
>>> Tier 5 Requirements (10/10 points):
>>> *Only affected when scorecard check runs with admin priviledged*
>> 
>> 
>> Of course, the main critism can be "why to invest time in implementing
>> branch protection rules? Only for earning points to get a nice 'trophy'?"
>> 
>> From the user perspective, having an OpenSSF badge with a good score on
>> the README can help the user to decide if it is valuable to take a
>> deeper look at the project. In our case, it would also show that the
>> Maven project cares about supply chain security.
>> 
>> From the maintainer perspective, we should look at every check and
>> decide check by check if they really help us in our daily work and how
>> high the effort is to implement passing the check.
>> 
>> Here is a first review of the best practices proposed by OpenSSF Scorecard:
>> 
>>  - Prevent force push
>> This check can be satisfied with the GH branch rule 'Block force
>> pushes'. This rule prevents that someone or an automatismn can overwrite
>> the repository history accidentally (or consciously)
>> 
>> - Prevent branch deletion
>> This check can be satisfied with the GH branch rule 'Restrict
>> deletions'. This rule prevents that someone or an automatismn can delete
>> the master branch accidentally (or consciously)
>> 
>> - Require at least 1/2 reviewer for approval before merging.
>> This check can be satisfied with the GH branch rule 'Require a pull
>> request before merging' in combination with the setting 'Required
>> approvals = 1/2'. This rule in combination with that setting enforces
>> that at least one or two reviewer on every pull request. It can help to
>> reduce human failure like "This is only a small change, I don't need a
>> code review"
>> 
>> - Require branch to pass at least 1 status check before merging
>> This check can be satisfied with the GH branch rule 'Require status
>> checks to pass'. This rule enforces that merging a pull request is only
>> allowed when at least one status check is passed. It can help to reduce
>> human failure like "This is only a small change. It will not break
>> anything. Therefore, I don't want to wait until the check is done."
>> 
>> - Require review from code owners
>> This check can be satisfied with the introduction of a CODEOWNERS file
>> in every repository.
>> 
>> According to an initial check [1], currently no branch protection checks
>> are passed. But we have at least a rule that prevents force push on the
>> master branch.
>> 
>> From my perspective, passing the following checks can help us to avoid
>> typical human failures that are done mostly accidentally:
>>    - Prevent force push
>>    - Prevent branch deletion
>>    - Require at least 1 reviewer for approval before merging.
>>    - Require branch to pass at least 1 status check before merging
>> 
>> For passing the check 'Prevent force push' and 'Prevent branch
>> deletion', we need a refactoring of the current implementation using GH
>> repository rules [2], [3]. This refactoring would help to make it
>> visible from outside.
>> 
>> Passing the check 'Require review from code owners', a CODEOWNERS file
>> is needed in every repository. Maintaining such a file in every
>> repository that related to Maven could be painful. It belongs to Tier 4
>> and to pass Tier 4 all previous tiers have to be satisfied. Therefore,
>> IMHO, we should concentrate on the other ones.
>> 
>> Passing the check 'Require at least 1 reviewer for approval before
>> merging', the GH rule 'Require a pull request before merging' is needed
>> and that will be have an impact on the release process (m-release-plugin
>> is pushing changes directly to master branch). We can avoid this impact
>> if we maintain a bypass list so this rule can be worked around in
>> specific cases, or we can use this situation and rethink the release
>> process.
>> 
>> IMHO, we can decide rule by rule if one is helpful for us or not. I
>> don't think we need to decide like 'implement all rules or nothing.' It
>> also helps only to implement a few of them.
>> 
>> If we conclude that it is a good idea to implement such kind of rules.
>> The next question is how to enable the GH rules.
>> 
>> Thanks to Piotr, who mentions [4] the possibility of GH repository rules
>> [5], that can be implemented by calling a REST API. He also drew my
>> attention to the fact that ASF infrastructure already has support for
>> branch protection in .asf.yaml [6], [7] (but it seems we are not using
>> it in the Maven project). One idea could be to refactor this script
>> using repository rules (of course, we should also discuss it with ASF
>> infra). In case of we have reason not using ASF infra script, we can
>> implement such script by ourselves for the Maven source repositories
>> (similar to the shared GH action). Or maybe some one has another idea.
>> 
>> Best regards,
>> 
>> Sandra
>> 
>> 
>> [0]
>> https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
>> (opened on 2025-07-29)
>> [1]
>> https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven-dependency-plugin
>>    (OpenSSF score card for m-dependency-plugin)
>> [2]
>> https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
>> [3]
>> https://github.blog/news-insights/product-news/github-repository-rules-are-now-generally-available/
>> [4] https://github.com/support-and-care/maven-support-and-care/issues/107
>> [5] https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28
>> [6]  https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml
>> [7]
>> https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/feature/github/branch_protection.py
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> -- 
> Elliotte Rusty Harold
> elharo@ibiblio.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [DISCUSS] Branch Protection Rules

Posted by Elliotte Rusty Harold <el...@ibiblio.org>.
I'd start with Tier 1 (I've asked for that before in different
language) and also Tier 2 and Tier 3. Tier 4 is overkill.

On Wed, Jul 30, 2025 at 11:02 AM Sandra Parsick <sa...@parsick.dev> wrote:
>
> Hi,
>
> I have taken a more in-depth look at the branch protection checks of the
> OpenSSF scorecard best-practices, and I'd like to discuss two topics:
>         1. Do we want to enable GH rules to pass some of them?
>         2. How do we want to enable the GH rules?
>
> In their documentation [0] , following checks are documented, when the
> score card checks are running without admin permissions:
>
> > This check determines whether a project's default and release branches are protected with GitHub's branch protection or repository rules settings. [....] Each tier must be fully satisfied to achieve points at the next tier.
> >
> > Tier 1 Requirements (3/10 points):
> > - Prevent force push
> > - Prevent branch deletion
> >
> > Tier 2 Requirements (6/10 points):
> > - Require at least 1 reviewer for approval before merging
> >
> > Tier 3 Requirements (8/10 points):
> > - Require branch to pass at least 1 status check before merging
> >
> > Tier 4 Requirements (9/10 points):
> > - Require at least 2 reviewers for approval before merging
> > - Require review from code owners
> >
> > Tier 5 Requirements (10/10 points):
> >  *Only affected when scorecard check runs with admin priviledged*
>
>
> Of course, the main critism can be "why to invest time in implementing
> branch protection rules? Only for earning points to get a nice 'trophy'?"
>
>  From the user perspective, having an OpenSSF badge with a good score on
> the README can help the user to decide if it is valuable to take a
> deeper look at the project. In our case, it would also show that the
> Maven project cares about supply chain security.
>
>  From the maintainer perspective, we should look at every check and
> decide check by check if they really help us in our daily work and how
> high the effort is to implement passing the check.
>
> Here is a first review of the best practices proposed by OpenSSF Scorecard:
>
>   - Prevent force push
> This check can be satisfied with the GH branch rule 'Block force
> pushes'. This rule prevents that someone or an automatismn can overwrite
> the repository history accidentally (or consciously)
>
> - Prevent branch deletion
> This check can be satisfied with the GH branch rule 'Restrict
> deletions'. This rule prevents that someone or an automatismn can delete
> the master branch accidentally (or consciously)
>
> - Require at least 1/2 reviewer for approval before merging.
> This check can be satisfied with the GH branch rule 'Require a pull
> request before merging' in combination with the setting 'Required
> approvals = 1/2'. This rule in combination with that setting enforces
> that at least one or two reviewer on every pull request. It can help to
> reduce human failure like "This is only a small change, I don't need a
> code review"
>
> - Require branch to pass at least 1 status check before merging
> This check can be satisfied with the GH branch rule 'Require status
> checks to pass'. This rule enforces that merging a pull request is only
> allowed when at least one status check is passed. It can help to reduce
> human failure like "This is only a small change. It will not break
> anything. Therefore, I don't want to wait until the check is done."
>
> - Require review from code owners
> This check can be satisfied with the introduction of a CODEOWNERS file
> in every repository.
>
> According to an initial check [1], currently no branch protection checks
> are passed. But we have at least a rule that prevents force push on the
> master branch.
>
>  From my perspective, passing the following checks can help us to avoid
> typical human failures that are done mostly accidentally:
>     - Prevent force push
>     - Prevent branch deletion
>     - Require at least 1 reviewer for approval before merging.
>     - Require branch to pass at least 1 status check before merging
>
> For passing the check 'Prevent force push' and 'Prevent branch
> deletion', we need a refactoring of the current implementation using GH
> repository rules [2], [3]. This refactoring would help to make it
> visible from outside.
>
> Passing the check 'Require review from code owners', a CODEOWNERS file
> is needed in every repository. Maintaining such a file in every
> repository that related to Maven could be painful. It belongs to Tier 4
> and to pass Tier 4 all previous tiers have to be satisfied. Therefore,
> IMHO, we should concentrate on the other ones.
>
> Passing the check 'Require at least 1 reviewer for approval before
> merging', the GH rule 'Require a pull request before merging' is needed
> and that will be have an impact on the release process (m-release-plugin
> is pushing changes directly to master branch). We can avoid this impact
> if we maintain a bypass list so this rule can be worked around in
> specific cases, or we can use this situation and rethink the release
> process.
>
> IMHO, we can decide rule by rule if one is helpful for us or not. I
> don't think we need to decide like 'implement all rules or nothing.' It
> also helps only to implement a few of them.
>
> If we conclude that it is a good idea to implement such kind of rules.
> The next question is how to enable the GH rules.
>
> Thanks to Piotr, who mentions [4] the possibility of GH repository rules
> [5], that can be implemented by calling a REST API. He also drew my
> attention to the fact that ASF infrastructure already has support for
> branch protection in .asf.yaml [6], [7] (but it seems we are not using
> it in the Maven project). One idea could be to refactor this script
> using repository rules (of course, we should also discuss it with ASF
> infra). In case of we have reason not using ASF infra script, we can
> implement such script by ourselves for the Maven source repositories
> (similar to the shared GH action). Or maybe some one has another idea.
>
> Best regards,
>
> Sandra
>
>
> [0]
> https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
> (opened on 2025-07-29)
> [1]
> https://scorecard.dev/viewer/?uri=github.com%2Fapache%2Fmaven-dependency-plugin
>     (OpenSSF score card for m-dependency-plugin)
> [2]
> https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
> [3]
> https://github.blog/news-insights/product-news/github-repository-rules-are-now-generally-available/
> [4] https://github.com/support-and-care/maven-support-and-care/issues/107
> [5] https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28
> [6]  https://github.com/apache/infrastructure-asfyaml/blob/main/.asf.yaml
> [7]
> https://github.com/apache/infrastructure-asfyaml/blob/main/asfyaml/feature/github/branch_protection.py
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>


-- 
Elliotte Rusty Harold
elharo@ibiblio.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org