Skip to content

Commit c829f11

Browse files
committed
See an address range list kept beside the check, and say what is_global misses
The PHP shared range rule now accepts a 100.64.0.0/10 check kept in a class constant and tested by another method, which is how a careful fix is often written, instead of reporting the fixed code again. The Python rule's advice now says that is_global still calls multicast and the NAT64 prefix public, so following it does not leave those open.
1 parent 33202f1 commit c829f11

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎config/semgrep-extra.yaml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,8 @@ rules:
14951495
message: This address check blocks private addresses with is_private, which is False for the
14961496
100.64.0.0/10 shared range (carrier grade NAT). Cloud metadata services and internal hosts
14971497
live there, so a URL that resolves to one passes the check. Accept an address only when
1498-
is_global is True, which also refuses link local, reserved and loopback ranges.
1498+
is_global is True and it is neither multicast nor inside the NAT64 prefix 64:ff9b::/96,
1499+
which is_global still calls public.
14991500
metadata:
15001501
cwe: 'CWE-918: Server-Side Request Forgery (SSRF)'
15011502
category: security
@@ -1572,6 +1573,19 @@ rules:
15721573
<... '100.64.' ...>;
15731574
...
15741575
}
1576+
# The ranges kept in a class constant and checked by another method.
1577+
- pattern-not-inside: |
1578+
class $C {
1579+
...
1580+
const $K = [..., '100.64.0.0/10', ...];
1581+
...
1582+
}
1583+
- pattern-not-inside: |
1584+
class $C {
1585+
...
1586+
const $K = [..., "100.64.0.0/10", ...];
1587+
...
1588+
}
15751589
- id: gcr-proxy-trusted-from-anywhere
15761590
languages:
15771591
- generic

0 commit comments

Comments
 (0)