Copilot commented on code in PR #13519:
URL: https://github.com/apache/trafficserver/pull/13519#discussion_r3738567361
##########
src/iocore/net/quic/QUICTypes.cc:
##########
@@ -723,17 +723,22 @@ QUICConnectionId::ZERO()
return QUICConnectionId(zero, 0);
}
-QUICConnectionId::QUICConnectionId()
-{
- this->randomize();
-}
-
QUICConnectionId::QUICConnectionId(const uint8_t *buf, uint8_t len) : _len(len)
{
ink_assert(len <= QUICConnectionId::MAX_LENGTH);
memcpy(this->_id, buf, std::min(static_cast<int>(len),
QUICConnectionId::MAX_LENGTH));
}
+QUICConnectionId
+QUICConnectionId::random()
+{
+ uint8_t id[MAX_LENGTH] = {0};
+
+ ink_release_assert(SCID_LEN <= MAX_LENGTH);
+ ink_release_assert(RAND_bytes(id, SCID_LEN) == 1);
+ return {id, SCID_LEN};
+}
Review Comment:
QUICConnectionId::random() uses ink_release_assert on RAND_bytes() failure,
which will hard-abort Traffic Server if the OpenSSL RNG fails (e.g.,
misconfiguration/FIPS/provider issues). Other QUIC/OpenSSL code paths treat
RAND_bytes failure as a recoverable error (e.g., QUIC token key generation
returns false and logs). Consider returning an error/optional and letting
callers fail the handshake gracefully rather than crashing the process.
--
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]