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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"os" | |
"github.com/open-policy-agent/opa/v1/ast" | |
"github.com/open-policy-agent/opa/v1/format" |
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
{ | |
"package": { | |
"location": "1:1:1:8", | |
"path": [ | |
{ | |
"type": "var", | |
"value": "data" | |
}, | |
{ | |
"location": "1:9:1:14", |
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
version: 2 | |
updates: | |
- package-ecosystem: "github-actions" | |
directory: "/" | |
schedule: | |
interval: "weekly" | |
groups: | |
dependencies: | |
patterns: | |
- "*" |
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
package google_sql_database_instance | |
import rego.v1 | |
violations contains db_instance.id if { | |
some db_instance in input.google_sql_database_instance | |
not valid_db_instance(db_instance) | |
} | |
valid_db_instance(db_instance) if every setting in db_instance.config.settings { |
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
package accurics | |
import rego.v1 | |
violations contains db_instance.id if { | |
some db_instance in input.google_sql_database_instance | |
some setting in db_instance.config.settings | |
invalid_db_instance_setting(setting) | |
} |
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
arr := [x | some x in input.my_array] |
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
arr = my_array || [] |
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
allow if { | |
# return input.user.name, or "anyomous" if the lookup fails | |
user := object.get(input, ["user", "name"], "anonymous") | |
user != "anonymous" | |
# ... more conditions | |
} |
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
deny := message if { | |
code_reason_map := { | |
400: "Bad request", | |
404: "Not found", | |
500: "Internal server error", | |
} | |
message := code_reason_map[status_code] | |
} |
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
allow { | |
# Simple way to "inline" an OR check — turn it into a "contains" problem | |
input.request.method in {“HEAD”, “GET”} | |
} |
NewerOlder