Skip to content
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

Merge Develop into Release #3516

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions javascript/sequelize/security/audit/sequelize-raw-query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@ rules:
$QUERY = $SQL + $VALUE
...
$DATABASE.sequelize.query($QUERY, ...)
- pattern: |
Sequelize.literal(`...${...}...`)
- pattern: |
$QUERY = `...${...}...`
...
Sequelize.literal($QUERY)
- pattern: |
Sequelize.literal($SQL + $VALUE)
- pattern: |
$QUERY = $SQL + $VALUE
...
Sequelize.literal($QUERY)
5 changes: 5 additions & 0 deletions scala/lang/security/audit/tainted-sql-string.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,9 @@ object Smth {
logWarning(s"Create user $name")
}
}

def throwException(name: String) = {
// ok: tainted-sql-string
throw new IllegalArgumentException(s"Can't create a ${name}")
}
}
1 change: 1 addition & 0 deletions scala/lang/security/audit/tainted-sql-string.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ rules:
- pattern-regex: |
.*\b(?i)(select|delete|insert|create|update|alter|drop)\b.*
- pattern-not-inside: println(...)
- pattern-not-inside: throw new $EXCEPTION(...)
pattern-sanitizers:
- pattern-either:
- patterns:
Expand Down
18 changes: 18 additions & 0 deletions yaml/semgrep/metadata-owasp.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ rules:
metadata:
# ok: metadata-owasp
owasp: A05:2021 - Security Misconfiguration
- id: example-k8s-1
message: Example
severity: ERROR
languages: [json, yaml]
pattern: "..."
metadata:
# ok: metadata-owasp
owasp: "K1: Insecure Workload Configurations"
- id: example-k8s-1b
message: Example
severity: ERROR
languages: [json, yaml]
pattern: "..."
metadata:
# ok: metadata-owasp
owasp: K01:2022 - Insecure Workload Configurations
- id: example-bad-zero
message: Example
severity: ERROR
Expand Down Expand Up @@ -75,6 +91,8 @@ rules:
- A05:2021 - Security Misconfiguration
# ok: metadata-owasp
- A06:2017 - Security Misconfiguration
# ok: metadata-owasp
- K01:2022 - Insecure Workload Configurations
- id: example-bad-list
message: Example
severity: ERROR
Expand Down
8 changes: 4 additions & 4 deletions yaml/semgrep/metadata-owasp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rules:
- id: metadata-owasp
message: >-
The `owasp` tag in Semgrep rule metadata should start with the format "A00:YYYY",
where A00 is the OWASP top ten number and YYYY is the OWASP top ten year.
where A00 is the OWASP Top 10 number and YYYY is the OWASP Top 10 year.
severity: ERROR
languages: [json, yaml]
patterns:
Expand All @@ -13,13 +13,13 @@ rules:
# If there's a year, need leading zero, e.g. `A01:2021 blah` rather than `A1:2021 blah`.
- patterns:
- pattern: 'owasp: "..."'
- pattern-not: 'owasp: "=~/^A(0?[1-9]|10):\s+.+$/"'
- pattern-not: 'owasp: "=~/^A(0[1-9]|10):([0-9]{4})?\s+.+$/"'
- pattern-not: 'owasp: "=~/^(A|K|LLM)(0?[1-9]|10):\s+.+$/"'
- pattern-not: 'owasp: "=~/^(A|K|LLM)(0[1-9]|10):([0-9]{4})?\s+.+$/"'
# A list, must have the year, e.g. `- A01:2021 blah`
- patterns:
- pattern-inside: "owasp: [...]"
- pattern: '"$ANYTHING"'
- pattern-not-regex: .*A(0[1-9]|10):[0-9]{4}\s+.*
- pattern-not-regex: .*(A|K|LLM)(0[1-9]|10):[0-9]{4}\s+.*
- pattern-not-regex: "owasp:"
metadata:
category: best-practice
Expand Down
Loading