Skip to content

feat(queries): fix deprecated built in regal lint issue #7415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 152 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
4477f67
add initial regal lint setup
cx-artur-ribeiro Feb 23, 2025
3cd6fc2
test regal linter
cx-artur-ribeiro Feb 23, 2025
bb6bc2f
revert rego changes
cx-artur-ribeiro Feb 23, 2025
b012c13
opa fmt lint fixes on all rego files
cx-artur-ribeiro Feb 23, 2025
336243f
ignore all linter rules besides opa-fmt
cx-artur-ribeiro Feb 23, 2025
70b2757
add new lint rules to ignore
cx-artur-ribeiro Feb 23, 2025
7223ef4
reorganize lint rules into the right rule
cx-artur-ribeiro Feb 23, 2025
24470f0
add more rules to the config file
cx-artur-ribeiro Feb 23, 2025
505e5c4
add more rules and fix opa-fmt problem
cx-artur-ribeiro Feb 23, 2025
3da838e
test to check lint rule-shadows-builtin issues
cx-artur-ribeiro Feb 24, 2025
4a7a327
fix rule shadows builtin lint issue in .rego queries
cx-artur-ribeiro Feb 24, 2025
2f8f66d
fix lint
cx-artur-ribeiro Feb 24, 2025
a1c5db6
update level on var-shadows-builtin to tackle lint issues
cx-artur-ribeiro Feb 24, 2025
853b31f
fix var-shadows-builtin lint issues
cx-artur-ribeiro Feb 24, 2025
5e4cbf8
fix var-shadows-builtin lint issues
cx-artur-ribeiro Feb 25, 2025
f6b7aa8
Merge branch 'master' into regal-var-shadows-builtin
cx-artur-ribeiro Feb 25, 2025
d0bfc17
Merge branch 'regal-var-shadows-builtin' of https://github.com/Checkm…
cx-artur-ribeiro Feb 25, 2025
0954762
fix var-shadows-builtin lint issues
cx-artur-ribeiro Feb 25, 2025
383e6c5
first commit to trigger regal linter non-raw-regex-pattern
cx-artur-ribeiro Feb 26, 2025
f8740d1
fix non-raw-regex-pattern lint issues
cx-artur-ribeiro Feb 26, 2025
14bc51e
fix non-raw-regex-pattern lint issues
cx-artur-ribeiro Feb 26, 2025
b70dd5b
initial commit to trigger regal linter no-whitespace-comment rule
cx-artur-ribeiro Feb 28, 2025
03a7880
Merge branch 'master' into regal-no-whitespace-comment
cx-artur-ribeiro Feb 28, 2025
84eb2e8
initial fix to regal linter no-whitespace-comment rule
cx-artur-ribeiro Feb 28, 2025
1a12a27
fix to regal linter no-whitespace-comment rule
cx-artur-ribeiro Feb 28, 2025
d872fb5
fix to regal linter no-whitespace-comment rule
cx-artur-ribeiro Feb 28, 2025
5837e53
fix to regal linter no-whitespace-comment rule
cx-artur-ribeiro Feb 28, 2025
543fd8e
fix to regal linter no-whitespace-comment rule
cx-artur-ribeiro Feb 28, 2025
d18bcdb
initial commit to trigger to regal linter use-in-operator rule
cx-artur-ribeiro Feb 28, 2025
a0e06ca
Fix regal linter use-in-operator rule
cx-artur-ribeiro Feb 28, 2025
b1f6f12
Fix regal linter use-in-operator rule
cx-artur-ribeiro Feb 28, 2025
5b15168
Fix regal linter use-in-operator rule
cx-artur-ribeiro Feb 28, 2025
c6dbf01
test fix reverting one lint change
cx-artur-ribeiro Mar 1, 2025
8bcdb28
test fix reverting one lint change
cx-artur-ribeiro Mar 1, 2025
356ed5b
fix all tests by reverting some lint change
cx-artur-ribeiro Mar 1, 2025
030c9ef
fix use in operator lint issue
cx-artur-ribeiro Mar 1, 2025
a40dddd
fix openAPI tests removing in keyword
cx-artur-ribeiro Mar 1, 2025
9f187c2
fix openAPI lint issues
cx-artur-ribeiro Mar 1, 2025
35d47fe
fix gcp test errors
cx-artur-ribeiro Mar 1, 2025
6918d24
fix unit k8s tests
cx-artur-ribeiro Mar 1, 2025
8a74e62
Initial commit to trigger custom has key construct regal lint issue
cx-artur-ribeiro Mar 1, 2025
78c3227
revert last commit
cx-artur-ribeiro Mar 1, 2025
f3e6a01
Initial commit to trigger custom has key construct regal lint issue
cx-artur-ribeiro Mar 1, 2025
5d565c5
fix custom has key construct regal lint issue
cx-artur-ribeiro Mar 1, 2025
5122515
fix errors
cx-artur-ribeiro Mar 1, 2025
a5003ec
fix errors
cx-artur-ribeiro Mar 1, 2025
ed8fce6
fix remaining regal lint issues
cx-artur-ribeiro Mar 1, 2025
e308947
remove unused function
cx-artur-ribeiro Mar 1, 2025
012069c
initial commit to trigger equals-pattern-matching regal lint issue
cx-artur-ribeiro Mar 1, 2025
694621e
fix equals-pattern-matching regal lint issue
cx-artur-ribeiro Mar 1, 2025
3bfd723
initial commit to trigger equals-pattern-matching regal lint rule
cx-artur-ribeiro Mar 1, 2025
488e539
fix equals-pattern-matching regal lint issue
cx-artur-ribeiro Mar 1, 2025
9df2555
update regal lint rules from warn to warning
cx-artur-ribeiro Mar 1, 2025
d1ffbb2
initial commit to trigger non-loop-expression regal lint rule
cx-artur-ribeiro Mar 1, 2025
d05af31
initial test to fix non-loop-expression regal lint issue
cx-artur-ribeiro Mar 1, 2025
ee7b129
fix non-loop-expression regal lint issue
cx-artur-ribeiro Mar 1, 2025
0dc199d
fix remaining regal lint issues
cx-artur-ribeiro Mar 1, 2025
dd29028
fix non-loop-expression regal lint issue
cx-artur-ribeiro Mar 1, 2025
67fde67
test regal with version statement
cx-artur-ribeiro Mar 1, 2025
c36a477
revert version on regal and try a new validation to fix non loop expr…
cx-artur-ribeiro Mar 2, 2025
39afcc1
fix non loop expression with a more efficient solution
cx-artur-ribeiro Mar 2, 2025
fbf200d
fix lint issues and try a new approach on k8s client certificate query
cx-artur-ribeiro Mar 2, 2025
347ceda
try a fix on linting problem k8s client_certificate
cx-artur-ribeiro Mar 2, 2025
d2707c5
try a fix on linting problem k8s client_certificate
cx-artur-ribeiro Mar 2, 2025
ced3791
fix non loop expressions regal lint issue
cx-artur-ribeiro Mar 2, 2025
ba9227c
fix last lint issue opa fmt
cx-artur-ribeiro Mar 2, 2025
d430fe5
try to apply opa fmt automatically into rego files commited
cx-artur-ribeiro Mar 2, 2025
45b62c3
try with no sha code
cx-artur-ribeiro Mar 2, 2025
0e4e366
try with no new instruction
cx-artur-ribeiro Mar 2, 2025
c2bd8c1
same opa version as the go.mod package
cx-artur-ribeiro Mar 2, 2025
ab62fc5
revert addition of opa fmt rule to action
cx-artur-ribeiro Mar 2, 2025
58f2425
initial commit to trigger defer-assignment regal lint issue
cx-artur-ribeiro Mar 2, 2025
7622faf
initial try to fix defer assignment regal lint issue
cx-artur-ribeiro Mar 2, 2025
65d2044
another try to fix defer assignment regal lint issue
cx-artur-ribeiro Mar 2, 2025
70fd5b1
another try to fix defer assignment regal lint issue
cx-artur-ribeiro Mar 2, 2025
8552dba
another try to fix defer assignment regal lint issue
cx-artur-ribeiro Mar 2, 2025
432bb6b
test fix defer assigment k8s pod or container query
cx-artur-ribeiro Mar 2, 2025
94b1d46
test fix defer assigment
cx-artur-ribeiro Mar 2, 2025
c69c2e9
fix typo
cx-artur-ribeiro Mar 2, 2025
544cefe
fix defer assignment regal lint issue
cx-artur-ribeiro Mar 2, 2025
4d21bf1
fix defer assignment regal lint issue cloudformation
cx-artur-ribeiro Mar 2, 2025
ad01db6
fix defer assignment regal lint issue cloudformation
cx-artur-ribeiro Mar 2, 2025
7d2dce4
fix defer assignment regal lint issue cloudformation app_access query
cx-artur-ribeiro Mar 2, 2025
f7fef2a
try fix test
cx-artur-ribeiro Mar 2, 2025
e72919c
try fix regal linter defer assignment test
cx-artur-ribeiro Mar 2, 2025
3c57fde
try fix regal linter defer assignment test
cx-artur-ribeiro Mar 2, 2025
853fe81
fix regal lint issue
cx-artur-ribeiro Mar 2, 2025
3a55edd
fix regal lint defer-assignment issue
cx-artur-ribeiro Mar 2, 2025
ed6007b
try to fix regal lint defer-assignment issue
cx-artur-ribeiro Mar 2, 2025
c2f0dec
try to fix regal lint defer-assignment issue
cx-artur-ribeiro Mar 2, 2025
3403309
fix regal lint defer-assignment issue
cx-artur-ribeiro Mar 2, 2025
4346e70
fix regal lint defer-assignment issues
cx-artur-ribeiro Mar 2, 2025
aeadfd7
fix regal lint defer-assignment issues
cx-artur-ribeiro Mar 2, 2025
413ddf2
fix regal lint defer-assignment issues
cx-artur-ribeiro Mar 2, 2025
b828991
fix tests
cx-artur-ribeiro Mar 2, 2025
7be0d81
initial commit to trigger redundant-alias regal lint issues
cx-artur-ribeiro Mar 2, 2025
21c88a6
fix redundant-alias regal lint issues
cx-artur-ribeiro Mar 2, 2025
c3c691e
initial commit to trigger sprintf-arguments-mismatch regal lint issue
cx-artur-ribeiro Mar 2, 2025
59968d2
fix sprintf-arguments-mismatch regal lint issue
cx-artur-ribeiro Mar 3, 2025
278041c
fix sprintf-arguments-mismatch regal lint issue
cx-artur-ribeiro Mar 3, 2025
e0b15c7
fix sprintf-arguments-mismatch regal lint issue
cx-artur-ribeiro Mar 3, 2025
dbf55c1
fix sprintf-arguments-mismatch regal lint issue
cx-artur-ribeiro Mar 3, 2025
7d9312c
fix unit tests
cx-artur-ribeiro Mar 3, 2025
a7e7605
fix opa fmt
cx-artur-ribeiro Mar 3, 2025
685857b
initial trigger to regal lint rule leaked-internal-reference
cx-artur-ribeiro Mar 3, 2025
4ffd767
fix leaked-internal-reference regal lint issues
cx-artur-ribeiro Mar 3, 2025
9a6289b
fix leaked-internal-reference regal lint issues
cx-artur-ribeiro Mar 3, 2025
742744f
fix leaked-internal-reference regal lint issues
cx-artur-ribeiro Mar 3, 2025
6db7e64
fix leaked-internal-reference in dockerfile lib
cx-artur-ribeiro Mar 3, 2025
30ee349
fix leaked-internal-reference in dockerfile lib
cx-artur-ribeiro Mar 3, 2025
640baf0
fix leaked-internal-reference regal lint issues
cx-artur-ribeiro Mar 3, 2025
10014d2
fix opa fmt regal lint issues
cx-artur-ribeiro Mar 3, 2025
b4a238d
fix type on function name
cx-artur-ribeiro Mar 3, 2025
a87379d
fix typo on function name
cx-artur-ribeiro Mar 4, 2025
be6964f
fix error on common function
cx-artur-ribeiro Mar 4, 2025
fe90255
fix error on common function
cx-artur-ribeiro Mar 4, 2025
e13a24a
Merge branch 'master' into regal-leaked-internal-reference
cx-artur-ribeiro Mar 6, 2025
237e3b3
Merge branch 'master' into regal-leaked-internal-reference
cx-artur-ribeiro Mar 7, 2025
df7ad9a
fix typo on import
cx-artur-ribeiro Mar 7, 2025
ced1dee
add new get kics filter expr to correctly assert the usage of operato…
cx-artur-ribeiro Mar 7, 2025
e2110a3
initial commit to trigger regal redundant-existence-check lint rule
cx-artur-ribeiro Mar 7, 2025
358d2ae
fix regal-redundant-existence-check regal lint issue
cx-artur-ribeiro Mar 7, 2025
f295ebe
initial commit to trigger pointless-reassignment regal lint issue
cx-artur-ribeiro Mar 7, 2025
bd72bb6
fix some regal lint pointless-reassignment issues
cx-artur-ribeiro Mar 7, 2025
14da0e0
experiment try to fix regal lint pointless-reassignment issue on sql_…
cx-artur-ribeiro Mar 7, 2025
e7576ab
fix regal lint pointless-reassignment issues besides libraries
cx-artur-ribeiro Mar 7, 2025
8215414
fix regal lint pointless-reassignment issues in all libraries
cx-artur-ribeiro Mar 7, 2025
3d05d07
revert last change to ansible library
cx-artur-ribeiro Mar 7, 2025
34924e0
Merge branch 'master' into regal-pointless-reassignment
cx-artur-ribeiro Mar 15, 2025
07758ea
Merge branch 'master' into regal-pointless-reassignment
cx-artur-ribeiro Mar 29, 2025
917b0d6
fix cloudformation query
cx-artur-ribeiro Mar 29, 2025
1a2efe7
initial commit to trigger regal deprecated-builtin lint rule
cx-artur-ribeiro Mar 29, 2025
1cdc18c
fix re_match deprecated builtin function call on all rego queries
cx-artur-ribeiro Mar 29, 2025
927a1b4
fix all deprecated builtin function call
cx-artur-ribeiro Mar 29, 2025
52cad33
fix unit tests and opa fmt on files
cx-artur-ribeiro Mar 29, 2025
f3cbad0
fix regal lint issues non-loop-expression, opa-fmt and deprecated-bui…
cx-artur-ribeiro Mar 29, 2025
22a090d
fix deprecated built all and any regal lint issues
cx-artur-ribeiro Mar 29, 2025
2db6456
fix lint issues
cx-artur-ribeiro Mar 29, 2025
7adeddb
fix regal lint issues
cx-artur-ribeiro Mar 29, 2025
8c6713e
fix opa fmt for better monitorization of regal lint issues
cx-artur-ribeiro Mar 29, 2025
07dcc47
fix opa fmt any in some cases for testing purposes
cx-artur-ribeiro Mar 29, 2025
1f1e137
fix any lint issues
cx-artur-ribeiro Mar 29, 2025
0080f0e
fix common.rego regal lint issues
cx-artur-ribeiro Mar 29, 2025
16c3508
fix lint issues
cx-artur-ribeiro Mar 29, 2025
95621a0
fix unit test replacing with else
cx-artur-ribeiro Mar 29, 2025
41f75b7
test fix unit test
cx-artur-ribeiro Mar 29, 2025
6f6b01c
opa fmt common.rego
cx-artur-ribeiro Mar 29, 2025
b47a826
fix issues
cx-artur-ribeiro Mar 29, 2025
e1344ca
fix unit tests with correct implementation
cx-artur-ribeiro Mar 30, 2025
86b341b
fix query, only one all left to fix
cx-artur-ribeiro Mar 30, 2025
8054ac1
fix last deprecated built in regal lint issue and unit tests
cx-artur-ribeiro Mar 30, 2025
a6538e7
rename variable for better understanding
cx-artur-ribeiro Mar 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 24 additions & 0 deletions .github/workflows/validate-rego.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: validate-rego

