-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(resources): files domain support for resources auditing
- Loading branch information
1 parent
b4bae91
commit a8baa46
Showing
4 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"server": { | ||
"protocol": "https" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"config": { | ||
"server": { | ||
"protocol": "https" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
domain: | ||
type: file | ||
file-spec: | ||
filepaths: | ||
- Name: config | ||
path: config.json | ||
provider: | ||
type: opa | ||
opa-spec: | ||
rego: | | ||
package validate | ||
import rego.v1 | ||
# Default values | ||
default validate := false | ||
default msg := "Not evaluated" | ||
validate if { | ||
check_server_protocol.result | ||
} | ||
msg = check_server_protocol.msg | ||
config := input["config"] | ||
protocol := config.server.protocol | ||
check_server_protocol = {"result": true, "msg": msg} if { | ||
protocol == "https" | ||
msg := "Server protocol is set to https" | ||
} else = {"result": false, "msg": msg} if { | ||
protocol == "http" | ||
msg := "Server Protocol must be https - http is disallowed" | ||
} | ||
output: | ||
validation: validate.validate | ||
observations: | ||
- validate.msg |