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

advancedTLS: Rename {Min/Max}Version to {Min/Max}TLSVersion #7173

Merged
merged 6 commits into from
May 6, 2024

Conversation

gtcooke94
Copy link
Contributor

@gtcooke94 gtcooke94 commented Apr 30, 2024

This PR renames the MinVersion and MaxVersion on ClientOptions and ServerOptions to MinTLSVersion and MaxTLSVersion to make it clear that this field represents the TLS version.

It also adds logic to set the default min and max to TLS12 and TLS13 respectively, and a tests for that logic.
Previously our code comments indicated this was the default, but we really just delegated to the defaults of the crypto/tls package (which are currently the same). Now we explicitly set to the defaults that we say we do, rather than depending on a dependency's defaults to match ours.

RELEASE NOTES: none

@gtcooke94 gtcooke94 requested a review from erm-g April 30, 2024 20:22
@gtcooke94 gtcooke94 added the Type: Internal Cleanup Refactors, etc label Apr 30, 2024
@gtcooke94 gtcooke94 added this to the 1.64 Release milestone Apr 30, 2024
@erm-g erm-g self-requested a review May 1, 2024 14:58
@gtcooke94 gtcooke94 requested a review from dfawley May 1, 2024 15:48
@gtcooke94 gtcooke94 assigned dfawley and unassigned erm-g May 1, 2024
security/advancedtls/advancedtls.go Outdated Show resolved Hide resolved
Comment on lines +228 to +230
// client, and TLS 1.0 when acting as a server. TLS 1.0 is the minimum
// supported by this package, both as a client and as a server. This
// default may be changed over time affecting backwards compatibility.
Copy link
Member

Choose a reason for hiding this comment

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

Are we reserving the right to override the user's setting? Like if they set 1.0 and we decide to set the min to 1.2, then we'll automatically upgrade them? Or no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so - if we decide to change the minimum supported version from 1.0 to 1.2, I think we'd add in a check that throws an error rather than override the user setting.

Copy link
Member

Choose a reason for hiding this comment

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

That's fine. It seems like when they made a change like this in Go's tls package they added an env var so users could get the old 1.0-default behavior back (just FYI).

Also, I assume this is supposed to be a tls.VersionTLSxx value? (I wish they had made a type name for it.) That might be worth documenting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we could explore adding an env var like that down the line if it ever happens that we need it
Added notes in the docs about using tls.VersionTLSxx

Copy link
Member

Choose a reason for hiding this comment

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

Added notes in the docs about using tls.VersionTLSxx

What doc? The godocs? If so, I think you forgot to push the change. It seems worth documenting in these comments, since this isn't inside the tls package, but I won't argue too strongly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops I didn't actually push the change to my remote branch, done now

security/advancedtls/advancedtls.go Outdated Show resolved Hide resolved
security/advancedtls/advancedtls.go Show resolved Hide resolved
@dfawley dfawley assigned gtcooke94 and unassigned dfawley May 2, 2024
@gtcooke94 gtcooke94 requested review from dfawley and erm-g May 3, 2024 17:53
@gtcooke94 gtcooke94 removed their assignment May 3, 2024
@dfawley dfawley assigned gtcooke94 and unassigned dfawley May 6, 2024
@gtcooke94 gtcooke94 merged commit befc29d into grpc:master May 6, 2024
12 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants