Skip to content

chore: add standardized branch protection baseline and rollout guide#130

Open
Aaravanand00 wants to merge 1 commit intohyperledger-identus:mainfrom
Aaravanand00:chore/branch-security-hardening
Open

chore: add standardized branch protection baseline and rollout guide#130
Aaravanand00 wants to merge 1 commit intohyperledger-identus:mainfrom
Aaravanand00:chore/branch-security-hardening

Conversation

@Aaravanand00
Copy link
Copy Markdown

This PR introduces a consistent baseline for branch protection across Identus repositories, along with a practical rollout approach.

While going through the issue, I noticed that branch protection rules vary across repositories, which can make the development workflow inconsistent and sometimes risky. The aim here is to define a simple, reusable standard that can be applied gradually without disrupting existing CI setups.

What’s included

A reusable GitHub Ruleset template for main branches covering:

  1. Required pull requests with 2 approvals
  2. Mandatory status checks (aligned with each repo’s existing CI workflows)
  3. Conversation resolution before merge
  4. Up-to-date branch requirement
  5. Disabled force pushes and branch deletion

A branch-protection.md guide that explains:

  1. Why these rules are important for SDLC stability
  2. How to apply the ruleset using GitHub UI (import flow)
  3. How to map required checks to repo-specific CI workflows
  4. A phased rollout strategy (evaluate → active)
  5. Emergency handling (admin bypass with post-merge review)

Rollout approach

Instead of enforcing everything at once, the idea is to:

  1. Start with a low-risk or actively maintained repository in evaluate mode
  2. Validate CI compatibility and required checks
  3. Gradually move to active enforcement and expand to other repositories

Notes

  1. This acts as a baseline template, not a hard enforcement — maintainers can adapt it as needed
  2. CI check names are intentionally not hardcoded to avoid breaking existing pipelines
  3. Admin bypass is documented for emergency use only, with a recommendation for post-merge review

Expected outcome

  1. More consistent and predictable merge process across repositories
  2. Reduced risk of unreviewed or direct changes to main branches
  3. Better confidence in CI before code is merged

Copilot AI review requested due to automatic review settings April 22, 2026 11:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces a baseline, reusable GitHub Ruleset template and accompanying documentation to standardize branch protection across the Hyperledger Identus repository ecosystem, with guidance for phased rollout.

Changes:

  • Added a branch protection / rulesets rollout guide (docs/branch-protection.md).
  • Updated contributing guidelines to reference the standardized branch protection baseline.
  • Added an importable GitHub Ruleset template for main/master (.github/rulesets/main-branch-protection.json).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
docs/branch-protection.md Documents the baseline rules and a phased rollout process for applying rulesets.
CONTRIBUTING.md Links contributor workflow expectations to the standardized branch protection rules.
.github/rulesets/main-branch-protection.json Provides an importable baseline GitHub Ruleset for main/master protection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CONTRIBUTING.md Outdated
To maintain SDLC stability, all pull requests must adhere to the standardized [Branch Protection Rules](docs/branch-protection.md). Key requirements include:
- Mandatory peer review (1-2 approvals).
- Passing all required status checks (CI, Lint, Unit Tests).
- Linear history (rebase or squash merge preferred).
"target": "branch",
"source_type": "Repository",
"source": "hyperledger-identus/template",
"enforcement": "active",
Comment on lines +38 to +57
},
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": true,
"required_status_checks": [
{
"context": "CI build",
"integration_id": 15368
},
{
"context": "Lint / formatting",
"integration_id": 15368
},
{
"context": "Unit tests",
"integration_id": 15368
}
]
}
Comment on lines +24 to +29
"type": "required_signatures",
"parameters": {
"enabled": false
}
},
{
Comment thread CONTRIBUTING.md Outdated
Comment on lines 214 to 219

1. **Review Frequency**
- Address review comments promptly
- Keep PRs focused and reasonably sized
- Respond to feedback constructively

Comment thread CONTRIBUTING.md Outdated
### Branch Security

To maintain SDLC stability, all pull requests must adhere to the standardized [Branch Protection Rules](docs/branch-protection.md). Key requirements include:
- Mandatory peer review (1-2 approvals).
@Aaravanand00 Aaravanand00 force-pushed the chore/branch-security-hardening branch from 2a2085c to 075f023 Compare April 22, 2026 11:15
Signed-off-by: Aaravanand00 <aaravanand5749@gmail.com>
Copilot AI review requested due to automatic review settings April 22, 2026 11:17
@Aaravanand00 Aaravanand00 force-pushed the chore/branch-security-hardening branch from 075f023 to 2632c0e Compare April 22, 2026 11:17
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a reusable baseline for GitHub branch protection (Rulesets) across Hyperledger Identus repos, plus guidance for gradual rollout and adoption.

Changes:

  • Added a branch protection / rulesets guide with rollout and exception-handling guidance.
  • Updated CONTRIBUTING.md to reference the standardized branch protection baseline.
  • Added a GitHub Ruleset JSON template for protecting main/master.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
docs/branch-protection.md New documentation describing the baseline rules, rollout strategy, and import/apply steps.
CONTRIBUTING.md Adds a “Branch Security” section pointing contributors to the branch protection standard.
.github/rulesets/main-branch-protection.json Introduces the reusable GitHub Ruleset template (evaluate mode) for main/master protection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/branch-protection.md

### Pull Request Requirements
- **Require a pull request before merging**: No direct pushes allowed.
- **Required Approvals**: **Strict minimum of 2 approvals** from designated maintainers or code owners.
Comment thread docs/branch-protection.md
### Status Checks
The following logic applies to status checks:
- **Strict Requirement**: Branches **must** be up to date with the default branch before merging.
- **Context Naming**: Use repository-specific CI check names (e.g., `CI / build`, `Lint`, `Test`).
Comment thread CONTRIBUTING.md
- Keep PRs focused and reasonably sized
- Respond to feedback constructively

### Branch Security
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.

2 participants