Skip to content

Commit

Permalink
Merge pull request #3407 from semgrep/merge-develop-to-release
Browse files Browse the repository at this point in the history
Merge Develop into Release
  • Loading branch information
p4p3r committed Jun 19, 2024
2 parents adfc239 + da164e5 commit 1032ff0
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 21 deletions.
7 changes: 4 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions generic/secrets/gitleaks/harness-api-key.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
rules:
- id: harness-api-key
message: A gitleaks harness-api-key was detected which attempts to identify hard-coded credentials. It is not recommended to store credentials in source-code, as this risks secrets being leaked and used by either an internal or external malicious adversary. It is recommended to use environment variables to securely provide credentials or retrieve credentials from a secure vault or HSM (Hardware Security Module).
languages:
- regex
severity: INFO
metadata:
likelihood: LOW
impact: MEDIUM
confidence: LOW
category: security
cwe:
- "CWE-798: Use of Hard-coded Credentials"
cwe2021-top25: true
cwe2022-top25: true
owasp:
- A07:2021 - Identification and Authentication Failures
references:
- https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html
source-rule-url: https://github.com/zricethezav/gitleaks/tree/master/cmd/generate/config/rules
subcategory:
- vuln
technology:
- gitleaks
patterns:
- pattern-regex: ((?:pat|sat)\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20})
2 changes: 1 addition & 1 deletion generic/secrets/gitleaks/telegram-bot-api-token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ rules:
technology:
- gitleaks
patterns:
- pattern-regex: (?i)(?:^|\b|bot)([0-9]{5,16}:A[a-z0-9_\-]{34})(?:$|\b[^_\-])
- pattern-regex: (?i:(?:telegr)(?:[0-9a-z\(-_\t .\\]{0,40})(?:[\s|']|[\s|"]){0,3})(?:=|\|\|:|<=|=>|:|\?=|\()(?:'|\"|\s|=|\x60){0,5}([0-9]{5,16}:A[a-z0-9_\-]{34})(?:['|\"|\n|\r|\s|\x60|;|\\]|$)
6 changes: 6 additions & 0 deletions go/lang/security/audit/crypto/math_random.fixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import (
"crypto/rand"
// ruleid: math-random-used
mrand "crypto/rand"
// ruleid: math-random-used
mrand "crypto/rand"
// ruleid: math-random-used
mrand "crypto/rand"
// ok: math-random-used
mrand "math/rand/something"
)

func main() {
Expand Down
6 changes: 6 additions & 0 deletions go/lang/security/audit/crypto/math_random.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import (
"crypto/rand"
// ruleid: math-random-used
mrand "math/rand"
// ruleid: math-random-used
mrand "math/rand/v2"
// ruleid: math-random-used
mrand "math/rand/v222"
// ok: math-random-used
mrand "math/rand/something"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go/lang/security/audit/crypto/math_random.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rules:
import "$MATH"
- metavariable-regex:
metavariable: $MATH
regex: ^(math/rand)$
regex: ^(math/rand(\/v[0-9]+)*)$
- pattern-either:
- pattern-inside: |
...
Expand Down
4 changes: 2 additions & 2 deletions java/spring/security/injection/tainted-url-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ rules:
This could allow an attacker to send data to their own server,
potentially exposing sensitive data such as cookies or authorization
information sent with this request. They could also probe internal
servers or other resources that the server runnig this code can access.
servers or other resources that the server running this code can access.
(This is called server-side request forgery, or SSRF.) Do not allow
arbitrary hosts. Instead, create an allowlist for approved hosts hardcode
arbitrary hosts. Instead, create an allowlist for approved hosts, hardcode
the correct host, or ensure that the user data can only affect the path or parameters.
options:
interfile: true
Expand Down
4 changes: 2 additions & 2 deletions php/lang/security/injection/tainted-url-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ rules:
to send data
to their own server, potentially exposing sensitive data such as cookies or authorization information
sent with this request.
They could also probe internal servers or other resources that the server runnig this code can access.
They could also probe internal servers or other resources that the server running this code can access.
(This is called
server-side request forgery, or SSRF.) Do not allow arbitrary hosts. Instead, create an allowlist
for approved hosts hardcode
for approved hosts, or hardcode
the correct host.
metadata:
cwe:
Expand Down
4 changes: 2 additions & 2 deletions python/django/security/injection/tainted-url-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ rules:
message: User data flows into the host portion of this manually-constructed URL. This could allow an
attacker to send data to their own server, potentially exposing sensitive data such as cookies or
authorization information sent with this request. They could also probe internal servers or other
resources that the server runnig this code can access. (This is called server-side request forgery,
or SSRF.) Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts hardcode the
resources that the server running this code can access. (This is called server-side request forgery,
or SSRF.) Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or hardcode the
correct host.
metadata:
cwe:
Expand Down
4 changes: 2 additions & 2 deletions python/flask/security/injection/tainted-url-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ rules:
This could allow an attacker to send data to their own server, potentially
exposing sensitive data such as cookies or authorization information sent
with this request. They could also probe internal servers or other
resources that the server runnig this code can access. (This is called
resources that the server running this code can access. (This is called
server-side request forgery, or SSRF.) Do not allow arbitrary hosts.
Instead, create an allowlist for approved hosts hardcode the correct host.
Instead, create an allowlist for approved hosts, or hardcode the correct host.
metadata:
cwe:
- 'CWE-918: Server-Side Request Forgery (SSRF)'
Expand Down
2 changes: 1 addition & 1 deletion ruby/rails/security/injection/tainted-url-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rules:
This could allow an attacker to send data to their own server, potentially
exposing sensitive data such as cookies or authorization information sent
with this request. They could also probe internal servers or other resources
that the server runnig this code can access. (This is called server-side
that the server running this code can access. (This is called server-side
request forgery, or SSRF.) Do not allow arbitrary hosts. Use the `ssrf_filter`
gem and guard the url construction with `SsrfFilter(...)`, or create
an allowlist for approved hosts.
Expand Down
4 changes: 2 additions & 2 deletions scala/lang/security/audit/dispatch-ssrf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ rules:
A parameter being passed directly into `url` most likely lead to SSRF.
This could allow an attacker to send data to their own server, potentially exposing sensitive data
sent with this request.
They could also probe internal servers or other resources that the server runnig this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts hardcode the correct
They could also probe internal servers or other resources that the server running this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or hardcode the correct
host.
metadata:
cwe:
Expand Down
4 changes: 2 additions & 2 deletions scala/lang/security/audit/io-source-ssrf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ rules:
A parameter being passed directly into `fromURL` most likely lead to SSRF.
This could allow an attacker to send data to their own server, potentially exposing sensitive data
sent with this request.
They could also probe internal servers or other resources that the server runnig this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts hardcode the correct
They could also probe internal servers or other resources that the server running this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or hardcode the correct
host.
metadata:
cwe:
Expand Down
6 changes: 3 additions & 3 deletions scala/lang/security/audit/scalaj-http-ssrf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ rules:
...
}
message: >-
A parameter being passed directly into `Http` most likely lead to SSRF.
A parameter being passed directly into `Http` can likely lead to SSRF.
This could allow an attacker to send data to their own server, potentially exposing sensitive data
sent with this request.
They could also probe internal servers or other resources that the server runnig this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts hardcode the correct
They could also probe internal servers or other resources that the server running this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or hardcode the correct
host.
metadata:
cwe:
Expand Down

0 comments on commit 1032ff0

Please sign in to comment.