diff --git a/checks/evaluation/permissions.go b/checks/evaluation/permissions.go index d7146e8193b1..53cc41136037 100644 --- a/checks/evaluation/permissions.go +++ b/checks/evaluation/permissions.go @@ -241,8 +241,9 @@ func calculateScore(result map[string]permissions) int { // contents. // Allows attacker to commit unreviewed code. + // Scoring does not apply to job-level permissions, as this is a common place to use third-party actions. // High risk: -10 - if permissionIsPresent(perms, "contents") { + if permissionIsPresentInTopLevel(perms, "contents") { score -= checker.MaxResultScore } diff --git a/checks/permissions_test.go b/checks/permissions_test.go index 5e575136b7b4..bb671932ebd4 100644 --- a/checks/permissions_test.go +++ b/checks/permissions_test.go @@ -251,7 +251,7 @@ func TestGithubTokenPermissions(t *testing.T) { filenames: []string{"./testdata/.github/workflows/github-workflow-permissions-contents-writes-no-release.yaml"}, expected: scut.TestReturn{ Error: nil, - Score: checker.MinResultScore, + Score: checker.MaxResultScore, NumberOfWarn: 1, NumberOfInfo: 1, NumberOfDebug: 4,