Skip to content

Commit 30a3ce9

Browse files
committed
fix: copilot issues
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
1 parent fda5b31 commit 30a3ce9

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

policies/gh_org_sso_enabled.rego

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,27 @@ risk_templates := [
4343
}
4444
]
4545

46-
_sso := object.get(input, "sso", null)
46+
_sso := object.get(input, "sso", {})
4747

4848
skip_reason := "SSO configuration data is unavailable (token may lack permissions), cannot evaluate SSO enforcement status" if {
49-
_sso == null
49+
input.sso == null
5050
}
5151

52-
_sso_enabled := object.get(_sso, "enabled", false)
52+
_sso_enabled := object.get(_sso, "enabled", false) if {
53+
_sso != null
54+
}
5355

54-
_sso_enforced := object.get(_sso, "enforced", false)
56+
_sso_enforced := object.get(_sso, "enforced", false) if {
57+
_sso != null
58+
}
5559

5660
_sso_enabled_and_enforced if {
5761
_sso_enabled
5862
_sso_enforced
5963
}
6064

6165
violation[{"id": "sso_not_enabled"}] if {
66+
not skip_reason
6267
not _sso_enabled_and_enforced
6368
}
6469

policies/gh_org_sso_enabled_test.rego

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ test_sso_missing if {
3838
}
3939

4040
test_sso_null_with_skip_reason if {
41-
skip_reason == "SSO configuration data is unavailable (token may lack permissions), cannot evaluate SSO enforcement status"
42-
with input as {
41+
skip_reason == "SSO configuration data is unavailable (token may lack permissions), cannot evaluate SSO enforcement status" with input as {
42+
"sso": null
43+
}
44+
count(violation) == 0 with input as {
4345
"sso": null
4446
}
4547
}

0 commit comments

Comments
 (0)