Repository navigation
feat(websockets): ssl pinning, custom CAs and configurable validation - #21
Merged
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit 986e2ee
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
edusperoni
force-pushed
the
feat/ssl-pinning
branch
from
April 29, 2025 17:49
d62bb6d to
6477764
Compare
edusperoni
force-pushed
the
feat/ssl-pinning
branch
2 times, most recently
from
November 21, 2026 01:33
cbde523 to
2e45384
Compare
Adds an `ssl` option to the WebSocket constructor on iOS and Android: - validation: 'system' (default) | 'pins-only' | 'none' - pins: public-key (SPKI SHA-256) pins, given as a PEM certificate or a base64 hash. With 'system' they must match a certificate of the validated chain; with 'pins-only' they must match the leaf, and the chain, hostname and expiry are not checked (self-signed / IP servers). - ca: PEM roots that replace the system trust store. Invalid or contradictory options throw from the constructor. iOS evaluates server trust with SecTrust before anything is written to the socket, replacing the RCTSR_SSLPinnedCertificates check (which disabled chain validation and accepted any presented certificate equal to a pinned one) and the DEBUG-only validation bypass. index.ts now only installs the polyfill when no global WebSocket exists; installWebsocketPolyfill() and the WebSocket class can be imported from '@valor/nativescript-websockets/websocket' without side effects.
edusperoni
force-pushed
the
feat/ssl-pinning
branch
from
November 21, 2026 03:17
2e45384 to
6c3dd89
Compare
Replaces native-src/ios/build.sh with `xcrepro build` (configured in xcrepro.config.json), so the committed xcframework is byte-identical regardless of who builds it or where, and carries no local paths. The Mac Catalyst and visionOS simulator slices now also include x86_64.
edusperoni
marked this pull request as ready for review
November 22, 2026 22:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds TLS configuration to
@valor/nativescript-websocketson iOS and Android, and builds the iOS xcframework reproducibly.ssloption'system': normal chain, hostname and expiry validation (againstcawhen given). Pins, if any, must match a certificate of the validated chain.'pins-only': no chain, hostname or expiry checks; the leaf certificate's public key must match a pin. For self-signed certificates and servers reached by IP.'none': no validation.Pins are SHA-256 hashes of the SubjectPublicKeyInfo (OkHttp/HPKP format). Invalid or contradictory options throw from the constructor.
SecTrustbefore anything is written to the socket. This replaces the oldRCTSR_SSLPinnedCertificatescheck, which disabled chain validation and accepted any presented certificate equal to a pinned one, and removes a validation bypass in DEBUG builds of the framework.'system'uses the platform trust manager (or one built fromca) and OkHttp'sCertificatePinner.'pins-only'and'none'decide in the hostname verifier, because an exception thrown from a JS trust-manager callback crashes the app instead of failing the handshake.Polyfill
import '@valor/nativescript-websockets'now installs the polyfill only when no globalWebSocketexists.installWebsocketPolyfill()and theWebSocketclass can be imported from@valor/nativescript-websockets/websocketwithout side effects.Reproducible xcframework
native-src/ios/build.shis replaced byxcrepro(xcrepro.config.json).xcrepro verifybuilds from two different paths to the same hash, and the output contains no machine-specific paths. The Mac Catalyst and visionOS simulator slices now also include x86_64.Testing
On an iOS 26.3 simulator and an Android 16 emulator, against local
wssservers andwss://echo.websocket.org, 23 cases behaved as expected on both platforms, including:The server received no upgrade request from any rejected connection. Not tested: physical devices, iOS < 15 fallback paths, Mac Catalyst and visionOS at runtime.