Enabling Rozenite causes Chromium 'Failed parsing key usage' cert errors to leak into terminal (macOS)

Aperta
#511 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
electron, react-native, typescript
Ambito
devtools, tooling

Direzione di ricerca

Start in LaunchUtils.js, focusing on the debugger-shell stdout/stderr forwarding used by openDebuggerMiddleware. Reproduce the full react-native start to DevTools-launch flow with Rozenite enabled and disabled, then determine how the known Chromium startup noise can be prevented from appearing in the Metro terminal without hiding actionable errors. Done means the certificate-parsing lines no longer leak during the affected flow.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

status:stale

Summary

Enabling Rozenite (withRozenite(..., { enabled: true }) via WITH_ROZENITE=true) causes noisy Chromium certificate-parsing errors to appear in the Metro terminal output on macOS, every single time React Native DevTools is launched:

[debugger-shell stderr] [PID:MMDD/HHMMSS.ffffff:ERROR:net/cert/internal/trust_store_mac.cc:807] Error parsing certificate:
ERROR: Failed parsing key usage

This does not occur when Rozenite is disabled (confirmed by toggling WITH_ROZENITE on/off in the same project — reverting Rozenite makes the noise disappear, and it is 100% reliably present when Rozenite is enabled).

Root cause (as far as I could trace it)

  • Rozenite's Metro middleware serves its own DevTools frontend at /rozenite/rn_fusebox.html (confirmed via GET /json/list — devtoolsFrontendUrl points to this path instead of the default RN DevTools frontend).
  • This appears to force @react-native/dev-middleware's openDebuggerMiddleware to launch the standalone Fusebox Electron shell (@react-native/debugger-shell, a bundled Electron/Chromium app resolved via dotslash) rather than opening the debug target in the user's regular installed browser (Chrome/Edge) via launchDebuggerAppWindow.
  • The standalone Electron shell spins up its own fresh Chromium NetworkService utility process with its own user-data-dir (~/Library/Application Support/React Native DevTools), which enumerates every certificate in the macOS Keychain (Login, System, System Roots, iCloud) to build its trust store. Because at least one cert in the Keychain has a non-standard/malformed Key Usage X.509 extension (common with legacy/self-signed certs accepted once for local devices, VPNs, MDM profiles, etc.), Chromium's stricter parser logs net/cert/internal/trust_store_mac.cc:807 Error parsing certificate: Failed parsing key usage — and does so on every single launch of the shell, not intermittently.
  • Critically, @react-native/dev-middleware's LaunchUtils.js explicitly pipes this child process's stdout/stderr into the Metro terminal output (console.warn("[debugger-shell stderr] " + data)), which is why this becomes visible with Rozenite enabled but is invisible otherwise (a normal browser's own process output is never piped into the terminal).

I want to stress this Keychain certificate issue itself is a macOS/Chromium-level quirk unrelated to Rozenite or this repo — I confirmed via manual process tracing that the error originates purely from Chromium's own cert trust-store code (net/cert/internal/trust_store_mac.cc), not from any Rozenite code. However, Rozenite's choice to route through the standalone debugger-shell (and have its stderr piped to the terminal) is what makes this pre-existing, otherwise-invisible noise show up as soon as Rozenite is enabled — consistently, every time.

Steps to reproduce

  1. Have at least one certificate with a malformed Key Usage extension somewhere in your macOS Keychain (common on developer machines with lots of VPN/MDM/self-signed router certs accumulated over time).
  2. Enable Rozenite in metro.config.js:
    module.exports = withRozenite(mergeConfig(getDefaultConfig(__dirname), config), {
      enabled: true, // or process.env.WITH_ROZENITE === 'true'
    });
    
  3. Run react-native start (or expo start), then open React Native DevTools (press j, or hit /open-debugger).
  4. Observe the [debugger-shell stderr] ... trust_store_mac.cc:807 ... Failed parsing key usage lines in the terminal — this happens on every launch, not occasionally.
  5. Disable Rozenite (enabled: false), repeat steps 3–4 — the error no longer appears in the terminal.

Expected behavior

No unrelated Chromium/macOS Keychain internals should leak into the developer's terminal output as a side effect of enabling Rozenite, since the noise is not actionable from the app/repo side and can look like Rozenite is doing something wrong with certificates (it isn't).

Suggested fixes

  • Consider not forcing the standalone Fusebox Electron shell purely because Rozenite's custom frontend is served, if the user's regular DevTools launch flow (browser-based) would otherwise be used — or clearly document that Rozenite requires/prefers the standalone shell and why.
  • Alternatively/additionally, filter or suppress known-benign Chromium startup stderr noise (e.g. trust_store_mac.cc, Window move completed without beginning) before re-emitting debugger-shell stderr lines to the terminal, so only actionable errors are surfaced.
  • At minimum, document this known noise in Rozenite's README/troubleshooting so users don't mistake it for a Rozenite bug.

Environment

  • Rozenite: @rozenite/metro, @rozenite/middleware, etc. v2.4.0
  • React Native: 0.86.3
  • Metro: 0.84.6
  • OS: macOS 27.0 (build 26A428), Apple Silicon
  • Package manager: pnpm (monorepo)
  • Installed Rozenite plugin: @rozenite/react-navigation-plugin

Additional notes

  • I verified this is not a malformed cert issue in the standard login.keychain-db or System.keychain (scanned via security find-certificate -a -p + openssl x509 -noout -text, all parsed cleanly) — the offending cert is likely in the newer SQLite-backed keychain store or iCloud Keychain, which isn't easily enumerable outside the Keychain Access GUI.
  • Note: when manually launching the debugger-shell binary directly/standalone (bypassing the real Metro + connected-app flow, e.g. to try to isolate the exact offending cert with extra Chromium logging flags), the error did not reproduce — it only reproduces reliably through the real react-native start → DevTools-launch flow described above. So the repro steps above (full flow) are the reliable ones; ad-hoc standalone launches of the binary are not representative.

Happy to provide more logs/details if useful.

Lingua principale
TypeScript
Stelle
680
Fork
58
Merge medio
5g 1h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstackincubator/rozenite

Tutte le issue di callstackincubator/rozenite

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.