Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Augment RETRY validation token #26048

Closed

Conversation

andrewkdinh
Copy link
Contributor

@andrewkdinh andrewkdinh commented Nov 25, 2024

Adds fields to the QUIC RETRY packet validation token: timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client. Checks that the client address matches and that the token isn't expired (10 seconds for tokens from RETRY packets and 60 minutes for tokens from NEW_TOKEN packets, which may be configurable in the future).

Loosely based on quic-go: https://github.com/quic-go/quic-go/blob/master/internal/handshake/token_generator.go

Currently, a few tests never complete because the server receives the initial request but is unable to fetch the remote address of the client to create the RETRY token (the remote address of the peer is always NULL, which I'm assuming is an issue with the test itself). I'm currently working on resolving this: openssl/project#933

Note that this does not encrypt the token yet (openssl/project#928). Also, NEW_TOKEN_packets aren't sent by the server yet (openssl/project#929).

Fixes openssl/project#912

Checklist
  • documentation is added or updated
  • tests are added or updated

@andrewkdinh andrewkdinh force-pushed the naive-token branch 2 times, most recently from d4170c8 to e74f02d Compare November 25, 2024 00:22
@andrewkdinh
Copy link
Contributor Author

I believe the failing coding style check is a known issue. It complains whether or not I have a { for the else if statement.

    if (hdr.token == NULL) {
        port_send_retry(port, &e->peer, &hdr);
        goto undesirable;
    } else if (port_validate_token(&hdr, port, &e->peer, &odcid, &scid) != 1)
        goto undesirable;

@andrewkdinh
Copy link
Contributor Author

andrewkdinh commented Nov 26, 2024

Most recent force-push rebases this branch on top of the changes from #26066. CI will not pass yet, as I need to update the data files for quicapitest.

Also adds a check to check the new DCID against one in the header to completely replace #26067. @nhorman

@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label Nov 27, 2024
@andrewkdinh andrewkdinh force-pushed the naive-token branch 3 times, most recently from a482921 to aaff6d4 Compare November 27, 2024 00:17
@nhorman
Copy link
Contributor

nhorman commented Nov 27, 2024

I believe the failing coding style check is a known issue. It complains whether or not I have a { for the else if statement.

    if (hdr.token == NULL) {
        port_send_retry(port, &e->peer, &hdr);
        goto undesirable;
    } else if (port_validate_token(&hdr, port, &e->peer, &odcid, &scid) != 1)
        goto undesirable;

The failure is because of the lack of braces around the else clause. Coding style has a rule that says, in an of/else pair, if you need curly braces around either branch, you should add them around both

@andrewkdinh andrewkdinh force-pushed the naive-token branch 2 times, most recently from 118bae4 to 19d4fc7 Compare November 27, 2024 00:59
@andrewkdinh
Copy link
Contributor Author

@nhorman The style check fails whether or not I have the curly braces around the else if statement (which is what I have currently)

Copy link
Contributor

@Sashan Sashan left a comment

Choose a reason for hiding this comment

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

I think changes are heading in right direction. Some of my suggestion can be done in follow-up PR.

@nhorman nhorman added the style: waived exempted from style checks label Nov 27, 2024
@andrewkdinh
Copy link
Contributor Author

Implemented all the suggested changes. Please re-review @Sashan @nhorman

@t8m
Copy link
Member

t8m commented Dec 9, 2024

@mattcaswell @nhorman please reconfirm

@nhorman
Copy link
Contributor

nhorman commented Dec 9, 2024

ack, approval holds

@andrewkdinh andrewkdinh added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Dec 9, 2024
Copy link
Contributor

@Sashan Sashan left a comment

Choose a reason for hiding this comment

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

I think this should go in. looks good to me.

@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Dec 10, 2024
@openssl-machine
Copy link
Collaborator

This pull request is ready to merge

@t8m
Copy link
Member

t8m commented Dec 10, 2024

Squashed and merged to the feature branch. Thank you.

@t8m t8m closed this Dec 10, 2024
openssl-machine pushed a commit that referenced this pull request Dec 10, 2024
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #26048)
nhorman pushed a commit to nhorman/openssl that referenced this pull request Jan 7, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
nhorman pushed a commit to nhorman/openssl that referenced this pull request Jan 9, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
nhorman pushed a commit to nhorman/openssl that referenced this pull request Jan 11, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
nhorman pushed a commit to nhorman/openssl that referenced this pull request Feb 4, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
nhorman pushed a commit that referenced this pull request Feb 7, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #26048)
andrewkdinh added a commit to andrewkdinh/openssl that referenced this pull request Feb 14, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
@andrewkdinh andrewkdinh deleted the naive-token branch February 14, 2025 11:49
nhorman pushed a commit to nhorman/openssl that referenced this pull request Feb 14, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
nhorman pushed a commit to nhorman/openssl that referenced this pull request Feb 14, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
nhorman pushed a commit that referenced this pull request Feb 17, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #26048)
nhorman pushed a commit to nhorman/openssl that referenced this pull request Feb 17, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
Sashan pushed a commit to vdukhovni/openssl that referenced this pull request Feb 19, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
definability pushed a commit to definability/openssl that referenced this pull request Feb 25, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
quarckster pushed a commit to quarckster/openssl-fork that referenced this pull request Feb 27, 2025
Adds fields to the QUIC RETRY packet validation token:
timestamp, remote_addr, odcid, & rscid.

Also adds functionality to validate the token once returned by the client.

Note that this does not encrypt the token yet.

Also check that the RSCID stored in the RETRY validation
token matches the DCID in the header.

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#26048)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge style: waived exempted from style checks tests: deferred Tests will be added in a subsequent PR (label should be removed when the PR with tests is merged) triaged: feature The issue/pr requests/adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows CI fix Fix remaining issues in our token enhancement (from #912)
6 participants