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

Actually disable hostname validation on Apple platforms when asked #502

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Jan 2, 2025

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:

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.
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Jan 2, 2025
@Lukasa Lukasa marked this pull request as ready for review January 2, 2025 18:26
@Lukasa Lukasa merged commit 94d63e7 into apple:main Jan 3, 2025
37 checks passed
@Lukasa Lukasa deleted the cb-fix-disabling-hostname-validation branch January 3, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants