Automattic / Automattic/wordpress-rs

The `allowSSL` server-trust override accepts the challenge without evaluating the trust

Open
#1,512 0 comments 0 reactions 0 assignees View on GitHub
Bug Error Handling Swift
Dominant language
Rust
Stars
36
Forks
5
Avg merge
17h 30m
Merged PRs (30d)
43

Description

> Split out from Automattic/wordpress-rs#1497 — *Swift executor URLSession error audit*. Section D — Crash instead of classified error.
>
> File references are to `native/swift/Sources/wordpress-api/SafeRequestExecutor.swift` unless noted; `:NNN` line numbers were verified against `fix/converge-executor-error-classification`.

**Severity: high (security).** The delegate's `didReceive challenge` handler (`:347-363`) returns `(.useCredential, URLCredential(trust:))` as soon as the leaf certificate parses and its CN matches the allowlist — `SecTrustEvaluateWithError` is never called, so chain signature, issuer, and validity dates are never checked. A MITM can self-sign a certificate whose CN copies the legitimate certificate's CN (public information) and be accepted for every host previously passed to `allowSSL(altNames:forCommonName:)`. The comment above the storage states the feature exists to tolerate a hostname missing from an otherwise-valid certificate; the fix is to re-evaluate the trust with hostname checking relaxed but chain validation intact (`SecTrustSetPolicies` with `SecPolicyCreateSSL(true, nil)`, then `SecTrustEvaluateWithError`), falling through to `.performDefaultHandling` on failure. Compounds Automattic/wordpress-rs#1498: apps steered into `allowSSL` by a bogus name-mismatch reason find the exception "works" precisely because validation is fully bypassed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in native/swift/Sources/wordpress-api/SafeRequestExecutor.swift at the didReceive challenge handler around lines 347-363. Trace how allowSSL(altNames:forCommonName:) stores its exception, then review the trust policy and evaluation APIs needed to relax hostname checking without skipping chain validation. Done means matching certificates still require successful trust evaluation and failures fall through to default handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.