moresandeep commented on code in PR #1554:
URL: https://github.com/apache/knox/pull/1554#discussion_r4756325838
##########
gateway-provider-security-authz-path-acls/src/main/java/org/apache/knox/gateway/filter/PathAclCanonicalizer.java:
##########
@@ -22,12 +22,21 @@
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
final class PathAclCanonicalizer {
+ /* Marks the end of the scheme; the path starts at the first '/' after it. */
private static final String SCHEME_SEPARATOR = "://";
+ /* Produced by the decoder for invalid UTF-8; its presence rejects the path.
*/
private static final char REPLACEMENT_CHARACTER = '\uFFFD';
- private static final Pattern DOT_SEGMENT_WITH_PARAMETER =
Pattern.compile("(^|/)\\.{1,2};");
+ /* A ';' matrix parameter up to the next '/', e.g. ";x=1" in "/a;x=1/b";
stripped from each segment. */
+ private static final Pattern PARAMETER = Pattern.compile(";[^/]*");
+ /* An encoded ';' anywhere in the raw path; rejected because backends
disagree on whether it starts a parameter. */
+ private static final Pattern ENCODED_SEMICOLON = Pattern.compile("%3[Bb]");
+ /* An encoded '/' or '\', or a raw '\', inside a parameter; rejected because
it changes the path depending on
+ whether a backend strips parameters before or after decoding. */
+ private static final Pattern AMBIGUOUS_PARAMETER_CHAR =
Pattern.compile("%2[Ff]|%5[Cc]|\\\\");
Review Comment:
So, will this work?
`https://localhost:8443/gateway/sandbox/datanode/datanode.html?host=http%3A%2F%2Flocalhost%3A9864/foo/bar¶m=123`
or
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]