Skip to content

Commit

Permalink
opa fmt -w .
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-phylum committed Jul 11, 2024
1 parent 5f1dbc2 commit 892af3a
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 46 deletions.
16 changes: 8 additions & 8 deletions confirmed_malicious.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ import rego.v1

# Returns a violation if the author is known malicious
deny contains issue if {
some issue in data.issues
issue.tag == "CA0001"
some issue in data.issues
issue.tag == "CA0001"
}

# Returns a violation if the package contains verified malware
deny contains issue if {
some issue in data.issues
issue.tag == "CM0037"
some issue in data.issues
issue.tag == "CM0037"
}

# Returns a violation if the package contains a known-bad compiled binary
deny contains issue if {
some issue in data.issues
issue.tag == "CM0038"
some issue in data.issues
issue.tag == "CM0038"
}

# Returns a violation if the package depends on a known malicious package
deny contains issue if {
some issue in data.issues
issue.tag == "CM0039"
some issue in data.issues
issue.tag == "CM0039"
}
8 changes: 4 additions & 4 deletions data_exfiltration.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import rego.v1

# Package contains environment variable enumeration
deny contains issue if {
some issue in data.issues
issue.tag == "HM0025"
some issue in data.issues
issue.tag == "HM0025"
}

# Package contains webhook exfiltration
deny contains issue if {
some issue in data.issues
issue.tag == "HM0036"
some issue in data.issues
issue.tag == "HM0036"
}
4 changes: 2 additions & 2 deletions dependency_confusion.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Package contains environment variable enumeration
deny contains issue if {
some issue in data.issues
issue.tag == "HM0018"
some issue in data.issues
issue.tag == "HM0018"
}
4 changes: 2 additions & 2 deletions install_code.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Package contains code execution on install
deny contains issue if {
some issue in data.issues
issue.tag in {"IM0042", "IM0043", "IM0044"}
some issue in data.issues
issue.tag in {"IM0042", "IM0043", "IM0044"}
}
8 changes: 4 additions & 4 deletions install_code_suspicious.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import rego.v1

# Package contains suspicious code execution on install
deny contains issue if {
some issue in data.issues
issue.tag == "CM0007"
some issue in data.issues
issue.tag == "CM0007"
}

# Package contains suspicious code execution on install
deny contains issue if {
some issue in data.issues
endswith(issue.tag, "M0031")
some issue in data.issues
endswith(issue.tag, "M0031")
}
4 changes: 2 additions & 2 deletions license_mismatch.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# License mismatch
deny contains issue if {
some issue in data.issues
issue.tag == "IL0022"
some issue in data.issues
issue.tag == "IL0022"
}
4 changes: 2 additions & 2 deletions minimal_code.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Package contains minimal code
deny contains issue if {
some issue in data.issues
issue.tag == "IE0027"
some issue in data.issues
issue.tag == "IE0027"
}
4 changes: 2 additions & 2 deletions obfuscated_code.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Package contains obfuscated code
deny contains issue if {
some issue in data.issues
issue.tag in {"HM0029", "HM0099", "HM0023", "IM0040", "IM0041"}
some issue in data.issues
issue.tag in {"HM0029", "HM0099", "HM0023", "IM0040", "IM0041"}
}
4 changes: 2 additions & 2 deletions runs_remote_code.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Runs remote code
deny contains issue if {
some issue in data.issues
issue.tag in {"CM0024", "MM0024", "HM0032"}
some issue in data.issues
issue.tag in {"CM0024", "MM0024", "HM0032"}
}
4 changes: 2 additions & 2 deletions secret_non_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Secrets in non-test file
deny contains issue if {
some issue in data.issues
issue.tag == "ME0016"
some issue in data.issues
issue.tag == "ME0016"
}
2 changes: 1 addition & 1 deletion show_all.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import rego.v1

# Policy Violation
deny contains issue if {
some issue in data.issues
some issue in data.issues
}
4 changes: 2 additions & 2 deletions suspicious_url.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import rego.v1

# Suspicious URL reference
deny contains issue if {
some issue in data.issues
issue.tag == "MM0028"
some issue in data.issues
issue.tag == "MM0028"
}
10 changes: 5 additions & 5 deletions typosquat.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

package policy.v1

import rego.v1
import data.phylum.domain
import rego.v1

# Potential typosquat with malicious characteristics
deny contains typosquat_issue if {
some dependency in data.dependencies
some dependency in data.dependencies

some typosquat_issue in dependency.issues
typosquat_issue.tag == "HM0008"
some typosquat_issue in dependency.issues
typosquat_issue.tag == "HM0008"

count([d | dependency.issues[i].domain == domain.MALICIOUS; d := dependency.issues[i].domain]) > 1
count([d | dependency.issues[i].domain == domain.MALICIOUS; d := dependency.issues[i].domain]) > 1

Check failure on line 18 in typosquat.rego

View workflow job for this annotation

GitHub Actions / lint

Use `some` to declare output variables. To learn more, see: https://docs.styra.com/regal/rules/idiomatic/use-some-for-output-vars
}
8 changes: 4 additions & 4 deletions vuln_crit.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

package policy.v1

import rego.v1
import data.phylum.domain
import data.phylum.level
import rego.v1

# Critical software vulnerability
deny contains issue if {
some issue in data.issues
issue.domain == domain.VULNERABILITY
issue.severity == level.CRITICAL
some issue in data.issues
issue.domain == domain.VULNERABILITY
issue.severity == level.CRITICAL
}
8 changes: 4 additions & 4 deletions vuln_crit_high.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

package policy.v1

import rego.v1
import data.phylum.domain
import data.phylum.level
import rego.v1

# Critical or High software vulnerability
deny contains issue if {
some issue in data.issues
issue.domain == domain.VULNERABILITY
issue.severity > level.MEDIUM
some issue in data.issues
issue.domain == domain.VULNERABILITY
issue.severity > level.MEDIUM
}

0 comments on commit 892af3a

Please sign in to comment.