Skip to content

docs: add ADR for branch protection #391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

UlisesGascon
Copy link
Member

@UlisesGascon UlisesGascon commented Jun 3, 2025

Related expressjs/security-wg#2

cc: @expressjs/express-tc @expressjs/security-wg

Comment on lines +94 to +97
### Phase 2: Harden Governance

- Periodic review of admin bypass usage using the Scorecard Monitor ([ref](https://github.com/expressjs/security-wg/pull/70))
- Enforce admin bypass documentation for emergency changes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we split this off into a separate decision?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment about adding more valid reasons above, but seeing this comment I think I agree that we should make that an amendment onto this larger ADR. For a while our CI was broken and the only way I could merge things was bypassing the protections. I think it is unreasonable to limit ourselves like this until we have automated releases since we can always fix the history if a mistake is made.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. No problem to split... what do we want to split only the Implementation or just the bypass rules?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chris was speaking specifically about keeping the Branch Protection ADR as its own, and a score card ADR as a separate decision.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the other changes were made, and this one only says "enforce" the rules we document above. I think that means we can mark it resolve. I am going to and change to approve, but as it was @ctcpip's comment I am very much alright with re-opening it to continue discussion if necessary.

Copy link
Member

@wesleytodd wesleytodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of my comments are nit picks, but I do agree with @ctcpip that we should spin out the bypass stuff into a follow up. It can even be an edit to this after we land IMO, but I like the main content of this so it would be unfortunate to hold that up because we need to discuss one small part.

- Require all status checks to pass before merging

Optional rules:
- Enforce linear history (disable merge commits, allow squash/rebase)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big fan of this, and I think we also had earlier discussion about this where we all generally agreed on it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, We can do it in a separate ADR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could leave it here as optional and then open a PR to move it to required and discuss that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately tho there's issues with this; linear history is good, but github's rebasemerge/squashmerge is bad.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny -- we just ran into this earlier today, where I had to do a git CLI commit undo, rebase, etc. I can go either way on the branch setting itself, but there will be times it will need to be disabled to avoid messy and risky rebase work

Comment on lines +94 to +97
### Phase 2: Harden Governance

- Periodic review of admin bypass usage using the Scorecard Monitor ([ref](https://github.com/expressjs/security-wg/pull/70))
- Enforce admin bypass documentation for emergency changes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment about adding more valid reasons above, but seeing this comment I think I agree that we should make that an amendment onto this larger ADR. For a while our CI was broken and the only way I could merge things was bypassing the protections. I think it is unreasonable to limit ourselves like this until we have automated releases since we can always fix the history if a mistake is made.

UlisesGascon and others added 7 commits June 3, 2025 18:00
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Wes Todd <wes@wesleytodd.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Chris de Almeida <ctcpip@users.noreply.github.com>
Co-authored-by: Wes Todd <wes@wesleytodd.com>
Co-authored-by: Wes Todd <wes@wesleytodd.com>
Co-authored-by: Wes Todd <wes@wesleytodd.com>
Comment on lines +94 to +97
### Phase 2: Harden Governance

- Periodic review of admin bypass usage using the Scorecard Monitor ([ref](https://github.com/expressjs/security-wg/pull/70))
- Enforce admin bypass documentation for emergency changes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the other changes were made, and this one only says "enforce" the rules we document above. I think that means we can mark it resolve. I am going to and change to approve, but as it was @ctcpip's comment I am very much alright with re-opening it to continue discussion if necessary.

@UlisesGascon
Copy link
Member Author

So... I plan to land this next week. Please add your reviews or blockers :)

Copy link
Member

@blakeembrey blakeembrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this and following up for comments, I missed the full discussion earlier.


Optional rules:
- Enforce linear history (disable merge commits, allow squash/rebase)
- Restrict who can push directly to the protected branches to people who can release (captains, TC, etc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand this optional rule and how it interacts with the exception below?

From my understanding enabling this would allow the people who can release to permanently bypass the branch protection rules, rather than temporarily. It'd be simpler to have everything follow the same process to avoid any confusion when it comes down to this.


- Identify all active repositories
- Notify repo maintainers of the change
- Apply default protection rules using GitHub API or organization policies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2025-07-13 at 11 20 40@2x

Can you document the API you use so people can re-use/update it over time? 🙏

@@ -0,0 +1,109 @@
# ADR 367: Enforce Branch Protection by Default Across All Repositories
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ADR 391?

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

Successfully merging this pull request may close these issues.

7 participants