Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions example-data/testorg-unremediated.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"settings": {
"login": "test-org",
"id": 1234567,
"node_id": "O_abcdefg",
Expand Down Expand Up @@ -43,11 +44,11 @@
"members_can_create_public_pages": true,
"members_can_create_private_pages": true,
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 10000,
"filled_seats": 2,
"seats": 1
"name": "free",
"space": 976562499,
"private_repos": 10000,
"filled_seats": 2,
"seats": 1
},
"advanced_security_enabled_for_new_repositories": false,
"dependabot_alerts_enabled_for_new_repositories": false,
Expand All @@ -58,4 +59,5 @@
"secret_scanning_push_protection_custom_link_enabled": false,
"secret_scanning_push_protection_custom_link": null,
"secret_scanning_validity_checks_enabled": false
}
}
}
14 changes: 8 additions & 6 deletions example-data/testorg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"settings": {
"login": "test-org",
"id": 1234567,
"node_id": "O_abcdefg",
Expand Down Expand Up @@ -43,11 +44,11 @@
"members_can_create_public_pages": false,
"members_can_create_private_pages": true,
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 10000,
"filled_seats": 2,
"seats": 1
"name": "free",
"space": 976562499,
"private_repos": 10000,
"filled_seats": 2,
"seats": 1
},
"advanced_security_enabled_for_new_repositories": true,
"dependabot_alerts_enabled_for_new_repositories": true,
Expand All @@ -58,4 +59,5 @@
"secret_scanning_push_protection_custom_link_enabled": true,
"secret_scanning_push_protection_custom_link": null,
"secret_scanning_validity_checks_enabled": true
}
}
}
2 changes: 1 addition & 1 deletion policies/gh_org_mfa_enabled.rego
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package compliance_framework.mfa_enabled

violation[{}] if {
input.two_factor_requirement_enabled == false
input.settings.two_factor_requirement_enabled == false
}

title := "Two Factor Authentication is required at an organization level"
Expand Down
8 changes: 6 additions & 2 deletions policies/gh_org_mfa_enabled_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ package compliance_framework.mfa_enabled

test_mfa_enabled if {
count(violation) == 0 with input as {
"two_factor_requirement_enabled": true
"settings": {
"two_factor_requirement_enabled": true
}
}
}

test_mfa_violate_if_disabled if {
count(violation) > 0 with input as {
"two_factor_requirement_enabled": false
"settings": {
"two_factor_requirement_enabled": false
}
}
}
10 changes: 5 additions & 5 deletions policies/gh_org_public_repos.rego
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package compliance_framework.public_repos

checks["repos"] if {
input.public_repos > 0
_checks["repos"] if {
input.settings.public_repos > 0
}

checks["gists"] if {
input.public_gists > 0
_checks["gists"] if {
input.settings.public_gists > 0
}

violation[{}] if {
some check in checks
some check in _checks
}


Expand Down
12 changes: 8 additions & 4 deletions policies/gh_org_public_repos_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ package compliance_framework.public_repos

test_public_repos_is_zero if {
count(violation) == 0 with input as {
"pubic_repos": 0,
"public_gists": 0
"settings": {
"public_repos": 0,
"public_gists": 0
}
}
}

test_public_repos_violate_when_higher if {
count(violation) > 0 with input as {
"public_repos": 10,
"public_gists": 0
"settings": {
"public_repos": 10,
"public_gists": 0
}
}
}
9 changes: 9 additions & 0 deletions policies/gh_teams_privacy_closed.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package compliance_framework.teams_privacy_closed

violation[{}] if {
some team in input.teams
team.privacy != "closed"
}

title := "All teams are private within the organization"
description := "All teams within the organization must be set to private to ensure sensitive information is not exposed."
31 changes: 31 additions & 0 deletions policies/gh_teams_privacy_closed_test.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package compliance_framework.teams_privacy_closed

test_teams_privacy_closed if {
count(violation) == 0 with input as {
"teams": [
{
"name": "team1",
"privacy": "closed"
},
{
"name": "team2",
"privacy": "closed"
}
]
}
}

test_teams_privacy_open if {
count(violation) > 0 with input as {
"teams": [
{
"name": "team1",
"privacy": "open"
},
{
"name": "team2",
"privacy": "closed"
}
]
}
}
18 changes: 18 additions & 0 deletions policies/gh_teams_security_found.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package compliance_framework.teams_security_found

_team_with_security if {
some team in input.teams
contains(lower(team.name), "security")
}

_team_with_security if {
some team in input.teams
contains(lower(team.description), "security")
}

violation[{}] if {
not _team_with_security
}

title := "Security Teams are present within Github"
description := "A dedicated security team should be created in the organization to manage security-related tasks and incidents, as well as provide consulting when required."