Copilot commented on code in PR #13966:
URL: https://github.com/apache/trafficserver/pull/13966#discussion_r4523566617
##########
src/iocore/net/QUICPacketHandler.cc:
##########
@@ -277,14 +277,18 @@ QUICPacketHandlerIn::_recv_packet(int /* event ATS_UNUSED
*/, UDPPacket *udp_pac
return;
}
+ // quiche takes a non-empty original DCID as proof that this server sent a
Retry and lifts the anti-amplification limit for
+ // the peer's address, so it may only come from a token validated above.
+ QUICConnectionId const retry_odcid = params->stateless_retry() ?
retry_token.original_dcid() : QUICConnectionId::ZERO();
Review Comment:
`QUICConnectionId::ZERO()` needs to be guaranteed to have `length() == 0`,
otherwise this still passes a non-empty ODCID to quiche (contradicting the
comment) and could continue to lift the anti-amplification limit. Make the “no
ODCID” case unambiguously zero-length (e.g., construct an explicitly empty
connection ID / ensure ZERO() is defined as empty-length, not a 1-byte 0 ID).
##########
tests/uranium_tests/h3/py_h3_client/token_handshake.py:
##########
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+#
+# 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.
+"""Complete a QUIC handshake with ATS while offering a token it did not
issue."""
+
+from __future__ import annotations
+
+import argparse
+import asyncio
+import ssl
+
+from aioquic.asyncio.client import connect
+from aioquic.h3.connection import H3_ALPN
+from aioquic.quic.configuration import QuicConfiguration
+
+# Laid out like a retry token whose original DCID is 4 bytes long, but with a
+# MAC ATS never computed, so the server has no reason to trust any of it.
+UNISSUED_TOKEN = bytes([1]) + bytes(32) + bytes([4]) + b"odci" + bytes([0])
+
+
+async def async_main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--addr", required=True, help="ATS HTTP/3 address in
host:port form")
+ parser.add_argument("--server-name", required=True, help="TLS SNI server
name")
+ args = parser.parse_args()
+
+ host, port_text = args.addr.rsplit(":", 1)
Review Comment:
Parsing `host:port` via `rsplit(':', 1)` won’t handle IPv6 literals (even
though this test uses 127.0.0.1 today). Consider accepting bracketed IPv6
(`[::1]:443`) and parsing accordingly (or use a helper that supports both
IPv4/IPv6) to make the script more robust as a reusable test tool.
##########
src/iocore/net/QUICPacketHandler.cc:
##########
@@ -277,14 +277,18 @@ QUICPacketHandlerIn::_recv_packet(int /* event ATS_UNUSED
*/, UDPPacket *udp_pac
return;
}
+ // quiche takes a non-empty original DCID as proof that this server sent a
Retry and lifts the anti-amplification limit for
+ // the peer's address, so it may only come from a token validated above.
Review Comment:
These comment lines are very long; please wrap them to the project’s typical
line length to keep diffs readable and match existing style in this file.
##########
tests/uranium_tests/h3/test_h3_client_token.py:
##########
@@ -0,0 +1,91 @@
+# 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.
+
+from pathlib import Path
+import sys
+
+import pytest
+
+from tools.uranium.services import ATS, ATSFactory, ProcessService,
ServiceFactory
+
+TEST_DIRECTORY = Path(__file__).parent
+
+
+def configure_ats(ats_factory: ATSFactory) -> ATS:
+ """Configure a quiche QUIC listener that does not send Retry packets.
+
+ :param ats_factory: Factory for isolated Traffic Server instances.
+ """
+
+ ats = ats_factory.create("ts-h3-client-token", enable_tls=True,
enable_quic=True, enable_cache=False)
+ if not ats.has_feature("TS_HAS_QUICHE"):
+ pytest.skip("ATS with QUICHE is required")
+ ats.set_startup_timeout(60)
+ ats.add_default_ssl_files()
+ ats.ssl_multicert_config.add_lines(
+ (
+ "ssl_multicert:",
+ ' - dest_ip: "*"',
+ " ssl_cert_name: server.pem",
+ " ssl_key_name: server.key",
+ ))
+ ats.records.update(
+ {
+ "proxy.config.diags.debug.enabled": 1,
+ "proxy.config.diags.debug.tags": "quic",
+ "proxy.config.quic.server.stateless_retry_enabled": 0,
+ })
Review Comment:
Enabling `proxy.config.diags.debug.enabled` for the whole test run can
significantly increase log volume (and sometimes CI time) across a suite.
Consider removing these debug settings or gating them behind an env var /
test-level flag so they’re only enabled when explicitly troubleshooting.
--
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]