Skip to content

Af/optional min tls version#1037

Open
AntAmazonian wants to merge 10 commits into
mainfrom
af/optional_min_TLS_version
Open

Af/optional min tls version#1037
AntAmazonian wants to merge 10 commits into
mainfrom
af/optional_min_TLS_version

Conversation

@AntAmazonian
Copy link
Copy Markdown

@AntAmazonian AntAmazonian commented Mar 12, 2026

Add a new option to set TLS version.

Issue #

awslabs/aws-sdk-swift#567

Description of changes

Allow customers to set minimum TLS version.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Copy Markdown
Collaborator

@jbelkins jbelkins left a comment

Choose a reason for hiding this comment

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

Please remove all of the .xcscheme files from this PR. I recommend converting them to local Xcode config instead of shared:
https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project#Overview

(Uncheck "Shared" in the Manage Schemes dialog for each scheme file.)

case .tls10,
.tls11:
// Enforce a secure minimum; do not allow TLS 1.0 or 1.1, they have been deprecated.
urlsessionConfiguration.tlsMinimumSupportedProtocolVersion = .TLSv12
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.

Why is the minimum TLS 1.2 enforced on the URLSession-based client but not on the CRT-based client?

Also, we should provide some sort of notice to the customer that their TLS setting is not supported when they choose a version before TLS 1.2. Logging would probably be the best choice.

Copy link
Copy Markdown
Author

@AntAmazonian AntAmazonian Mar 25, 2026

Choose a reason for hiding this comment

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

Adding the Logger.error now, as for the enforcement difference between URLSession and CRT, my reasoning was that URLSession uses a security protocol version (from Apple I suspect) that already enforces it for macOS 12.0 so your systems platform should be able to trust but if you're using a macOS before 12.0 then this should stop the user as an added safety measure. CRT on the other hand does not set any minimum because it trust your OS set TLS.

case tls10 = "TLSv1.0"
case tls11 = "TLSv1.1"
case tls12 = "TLSv1.2"
case tls13 = "TLSv1.3"
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: use underscore in place of the period in case names, i.e. .tls1_2 instead of .tls12

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I corrected the case names.

Comment thread .gitignore
xcuserdata
**/xcshareddata
**/*.xcshareddata
xcshareddata
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.

Please remove these 3 lines from .gitignore, we actually do, in some cases, want to commit files in Xcode shared data (Not routinely, but in specific situations.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines removed

@jbelkins
Copy link
Copy Markdown
Collaborator

https://github.com/smithy-lang/smithy-swift/actions/runs/23259327495/job/67623151227?pr=1037#step:7:4834

@AntAmazonian The cause of your linux failures appears to be that the CRT library has to be initialized prior to use.

Try calling this in the setup function for the crashing test:

public static func initialize() {

See XCTestCase.setup() docs here:
https://developer.apple.com/documentation/xctest/xctestcase/setup()

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.

3 participants