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

未关闭
#511 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
electron, react-native, typescript
领域
devtools, tooling

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
680
派生
58
平均合并
5 天 1 小时
30 天内合并 PR
7

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/rozenite 的其他 Issue

查看 callstackincubator/rozenite 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。