Skip to content

Commit c66be99

Browse files
authored
fix: remove code check dependency for primary branch protection check (#142)
This change closes issue #141 by updating the evaluation logic to remove any check on what the contents of the repository are. This change was tested against `revanite-io/example-osps-baseline-level-1` and correctly results in the following result for `AC-03.01`: ```yaml control-id: OSPS-AC-03 result: Needs Review message: Branch protection rule prevents deletions corrupted-state: false assessments: - requirement-id: OSPS-AC-03.01 applicability: - Maturity Level 1 - Maturity Level 2 - Maturity Level 3 description: When a direct commit is attempted on the project's primary branch, an enforcement mechanism MUST prevent the change from being applied. result: Needs Review message: Branch protection rule does not restrict pushes or require approving reviews; Rulesets not yet evaluated. steps: - github.com/revanite-io/pvtr-github-repo/evaluation_plans/osps/access_control.branchProtectionRestrictsPushes steps-executed: 1 start: "2025-09-21T13:02:37-04:00" end: "2025-09-21T13:02:37-04:00" ``` Signed-off-by: Travis Truman <trumant@gmail.com>
1 parent 4c2579d commit c66be99

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

evaluation_plans/osps/access_control/evaluations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ func OSPS_AC_03() (evaluation *layer4.ControlEvaluation) {
6464
"Maturity Level 3",
6565
},
6666
[]layer4.AssessmentStep{
67-
reusable_steps.IsCodeRepo,
6867
branchProtectionRestrictsPushes, // This checks branch protection, but not rulesets yet
6968
},
7069
)

evaluation_plans/osps/access_control/steps.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ func branchProtectionRestrictsPushes(payloadData any, _ map[string]*layer4.Chang
2727
if message != "" {
2828
return layer4.Unknown, message
2929
}
30-
if !payload.IsCodeRepo {
31-
return layer4.NotApplicable, "Repository contains no code - skipping branch protection checks"
32-
}
3330
protectionData := payload.Repository.DefaultBranchRef.BranchProtectionRule
3431

3532
if protectionData.RestrictsPushes {

0 commit comments

Comments
 (0)