Motivation:
Enable warnings as errors on Swift 6.0 to lock-in strict concurrency
safety.
Modifications:
Enable warnings as errors on Swift 6.0 to lock-in strict concurrency
safety.
Result:
CI will fail if we encounter strict concurrency warnings on Swift 6.0
Motivation:
* Improve test coverage
Modifications:
Enable macOS CI to be run on pull request commits and make the use of
the nightly runner pool for main.yml jobs explicit.
Result:
Improved test coverage.
Motivation:
* Improve test coverage
* Check test pass/fail status
* Monitor CI throughput
Modifications:
Enable macOS CI to be run on all merges to main and on a daily timer.
Result:
Improved test coverage run out-of-band at the moment so we can get a
feeling for if any changes need to be made in the repo or in the CI
pipelines to ensure timely and stable checks.
## Summary
Allocations regressed by 3 around Feb 2, 2025. While that's being
investigated, let's get CI back to green by bumping the threshold
temporarily.
## Test Plan
CI should pass again.
Motivation:
When we dropped 5.8 support we didn't raise the tools version. The
result is that 5.8 compilers still resolve newer versions, including
2.29.1. Unfortunately, 2.29.1 doesn't compile.
Modifications:
Lift the tools version to 5.9
Result:
Users won't accidentally resolve this from 5.8.
Motivation:
Nightly CI builders need all the imports to be correct, and we were
missing a NIOCore import in the tests.
Modifications:
import NIOCore
Result:
Nice builds in the 6.1 nightlies
Motivation:
swift-nio-ssl has long had a flag to disable its own certificate
validation behaviour. This flag works fine, and had the desired effect.
However, this flag did not take account of the fact that
Security.framework _also_ validates the hostname. Due to an
implementation bug, setting .noHostnameVerification disabled only one of
the two checks.
Modifications:
- Correctly check the flag before passing a hostname to
Security.framework
- Write some tests to make sure the behaviour works in all modes.
Result:
Better, more consistent behaviour.
Motivation:
The sslContextCallback overrides modify the SSL_CTX object itself.
That's not useful: in addition to having a global effect, which is
rarely what we want, certain modifications don't apply that late, and
setting the credentials is one of them. The result is that the callback
didn't actually do anything. Not that useful.
Modifications:
- Extract the cert chain setting functions from NIOSSLContext and move
them to general-purpose functions.
- Add support there for calling them on a SSL * as well as on a SSL_CTX
*
- Call them in an override function on SSLConnection
- Call that!
- Add a bunch of tests.
Result:
The callback actually does what it should.
Enable MemberImportVisibility check on all targets. Use a standard
string header and footer to bracket the new block for ease of updating
in the future with scripts.
## Motivation
It would be handy to provide an API to create PKCS#12 files from a list
of `NIOSSLCertificates` and a `NIOSSLPrivateKey`.
This would be particularly useful when dealing with
Network.framework/NIOTransportServices/Security.framework, which use
`SecIdentity`s for SSL. Two particular use cases are
https://github.com/apple/swift-nio-ssl/issues/484#issuecomment-2410375188
and `grpc-swift-nio-transport`, which would use this API for testing the
NIOTS transport implementation.
## Modifications
This PR adds a static method to `NIOSSLPKCS12Bundle` that creates a
PKCS#12 file from the given array of certificates + private key, and
returns it as an array of bytes.
## Result
PKCS#12 files can be created using NIOSSL.
### Motivation:
* `main.yml` and `scheduled.yml` are mostly duplicative.
* Scheduled runs failed because of a deprecated reference to a Swift 5.8
pipeline
### Modifications:
* Unify `main.yml` and `scheduled.yml`
* Remove the reference to the 5.8 pipeline
### Result:
Working scheduled runs.
### Motivation:
This will allow us to decommission the old CI hooks.
### Modifications:
* Migrate the existing tests to use the package-benchmark framework.
* Delete the obsolete integration tests
* Remove allocations test references from the docker files.
### Result:
Allocation counts are checked using GitHub Actions.
Migrate CI to use GitHub Actions.
### Motivation:
To migrate to GitHub actions and centralised infrastructure.
### Modifications:
Changes of note:
* Disable warnings-as-errors until issues with recent NIO changes are
resolved
* Adopt swift-format using rules from SwiftNIO
* Remove scripts which are no longer needed
### Result:
Feature parity with old CI minus allocation tests which remain on the
old CI.
This PR adds the support to specify what ECs the handler supports when
doing the handshake.
```swift
var config = TLSConfiguration.makeClientConfiguration()
config.curves = [.x25519]
```
This patch has 3 parts: a commit to update the vendoring script, a
commit that contains the results of running the script, and then a fixup
for the API breaks we got.
Update expired test certificate.
### Motivation:
An expired test certificate was causing tests to fail.
### Modifications:
Updated the test certificate.
### Result:
Tests should pass.
Motivation:
swift build warns when the privacy manifest isn't a package resource.
Modifications:
- Add it do the excluded files when it isn't a resource
Result:
- Resolves#466
Hello,
As I was trying to implement some HTTP calls using `async-http-client`
and TLS-PSK authentication, I realised that my server was not sending
any PSK hint.
The actual implementation of the clientPSKCallback makes the server psk
hint mandatory.
Similarly the implementation of the serverPSKCallback makes the server
hint mandatory.
Reading
[RFC4279](https://datatracker.ietf.org/doc/html/rfc4279#section-5.2) it
seems that on the opposite the server psk hint should be provided only
on application that mandate it.
> [5.2](https://datatracker.ietf.org/doc/html/rfc4279#section-5.2).
Identity Hint
> In the absence of an application profile specification specifying
> otherwise, servers SHOULD NOT provide an identity hint and clients
> MUST ignore the identity hint field. Applications that do use this
> field MUST specify its contents, how the value is chosen by the TLS
> server, and what the TLS client is expected to do with the value.
I made this PR to provide an empty string to the callbacks in the case
the server doesn't provide one.
Providing an optional might be a better solution in term of semantic but
it would break the API.
---------
Co-authored-by: Martial Lienert <mlienert@netatmo.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
The NIOSSLHandler can enter a spin loop in `doUnbufferActions` if
writing data into BoringSSL fails with SSL_ERROR_WANT_READ or
SSL_ERROR_WANT_WRITE.
One way these errors can happen is if a write into BoringSSL happens
prior to the handshake completing. The NIOSSLHandler is explicit about
starting the handshake: it's done in channel active and in handler added
if the channel is already active.
However, the handshaking step is currently done without any state
checking, so if the state is 'closed' (as it would be after channel
inactive) then the handshake will still start. This can happen if
channel inactive happens before channel active.
To reach the write loop there must be a buffered write and flush prior
to the handshake step starting and the state isn't 'idle' or
'handshaking'. This can happen if a write and flush hapens while
'NIOSSLHandler' is in 'channelActive' (it forwards the 'channelActive'
event _before_ starting the handshake) and 'channelInactive' came first.
Modifications:
- Early exit from 'doHandshakeStep' if the state isn't applicable for
starting a handshake.
- Don't buffer writes when the state is 'closed' as they'll never
succeed and can be failed immediately.
- If the write isn't succesful in 'doUnbufferActions' then either write
to the network or try reading.
- Only allow a limited number of spins through 'doUnbufferActions'
Result:
- Resolves https://github.com/apple/swift-nio-ssl/issues/467
Motivation:
Per @jakepetroules, swift-build copies symlinks as-is into resource
bundles. That means these symlinks are dead when built with swift-build.
There's sort of no point in that.
Modifications:
Remove symlinks, replace with files.
Result:
Privacy info works.
swift-nio-ssl expects file to in specific format when loading the PrivateKey from a file baed on the extension of the file. This is prone to errors, since there is no standard agreement on the extension and format of the file.
An example of a mismatch is `.key` swift-nio-ssl tries to load such file as DER, though these can be in PEM format too.
We could based on the binary contents of the file provided infer the format of the file, but it doesn't seem like a logic this library should own. The clients should be able to load the file themselves.
In this PR `.file` case is marked deprecated and relevant deprecation flags and documentation is added to point to the preferred option.
Motivation:
A leaf certificate used for testing certificate verification only on
Darwin platforms had expired.
Modifications:
Update the cert
Result:
Tests pass
Motivation:
When the private key file for a TLS configuration has an unknown type, the program crashes. Hence, users are unable to catch the error.
Modifications:
A new error was added to `NIOSSLExtraError` and the program throws that error instead of crashing.
Result:
The program now throws an error instead of crashing.
Motivation:
NIOSSL distributes a copy of BoringSSL, which means it needs a privacy
manifest.
Modifications:
- Add a privacy manifest
Result:
NIOSSL shouldn't be rejected from app submission by not declaring a
privacy manifest.