on:
pull_request:
paths:
- "assets/**/*.rego"

jobs:
lint-rego:
name: Run Regal Linter on Rego Files
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: Setup Regal
uses: StyraInc/setup-regal@33a142b1189004e0f14bf42b15972c67eecce776 # v1.0.0
with:
version: v0.31.1

- name: Run Regal Linter
run: regal lint --format=github assets --config-file=assets/.regal/config.yml
139 changes: 139 additions & 0 deletions assets/.regal/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Since the linting rules will be tackled in separate PRs, we are temporarily ignoring all rules.
# We will update rule severities as each PR is merged.

rules:
bugs:
not-equals-in-loop:
# https://docs.styra.com/regal/rules/bugs/not-equals-in-loop
level: ignore
rule-shadows-builtin:
# https://docs.styra.com/regal/rules/bugs/rule-shadows-builtin
level: warning
var-shadows-builtin:
# https://docs.styra.com/regal/rules/bugs/var-shadows-builtin
level: warning
unused-output-variable:
# https://docs.styra.com/regal/rules/bugs/unused-output-variable
level: ignore
deprecated-builtin:
# https://docs.styra.com/regal/rules/bugs/deprecated-builtin
level: warning
leaked-internal-reference:
# https://docs.styra.com/regal/rules/bugs/leaked-internal-reference
level: warning
include-test-files: false
sprintf-arguments-mismatch:
# https://docs.styra.com/regal/rules/bugs/sprintf-arguments-mismatch
level: warning
inconsistent-args:
# https://docs.styra.com/regal/rules/bugs/inconsistent-args
level: ignore
redundant-existence-check:
# https://docs.styra.com/regal/rules/bugs/redundant-existence-check
level: warning
idiomatic:
no-defined-entrypoint:
# https://docs.styra.com/regal/rules/idiomatic/no-defined-entrypoint
# No single entrypoint for this project
level: ignore
# temporary
non-raw-regex-pattern:
# https://docs.styra.com/regal/rules/idiomatic/non-raw-regex-pattern
level: warning
use-in-operator:
# https://docs.styra.com/regal/rules/idiomatic/use-in-operator
level: warning
use-some-for-output-vars:
# https://docs.styra.com/regal/rules/idiomatic/use-some-for-output-vars
# These would be good to address, but would require a concentrated effort
level: ignore
custom-has-key-construct:
# https://docs.styra.com/regal/rules/idiomatic/custom-has-key-construct
level: warning
equals-pattern-matching:
# https://docs.styra.com/regal/rules/idiomatic/equals-pattern-matching
level: warning
use-contains:
# https://docs.styra.com/regal/rules/idiomatic/use-contains
level: ignore
use-if:
# https://docs.styra.com/regal/rules/idiomatic/use-if
level: ignore
directory-package-mismatch:
# https://docs.styra.com/regal/rules/idiomatic/directory-package-mismatch
level: ignore
custom-in-construct:
# https://docs.styra.com/regal/rules/idiomatic/custom-in-construct
level: ignore
style:
avoid-get-and-list-prefix:
# https://docs.styra.com/regal/rules/style/avoid-get-and-list-prefix
level: ignore
external-reference:
# https://docs.styra.com/regal/rules/style/external-reference
level: ignore
file-length:
# https://docs.styra.com/regal/rules/style/file-length
level: ignore
line-length:
# https://docs.styra.com/regal/rules/style/line-length
level: ignore
no-whitespace-comment:
# https://docs.styra.com/regal/rules/style/no-whitespace-comment
level: warning
opa-fmt:
# https://docs.styra.com/regal/rules/style/opa-fmt
level: warning
prefer-some-in-iteration:
# https://docs.styra.com/regal/rules/style/prefer-some-in-iteration
# 10000+ violations fixed but way more to go
level: ignore
prefer-snake-case:
# https://docs.styra.com/regal/rules/style/prefer-snake-case
level: ignore
rule-length:
# https://docs.styra.com/regal/rules/style/rule-length
level: ignore
todo-comment:
# https://docs.styra.com/regal/rules/style/todo-comment
# only one TODO comment in the codebase to fix this issue
level: ignore
use-assignment-operator:
# https://docs.styra.com/regal/rules/style/use-assignment-operator
level: ignore
rule-name-repeats-package:
# https://docs.styra.com/regal/rules/style/rule-name-repeats-package
level: ignore
messy-rule:
# https://docs.styra.com/regal/rules/style/messy-rule
level: ignore
comprehension-term-assignment:
# https://docs.styra.com/regal/rules/style/comprehension-term-assignment
level: ignore
pointless-reassignment:
# https://docs.styra.com/regal/rules/style/pointless-reassignment
level: warning
unconditional-assignment:
# https://docs.styra.com/regal/rules/style/unconditional-assignment
level: ignore
default-over-else:
# https://docs.styra.com/regal/rules/style/default-over-else
level: ignore
imports:
use-rego-v1:
# https://docs.styra.com/regal/rules/imports/use-rego-v1
level: ignore
redundant-alias:
# https://docs.styra.com/regal/rules/imports/redundant-alias
level: warning
import-after-rule:
# https://docs.styra.com/regal/rules/imports/import-after-rule
level: warning
performance:
non-loop-expression:
# https://docs.styra.com/regal/rules/performance/non-loop-expression
level: warning
defer-assignment:
# https://docs.styra.com/regal/rules/performance/defer-assignment
level: warning

