Skip to content

Conversation

@onl1ner
Copy link
Member

@onl1ner onl1ner commented May 15, 2025

This PR introduces a new parameter evaluateAllHostsForTrust to the initializer of AlamofireClient. This parameter directly maps to allHostsMustBeEvaluated in Alamofire’s ServerTrustManager.

Previously, this value was hardcoded to true (as default value in ServerTrustManager initializer), which meant every host had to have a trust evaluator configured. This led to errors like: noRequiredEvaluator(host:). Even for hosts that weren’t meant to use SSL pinning. This made it difficult to use the client in more complex networking setups.

The new parameter defaults to true to preserve backward compatibility and is safe to include in a patch release as it does not break existing behavior.

TODO:

The current implementation of SSL pinning support in this library is fairly rigid. It tightly couples the usage of ServerTrustManager with PublicKeysTrustEvaluator, making it impossible to inject or configure alternative evaluators (e.g. certificate pinning, custom logic, etc.).

This change improves flexibility slightly, but a larger refactor would be needed to make the SSL pinning integration truly extensible. That’s a broader topic outside the scope of this patch.

@tooszovski tooszovski merged commit ad19a37 into RedMadRobot:master May 20, 2025
1 check passed
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.

2 participants