You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accept MIME linear whitespace around filename= parameter in Content-Disposition
Tabs after ';' and optional SP/HT around '=' are valid per MIME and are
delivered by RESTEasy as-is; the previous parser only skipped literal spaces,
so those variants bypassed server.request.body.filenames detection.
Copy file name to clipboardExpand all lines: dd-java-agent/instrumentation/resteasy/resteasy-appsec-3.0/src/main/java/datadog/trace/instrumentation/resteasy/MultipartHelper.java
+28-18Lines changed: 28 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,12 @@ public static List<String> collectFilenames(MultipartFormDataInput ret) {
51
51
returnfilenames;
52
52
}
53
53
54
-
// Quote-aware: semicolons inside quoted filenames (e.g. filename="a;b.php") are not separators
54
+
// Quote-aware: semicolons inside quoted filenames (e.g. filename="a;b.php") are not separators.
55
+
// Outer loop: i advances to each ';' (skipping quoted strings to avoid treating their contents
56
+
// as delimiters), then past MIME linear whitespace (SP/HT) to the start of the parameter name.
57
+
// j is a lookahead used only to find '=' after optional whitespace without committing i until
58
+
// the parameter is confirmed to be "filename"; this avoids confusing "filename*" (RFC 5987) or
59
+
// other "filename"-prefixed parameter names with the plain "filename" parameter.
0 commit comments