oscerd commented on code in PR #27945:
URL: https://github.com/apache/camel/pull/27945#discussion_r4294545972


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -523,6 +523,22 @@ registered.
 To restore the previous behaviour, set `webhookSecretTokenEnabled=false`: the 
webhook is then registered without a
 secret token, and webhook requests are not verified.
 
+=== camel-netty-http - the security constraint resolves dot-segments in the 
request path
+
+A `netty-http` consumer configured with a `securityConstraint` now resolves 
`.` and `..` segments in the request path
+(including their percent-encoded `%2e` form) before the path is matched 
against the configured inclusions and exclusions,
+following the `remove_dot_segments` algorithm of RFC 3986. The constraint is 
therefore evaluated against the effective
+resolved path, which is the same resource the request is routed to. Excess 
`..` segments cannot climb above the endpoint
+context root.
+

Review Comment:
   Good catch — corrected in `9eac35f93c84`. `removeDotSegments` normalizes 
against the string root, with no knowledge of the endpoint context (the 
`/foo/../../admin/x → /admin/x` row shows it), so the guide now reads "cannot 
climb above the root", matching the Javadoc.
   
   _Claude Code on behalf of oscerd_
   



##########
components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandlerDotSegmentTest.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty.http.handlers;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * The security constraint is evaluated against the effective resolved 
resource path, so {@code .} and {@code ..}
+ * segments are removed (RFC 3986 section 5.2.4) before the target is matched 
against the configured inclusions. Excess
+ * {@code ..} segments cannot climb above the root, so the result never 
contains a {@code ..} segment.
+ */
+class HttpServerChannelHandlerDotSegmentTest {
+
+    @ParameterizedTest
+    @CsvSource(delimiter = '|', textBlock = """
+            # input                 | expected
+            /foo/admin/x            | /foo/admin/x
+            /foo/./admin/x          | /foo/admin/x
+            /foo/../admin/x         | /admin/x
+            /foo/../../admin/x      | /admin/x
+            /foo/sub/../admin/x     | /foo/admin/x
+            /foo/a/../../../admin   | /admin
+            /foo/admin/.            | /foo/admin/
+            /foo/admin/..           | /foo/
+            /..                     | /
+            /admin/file.txt         | /admin/file.txt
+            /                       | /
+            """)

Review Comment:
   Added both in `9eac35f93c84`:
   - `/app/../admin/x → /admin/x` — shows the resolution is independent of the 
context-path name.
   - `/admin/.hidden/secret` — unchanged, since a leading-dot file name is not 
a `.`/`..` segment.
   
   The unit table is now 13 rows, all green.
   
   _Claude Code on behalf of oscerd_
   



-- 
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]

Reply via email to