38 changes: 17 additions & 21 deletions assets/libraries/ansible.rego
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package generic.ansible

# Global variable with all tasks in input
tasks := TasksPerDocument
import future.keywords.in

# Builds an object that stores all tasks for each document id
TasksPerDocument[id] = result {
tasks[id] = result {
document := input.document[i]
id := document.id
result := getTasks(document)
Expand Down Expand Up @@ -33,14 +32,12 @@ getTasksFromBlocks(playbook) = result {
not task.block
validPath(path)
]
} else = [playbook] {
true
}
} else = [playbook]

# Validates the path of a nested element inside a block task to assure it's a task
validPath(path) {
count(path) > 1
validGroup(path[minus(count(path), 2)])
validGroup(path[count(path) - 2])
}

# Identifies a block task
Expand Down Expand Up @@ -89,16 +86,15 @@ allowsPort(allowed, port) {
some i
contains(allowed.ports[i], "-")
port_bounds := split(allowed.ports[i], "-")
low := to_number(port_bounds[0])
high := to_number(port_bounds[1])

low := to_number(port_bounds[0])
low <= portNumber

high := to_number(port_bounds[1])
high >= portNumber
} else {
allowed.ports[_] == port
} else = false {
true
}
port in allowed.ports
} else = false

# Checks if a given port is included in a network rule
isPortInRule(rule, portNumber) {
Expand All @@ -112,7 +108,7 @@ isPortInRule(rule, portNumber) {
}

isPortInRule(rule, portNumber) {
rule.ports[_] == portNumber
portNumber in rule.ports
}

isPortInRule(rule, portNumber) {
Expand Down Expand Up @@ -149,11 +145,11 @@ isEntireNetwork(cidr) {
}

installer_modules := [
"community.general.apk", "ansible.builtin.apt", "ansible.builtin.apt", "community.general.bundler", "ansible.builtin.dnf", "community.general.easy_install",
"community.general.gem", "community.general.homebrew", "community.general.jenkins_plugin", "community.general.npm", "community.general.openbsd_pkg",
"ansible.builtin.package", "ansible.builtin.package", "community.general.pear", "community.general.pacman", "ansible.builtin.pip", "community.general.pkg5",
"community.general.pkgutil", "community.general.pkgutil", "community.general.portage", "community.general.slackpkg", "community.general.sorcery",
"community.general.swdepot", "win_chocolatey", "community.general.yarn", "ansible.builtin.yum", "community.general.zypper", "apk", "apt", "bower", "bundler",
"dnf", "easy_install", "gem", "homebrew", "jenkins_plugin", "npm", "openbsd_package", "openbsd_pkg", "package", "pacman", "pear", "pip", "pkg5", "pkgutil",
"community.general.apk", "ansible.builtin.apt", "ansible.builtin.apt", "community.general.bundler", "ansible.builtin.dnf", "community.general.easy_install",
"community.general.gem", "community.general.homebrew", "community.general.jenkins_plugin", "community.general.npm", "community.general.openbsd_pkg",
"ansible.builtin.package", "ansible.builtin.package", "community.general.pear", "community.general.pacman", "ansible.builtin.pip", "community.general.pkg5",
"community.general.pkgutil", "community.general.pkgutil", "community.general.portage", "community.general.slackpkg", "community.general.sorcery",
"community.general.swdepot", "win_chocolatey", "community.general.yarn", "ansible.builtin.yum", "community.general.zypper", "apk", "apt", "bower", "bundler",
"dnf", "easy_install", "gem", "homebrew", "jenkins_plugin", "npm", "openbsd_package", "openbsd_pkg", "package", "pacman", "pear", "pip", "pkg5", "pkgutil",
"portage", "slackpkg", "sorcery", "swdepot", "win_chocolatey", "yarn", "yum", "zypper",
]
]
23 changes: 11 additions & 12 deletions assets/libraries/azureresourcemanager.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ package generic.azureresourcemanager

# gets the network security group properties for two types of resource ('Microsoft.Network/networkSecurityGroups' and 'Microsoft.Network/networkSecurityGroups/securityRules')
get_sg_info(value) = typeInfo {
value.type == "Microsoft.Network/networkSecurityGroups/securityRules"
value.type == "Microsoft.Network/networkSecurityGroups/securityRules"
typeInfo := {
"type": value.type,
"properties": value.properties,
"type": value.type,
"properties": value.properties,
"path": "resources.type={{Microsoft.Network/networkSecurityGroups/securityRules}}.properties",
"sl": ["properties"]
}
"sl": ["properties"],
}
} else = typeInfo {
value.type == "securityRules"
typeInfo := {
"type": value.type,
"properties": value.properties,
"type": value.type,
"properties": value.properties,
"path": "resources.type={{securityRules}}.properties",
"sl": ["properties"]
"sl": ["properties"],
}
}

Expand Down Expand Up @@ -70,7 +70,7 @@ get_outer_children(doc, nameParent) = outerArr {
getDefaultValueFromParametersIfPresent(doc, valueToCheck) = [value, propertyType] {
parameterName := isParameterReference(valueToCheck)
parameter := doc.parameters[parameterName].defaultValue
value := parameter
value = parameter
propertyType := "parameter default value"
} else = [value, propertyType] {
not isParameterReference(valueToCheck)
Expand All @@ -84,11 +84,10 @@ isParameterReference(valueToCheck) = parameterName {
parameterName := trim_right(trim_left(trim_left(valueToCheck, "[parameters"), "('"), "')]")
}


isDisabledOrUndefined(doc, resource, parametersPath){
isDisabledOrUndefined(doc, resource, parametersPath) {
object.get(resource, split(parametersPath, "."), "not defined") == "not defined"
} else {
value := object.get(resource, split(parametersPath, "."),"")
value := object.get(resource, split(parametersPath, "."), "")
[check, _] := getDefaultValueFromParametersIfPresent(doc, value)
check == false
}
1 change: 0 additions & 1 deletion assets/libraries/cicd.rego
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
package generic.cicd

Loading
Loading