tquic icon indicating copy to clipboard operation
tquic copied to clipboard

issues 223: Support greasing the QUIC Bit

Open Chi-Kai opened this issue 4 months ago • 1 comments

Overview

This PR implements RFC 9287 "Greasing the QUIC Bit" to enhance QUIC protocol privacy and prevent network ossification. The implementation allows endpoints to negotiate the ability to randomize the second-most significant bit (QUIC bit) in QUIC packets.

Issue

Fixes #223

RPC 9287

RFC 9287 addresses the problem that QUIC packets are easily identifiable because the "QUIC bit" (0x40) is always set to 1. This implementation:

  • Prevents ossification: Keeps the QUIC bit available for future protocol extensions
  • Enhances privacy: Makes QUIC traffic less identifiable to passive observers
  • Maintains compatibility: Only activates when both endpoints support it

Details

  1. Transport Parameter Negotiation (src/trans_param.rs) - Added grease_quic_bit field to TransportParams - Implemented parameter ID 0x2ab2 encoding/decoding - Added validation for empty parameter value requirement
  2. Configuration API (src/lib.rs) - Added Config::enable_grease_quic_bit() method - Added configuration field with default false - Added comprehensive documentation
  3. Connection Management (src/connection/connection.rs) - Added bilateral negotiation logic - Added connection state tracking for greasing capability - Added public API grease_quic_bit_enabled()
  4. Packet Processing (src/packet.rs) - Added QUIC bit randomization inencrypt_packet() - Implemented 50% probability randomization - Added safety checks for packet types

Chi-Kai avatar Jul 08 '25 09:07 Chi-Kai

Codecov Report

:x: Patch coverage is 98.88889% with 1 line in your changes missing coverage. Please review. :white_check_mark: Project coverage is 94.74%. Comparing base (b62863a) to head (27882d0).

Files with missing lines Patch % Lines
src/packet.rs 88.88% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #473      +/-   ##
===========================================
+ Coverage    94.72%   94.74%   +0.01%     
===========================================
  Files           50       50              
  Lines        30282    30371      +89     
===========================================
+ Hits         28685    28774      +89     
  Misses        1597     1597              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Jul 08 '25 12:07 codecov-commenter