Skip to content

Commit 83a55ce

Browse files
authored
Update SSRF sandbox control message to be more explicit (#442)
A user requested that the SSRF codemod present a more clear, explicit explanation of what the change will do.
1 parent eb9084a commit 83a55ce

File tree

1 file changed

+1
-1
lines changed
  • core-codemods/src/main/resources/io/codemodder/codemods/SSRFCodemod

1 file changed

+1
-1
lines changed

core-codemods/src/main/resources/io/codemodder/codemods/SSRFCodemod/report.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"summary" : "Sandboxed URL creation to prevent SSRF attacks",
33
"control" : "https://github.com/pixee/java-security-toolkit/blob/main/src/main/java/io/github/pixee/security/Urls.java",
4-
"change": "Wrapped the URL creation with a method that forces the caller to pick allowed protocols and domains that this URL can reach",
4+
"change": "Added a control method that limits the protocols to HTTP(S) and limits the host to non-infrastructure targets (e.g., blocks AWS metadata hosts, typical network gateway addresses.)",
55

66
"reviewGuidanceJustification" : "By default, the protection only weaves in 2 checks, which we believe will not cause any issues with the vast majority of code:\n* The given URL must be HTTP/HTTPS.\n* The given URL must not point to a \"well-known infrastructure target\", which includes things like AWS Metadata Service endpoints, and internal routers (e.g., 192.168.1.1) which are common targets of attacks.\n\nHowever, on rare occasions an application may use a URL protocol like \"file://\" or \"classpath://\" in backend or middleware code.\n\nIf you want to allow those protocols, change the incoming PR to look more like this and get the best security possible:\n\n```\n-URL u = new URL(url);\n+Set<UrlProtocol> fileProtocols = Set.of(UrlProtocol.FILE, UrlProtocol.CLASSPATH);\n+URL u = Urls.create(url, fileProtocols);\n```",
77

0 commit comments

Comments
 (0)