fix: cross-platform CA trust (Arch/Fedora + Windows) #41
Reference in New Issue
Block a user
Delete Branch "fix/cross-platform-ca-trust"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #35.
Summary
update-ca-certificates. Walks a const table in priority order, picks the first whose anchor dir exists. Fixes #35 on Arch and silently broken Fedora/RHEL/SUSE installs.certutil -addstore Root/certutil -delstore Root. Previouslynuma installsucceeded on Windows but the trust step quietly errored, leaving HTTPS.numarequests throwing browser warnings.trust_ca/untrust_caare now thin dispatchers calling per-platform helpers.CA_COMMON_NAMEandCA_FILE_NAMEcentralized intls.rsand reused fromsystem_dns.rsandapi.rs.untrust_ca_linuxdrops a TOCTOU pre-check and skipsupdate-ca-certificates --freshwhen nothing was removed.Test plan
cargo build+cargo clippy --libclean on macOScargo test --lib system_dns— 3/3 passcargo fmt --check+cargo build+cargo test+cargo clippy -- -D warningsonubuntu-latest,macos-latest,windows-latest— all green (Windows compile-check is the most valuable signal here, validating the newcertutil-based code path against the realwindows-msvctoolchain)tests/docker/install-trust.sh— hermetic contract test againstdebian:stable,fedora:latest,archlinux:latestin Docker, asserting the fixture cert lands in (and is removed from) each distro's system bundle. 3 passed, 0 failed locally on Apple Silicon.tests/manual/install-trust-macos.sh— verified locally with the production numa CA in place (script's safety design uses a unique CN + by-hash deletion so coexistence is provably safe). Test cert added viasecurity add-trusted-cert, found by CN, removed by hash, verified gone. Production CA untouched.cargo testonwindows-latestagainst the realwindows-msvctoolchain. The Windows code path is 8 lines ofcertutil -addstore Root/-delstore Rootagainst a well-documented stable Windows API. Behavioral test (runningnuma installon a real Windows machine) deferred to post-release user reports — acceptable risk for this PR's surface.Test coverage shape
tests/docker/install-trust.shtests/manual/install-trust-macos.shtests/docker/= hermetic, no host mutation.tests/manual/= host-mutating, sudo, dev-only. Naming convention makes the contract obvious.Notes
crate::data_dir()(used bysystem_dns.rs) andctx.data_dir(used byapi.rs, respects[server] data_dirfromnuma.toml) is a latent pre-existing bug that this refactor inherited but did not introduce. Out of scope for this PR — will file a follow-up issue.numa trust install/numa trust uninstallsubcommand (so users runningnuma servedirectly withoutnuma installcan still trust the CA) was deferred per the original plan discussion. Not blocking #35.tests/docker/install-trust.shandtests/manual/install-trust-macos.share intentionally not wired into CI — both are "before push" tools, liketests/integration.sh. The Docker script aligns with the future docker-integration migration plan indocs/implementation/integration-test-migration.md.🤖 Generated with Claude Code