Skip to content

Fix 0-RTT enforcement for resume-only servers - #6475

Open
Gaurav Singh (gaurav2699) wants to merge 2 commits into
mainfrom
fix/resume-only-0rtt-policy
Open

Gaurav Singh (gaurav2699) wants to merge 2 commits into
mainfrom
fix/resume-only-0rtt-policy

Conversation

@gaurav2699

@gaurav2699 Gaurav Singh (gaurav2699) commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Separate TLS session resumption from server 0-RTT permission.

  • Disable early-data advertisement and acceptance unless the effective policy is QUIC_SERVER_RESUME_AND_ZERORTT.
  • Reject resumption tickets when the effective policy is QUIC_SERVER_NO_RESUME.
  • Add core defense-in-depth enforcement for server 0-RTT packets.
  • Add regression coverage for stale tickets under RESUME_ONLY and per-connection NO_RESUME overrides.

ICM 31000000771364

Testing

Passed Windows Debug x64 builds:

  • pwsh .\scripts\build.ps1 -Config Debug -Arch x64 -Tls openssl
  • pwsh .\scripts\build.ps1 -Config Debug -Arch x64 -Tls quictls

For both providers, the following focused cases passed:

  • Existing nonempty 0-RTT acceptance
  • Invalid-ticket rejection
  • RESUME_ONLY early-data rejection with successful resumption
  • Per-connection NO_RESUME rejection
  • IPv4 and IPv6 policy-rejection cases

12 focused tests passed with no failures or skips.

Documentation

No documentation changes are required. The implementation now matches the documented server resumption-level behavior.

@gaurav2699
Gaurav Singh (gaurav2699) requested a review from a team as a code owner November 10, 2026 16:11
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.75%. Comparing base (6a3729a) to head (c83dd7c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6475      +/-   ##
==========================================
- Coverage   88.57%   86.75%   -1.82%     
==========================================
  Files          60       60              
  Lines       19139    19146       +7     
==========================================
- Hits        16953    16611     -342     
- Misses       2186     2535     +349     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

Server unidirectional 0-RTT may shut down before CONNECTED, so exact resumption validation belongs on the client.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dd711df3-c521-401a-8832-a4e2cffcc1bf

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to have another look at the product logic change itself, but I think that test improvements are needed.
This test is hard to work with already, but we cannot just add more to it.

Comment thread src/inc/quic_tls.h
typedef struct CXPLAT_TLS_CONFIG {

BOOLEAN IsServer;
BOOLEAN ServerEarlyDataEnabled;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to EarlyDataEnabled, and add a comment (the comment can mention server-only)

Status = QUIC_STATUS_TLS_ERROR;
goto Exit;
}
} else if (!(Config->SecConfig->TlsFlags & CXPLAT_TLS_CREDENTIAL_FLAG_DISABLE_RESUMPTION)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment and/or assertion to clarify that the code that follows in for client only.
Consider helper functions to split the logic in named blocks.

Comment thread src/test/MsQuicTests.h
Comment on lines +652 to +653
bool ResumeOnly;
bool NoResume;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two boolean overlap, it allows for a confusing configuration (ResumeOnly = true, NoResume = true).
Consider using ResumeEnabled / EarlyDataEnabled instead, or a single enum to represent 3 states.

Comment thread src/test/lib/DataTest.cpp
false, // ClientRebind
true, // ClientZeroRtt
true, // ServerRejectZeroRtt
Params.NoResume ? QUIC_SERVER_NO_RESUME :

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of parametrizing this test, which is hard to understand, consider having more tests.
The pattern here (test helper with way too many parameters) is a bad one we haven't been able to move away from yet, it leads to very hard to follow tests with large amount of code that is not needed for each individual scenario.

Parameters are better used for variants of the exact same scenario (IPv4 vs IPv6, ...), not for data that affect the validation logic. Said differently, if you test validate you can send data in many configuration, params for the configuration is fine. If your test try to validate that every configuration does what it is specifically meant to do (not just that data was sent/received), then a different test is needed for the specific scenario.

Otherwise, it becomes near impossible to understand which scenario is tested.
Here, we are in the Reject0Rtt test, but sometimes, we test that actually, the server does not reject 0Rtt?

Comment thread src/test/lib/DataTest.cpp

PingStats ServerStats(Length, ConnectionCount, TotalStreamCount, FifoScheduling, UnidirectionalStreams, ServerInitiatedStreams, ClientZeroRtt && !ServerRejectZeroRtt, false, QUIC_STATUS_SUCCESS);
PingStats ClientStats(Length, ConnectionCount, TotalStreamCount, FifoScheduling, UnidirectionalStreams, ServerInitiatedStreams, ClientZeroRtt && !ServerRejectZeroRtt);
const bool ExpectedResumed =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make this name clearer. The function is about everything in a connection. ExpectedResumed outside of the context of the PR is not that clear.

Comment thread src/test/lib/DataTest.cpp
ServerConfiguration,
ClientConfiguration,
&ClientStats.ResumptionTicket);
if (ServerResumptionLevel == QUIC_SERVER_RESUME_ONLY) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This likely should be in QuicTestPrimeResumption.
Why does the server need different settings when priming in this scenario? This is confusing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants