oscerd commented on code in PR #27945:
URL: https://github.com/apache/camel/pull/27945#discussion_r4316355421
##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java:
##########
@@ -223,14 +239,79 @@ private String extractTarget(URI uri) {
// strip the starting endpoint path so the target is relative to the
endpoint uri.
// the comparison must ignore case on the context-path, the same way
consumer dispatch does
// (RestConsumerContextPathMatcher), so the security constraint is
evaluated against the same
- // normalized target the request is actually routed to
+ // target the request is actually routed to
String path = consumer.getConfiguration().getPath();
if (path != null &&
target.toLowerCase(Locale.US).startsWith(path.toLowerCase(Locale.US))) {
target = target.substring(path.length());
}
return target;
}
+ /**
+ * Whether the path contains a {@code .} or {@code ..} segment that path
normalization would resolve. Such a path is
+ * resolved differently by the security constraint, the consumer dispatch
and the route, so it is rejected up front
Review Comment:
Aligned in `874be1ef28ad` — this Javadoc now reads "may be interpreted
differently", consistent with the code comment and the upgrade-guide note.
Thanks for catching the two stragglers.
_Claude Code on behalf of oscerd_
##########
components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpBasicAuthConstraintDotSegmentTest.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * 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;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit6.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * A request path containing {@code .} or {@code ..} segments is resolved
differently by the security constraint, the
Review Comment:
Aligned in `874be1ef28ad` — this Javadoc now reads "may be interpreted
differently", consistent with the code comment and the upgrade-guide note.
Thanks for catching the two stragglers.
_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]