Skip to content
This repository was archived by the owner on Nov 10, 2026. It is now read-only.

v1.4.3: verify outbound TLS; distrust eMudhra roots - #46

Merged
SashaMIT merged 1 commit into
mainfrom
sec/tls-verify-emudhra
Oct 21, 2026
Merged

SashaMIT merged 1 commit into
mainfrom
sec/tls-verify-emudhra

Conversation

@SashaMIT

Copy link
Copy Markdown

pc2-node accepted any certificate on outbound HTTPS. UsernameService.ts set NODE_TLS_REJECT_UNAUTHORIZED='0' for the whole process at import, and three call sites used rejectUnauthorized: false. This turns verification back on everywhere and also handles the eMudhra root compromise (20 Oct 2026).

Approach. Both supernodes (69.164.241.210, 38.242.211.112) already serve the Let's Encrypt *.ela.city certificate on their IPs. The only thing that failed was the hostname check. pc2-node keeps connecting by IP and keeps the same Host header, so nginx routing is unchanged, but it verifies the chain against supernode.ela.city through SNI. No DNS or server change is needed.

Changes

  • New pc2-node/src/utils/tlsTrust.ts:
    • drops the three distrusted roots, matched by SPKI SHA-256, from Node's bundled store (Node 20 and 22 still ship emSign ECC Root CA - G3),
    • maps the supernode IPs to supernode.ela.city,
    • installOutboundTlsPolicy() applies both to global fetch (undici dispatcher) and to the default https agent. It's called at boot in index.ts.
  • UsernameService.ts: removes the global switch.
  • api/index.ts (ESC RPC proxy), ConnectivityService.ts (supernode discovery) and chipotle-client.ts (provisioning fetch only): replace rejectUnauthorized:false with the supernode servername.
  • http-client.ts: the per-request pinned dispatcher uses the filtered roots.
  • deploy/supernode-bootstrap.sh: no longer writes NODE_TLS_REJECT_UNAUTHORIZED=0 into the gateway unit. Neither live gateway has it set today.
  • CI: a step fails if pc2-node/src reintroduces either bypass. New tests/unit/tls-trust.test.js.
  • Version 1.4.3 and a CHANGELOG entry.

Security policy note. chipotle-client.ts is on the review checklist. The only change there is the TLS options on the provision httpsGet. The provision envelope signature check, sessions and CEK paths are untouched.

Verified locally (Node 20, built module)

  • Unit tests: 17/17, including the v1.4.1 and v1.4.2 suites.
  • Live probe:
    • both supernodes' /api/health, ESC RPC, /api/ddrm/provision, /api/supernodes and cluster-pin verify,
    • zzz, OpenAI, GitHub and 1.1.1.1 are unaffected,
    • self-signed, wrong-host and expired certificates are refused by both fetch and https.

Not in this PR (tooling, low priority): curl -k in deploy/supernode-bootstrap.sh cron lines and in scripts/*.sh, and rejectUnauthorized:false in tests/api-tester, tools/comment-writer and pc2-node/scripts/*.mjs.

Do not merge until it has been tested on zzz.ela.city.

- Remove the process-wide NODE_TLS_REJECT_UNAUTHORIZED='0' and every
  rejectUnauthorized:false in pc2-node.
- Supernode IPs verify against their Let's Encrypt *.ela.city cert via
  SNI/servername; Host header and nginx routing unchanged.
- Filter the roots distrusted after the eMudhra compromise (by SPKI) out
  of the trust store used by fetch and the default https agent.
- Drop NODE_TLS_REJECT_UNAUTHORIZED=0 from the supernode gateway unit.
- CI guard against reintroducing a bypass; unit tests.
@SashaMIT
SashaMIT merged commit 327bbcc into main Oct 21, 2026
10 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant