[
https://issues.apache.org/jira/browse/KNOX-3607?focusedWorklogId=1057897&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1057897
]
ASF GitHub Bot logged work on KNOX-3607:
----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Dec/26 15:01
Start Date: 01/Dec/26 15:01
Worklog Time Spent: 10m
Work Description: hanicz commented on code in PR #1554:
URL: https://github.com/apache/knox/pull/1554#discussion_r4756105404
##########
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:
This is only for matrix parameters ;x=1
Issue Time Tracking
-------------------
Worklog Id: (was: 1057897)
Time Spent: 1h 10m (was: 1h)
> Harden PathAcls
> ---------------
>
> Key: KNOX-3607
> URL: https://issues.apache.org/jira/browse/KNOX-3607
> Project: Apache Knox
> Issue Type: Task
> Components: Server
> Affects Versions: 3.0.0, 2.1.1
> Reporter: Tamás Hanicz
> Assignee: Tamás Hanicz
> Priority: Major
> Fix For: 2.1.2, 3.0.1
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)