Skip to content

fix(network): fix BoringSSL diagnostics and TLS - #1655

Merged
khaira777 merged 5 commits into
mainfrom
fm/flocafe-fix-secure-network-bugs
Nov 28, 2026
Merged

khaira777 merged 5 commits into
mainfrom
fm/flocafe-fix-secure-network-bugs

Conversation

@khaira777

@khaira777 khaira777 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fix the four confirmed non-product Secure Network bugs tracked in #1643 from the post-3.14.0 dual review: Electron BoringSSL failing loopback diagnostics due to CA IP Name Constraints, missing http_port in /api/secure-network/status, Windows Firewall Domain-profile false-green / UAC cancel exit-0 / /repair UI ignoring firewall_fixed: false, and stale CA fingerprint/IP state plus unwritable config.json aborting HTTPS fronts. Ship cleanly via no-mistakes closing #1643.

What Changed

  • Loopback TLS diagnostics and certificate state (main/security/lan-tls/secure-network.ts, main/routes/secure-network.ts): Pin loopback HTTPS and WebSocket self-checks to the active leaf certificate and verify its CA signature, issuer, validity window, and loopback SANs directly; clear cached CA, leaf, fingerprint, and IP state on startup failure, stop, disable, and reset; prevent recordIpChange() write failures from aborting HTTPS startup; and include http_port on each surface returned by buildSurfaceAddresses.
  • Windows Firewall diagnostics and repair feedback (main/security/lan-tls/windows-firewall.ts, frontend/src/components/settings/SecureNetworkCard.tsx, frontend/src/lib/secure-network.ts, frontend/src/lib/i18n/messages/*.json): Report Windows domain network profiles as warn (network_profile_domain) instead of ok, exit non-zero from the elevated PowerShell firewall script when UAC is cancelled or fails to start, and display a warning toast in SecureNetworkCard when /secure-network/repair returns firewall_fixed: false with new translations across all locale catalogs.
  • Test coverage (package.json, tests/secure-network-*.test.ts): Run test:secure-network-service via tests/run-electron-node-test.cjs and add assertions covering loopback peer certificate verification, http_port in status payloads, Domain profile warnings, UAC cancellation handling, and TLS state cleanup/config write resilience.

Risk Assessment

✅ Low: All four Secure Network bug fixes are tightly scoped, preserve TLS and authorization invariants, have direct behavioral test coverage under Electron BoringSSL, and the prior Round 1 source-grep finding in tests/secure-network-windows.test.ts has been cleanly removed.

Testing

Ran the three targeted Secure Network suites (including Electron 45.4.1 BoringSSL loopback diagnostics, rogue-cert rejection, authenticated /api/secure-network/status http_port checks, Domain-profile diagnostics, read-only config.json startup resilience, stale CA state clearing, and Windows PowerShell script checks) and drove a live Electron+HTTPS+Playwright Chromium session against the built Settings UI capturing four screenshots of Domain-profile diagnostics, firewall_fixed:false warning toast, normal repair toast, and HTTPS-to-HTTP disable fallback; all locally exercisable scenarios passed, with native Windows UAC/netsh execution marked untested on macOS.

  • Live validation: ✅ go - 7 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Loopback HTTPS and WebSocket diagnostics pass under Electron BoringSSL with CA IP Name Constraints ✅ pass live npm run test:secure-network-service (Electron 45.4.1 BoringSSL) and 01-domain-profile-diagnostics.png
Adversarial: pinned loopback diagnostics reject a rogue TLS server certificate under Electron BoringSSL ✅ pass live npm run test:secure-network-service (Electron 45.4.1 BoringSSL)
Authenticated /api/secure-network/status returns http_port for all surfaces and disabling Secure Network from HTTPS falls back to HTTP ✅ pass live npm run test:secure-network-lan-integrity and 04-https-to-http-fallback-disabled.png
Windows Domain network profile emits warn/network_profile_domain and renders the translated Domain warning in Settings UI ✅ pass live npm run test:secure-network-service and 01-domain-profile-diagnostics.png
Repair UI shows warning toast when firewall_fixed is false and success toast on normal repair ✅ pass live 02-repair-firewall-fix-failed-toast.png and 03-repair-success-toast.png
Windows UAC cancellation exits non-zero and netsh advfirewall rule installation succeeds on Windows ⏸️ untested no Host environment is macOS (arm64); Windows powershell.exe, UAC elevation (Start-Process -Verb RunAs), and netsh advfirewall are unavailable on macOS. Verified script generation ($ErrorActionPreference…
Adversarial: read-only config.json during startup LAN IP change does not abort HTTPS fronts ✅ pass live npm run test:secure-network-service (Electron 45.4.1)
Adversarial: disabling Secure Network or failing leaf provisioning clears stale CA fingerprint, public CA, and certified LAN IPs ✅ pass live npm run test:secure-network-service and 04-https-to-http-fallback-disabled.png

Domain profile diagnostic warning and Windows Firewall button in Settings UI

Repair UI warning toast when firewall_fixed is false

Repair UI success toast on live /api/secure-network/repair

HTTPS-to-HTTP fallback using main.http_port when disabling Secure Network

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ tests/secure-network-windows.test.ts:221 - Lines 221-242 add source-content-only substring and regex assertions against main/security/lan-tls/secure-network.ts (asserting rejectUnauthorized: false match count on lines 232-236, forbidden-token regexes on lines 222-231, and literal source substrings verifyLoopbackPeerCertificate, peerRaw.equals(expectedLeafDer), and peerCert.verify(caCert.publicKey) on lines 237-242). Source-grepping does not prove runtime behavior (matching text can be dead or commented out and breaks on behavior-preserving refactors). Remove these newly added source-content assertions on secure-network.ts; the behavioral contract (rejecting missing, mismatched, rogue-CA, expired, and bad-SAN peer certificates on loopback HTTPS and WebSocket diagnostics) is already exercised directly against verifyLoopbackPeerCertificate, selfRequest, and websocketCheck in tests/secure-network-service.test.ts:812-920.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Loopback HTTPS and WebSocket diagnostics pass under Electron BoringSSL with CA IP Name Constraints ✅ pass live npm run test:secure-network-service (Electron 45.4.1 BoringSSL) and 01-domain-profile-diagnostics.png
Adversarial: pinned loopback diagnostics reject a rogue TLS server certificate under Electron BoringSSL ✅ pass live npm run test:secure-network-service (Electron 45.4.1 BoringSSL)
Authenticated /api/secure-network/status returns http_port for all surfaces and disabling Secure Network from HTTPS falls back to HTTP ✅ pass live npm run test:secure-network-lan-integrity and 04-https-to-http-fallback-disabled.png
Windows Domain network profile emits warn/network_profile_domain and renders the translated Domain warning in Settings UI ✅ pass live npm run test:secure-network-service and 01-domain-profile-diagnostics.png
Repair UI shows warning toast when firewall_fixed is false and success toast on normal repair ✅ pass live 02-repair-firewall-fix-failed-toast.png and 03-repair-success-toast.png
Windows UAC cancellation exits non-zero and netsh advfirewall rule installation succeeds on Windows ⏸️ untested no Host environment is macOS (arm64); Windows powershell.exe, UAC elevation (Start-Process -Verb RunAs), and netsh advfirewall are unavailable on macOS. Verified script generation ($ErrorActionPreference…
Adversarial: read-only config.json during startup LAN IP change does not abort HTTPS fronts ✅ pass live npm run test:secure-network-service (Electron 45.4.1)
Adversarial: disabling Secure Network or failing leaf provisioning clears stale CA fingerprint, public CA, and certified LAN IPs ✅ pass live npm run test:secure-network-service and 04-https-to-http-fallback-disabled.png
  • npm run test:secure-network-service
  • npm run test:secure-network-lan-integrity
  • npm run test:secure-network-windows
  • ELECTRON_RUN_AS_NODE=1 ./node_modules/electron/dist/Electron.app/Contents/MacOS/Electron live POS/KDS/Server App + SecureNetworkService + Playwright Chromium Settings UI verification
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Issues

Closes #1643

Fixes the four confirmed Secure Network bugs from the post-3.14.0 review: pins loopback HTTPS/WebSocket diagnostics against the expected leaf and CA so Electron BoringSSL does not reject GEN_IPADD Name Constraints (and runs test:secure-network-service under Electron), preserves http_port in /api/secure-network/status, warns on Domain Windows Firewall profiles while fixing UAC cancellation exit codes and /repair firewall_fixed UI handling, and clears all cached certificate state together while isolating config.json IP-change writes on startup.

Fixes #1643
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Fix Secure Network TLS diagnostics, firewall feedback, and stale state

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Restore Electron loopback diagnostics without weakening certificate checks, and clear stale
 certificate state.
• Expose HTTP fallback ports and report Domain-profile or failed firewall repairs accurately.
• Add targeted service, API, and Windows-script regression coverage.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 3 capabilities

  • 3 affected capabilities within one bounded functional scope: Secure Network LAN access integration.
  • Certificate issuance, HTTPS fronts, LAN IP coverage and loopback verification jointly determine whether the Secure Network integration serves authenticated LAN clients.
  • The changed X.509 helper is a certificate-validation hop in this same end-to-end behavior, not an independent capability.
  • The HTTP-port contract, firewall-profile classification, diagnostic key mapping and settings rendering are connected steps in the same Secure Network administration behavior.
  • They affect operator diagnosis of LAN access rather than separate technical capabilities.
  • The elevated script, authenticated repair route and firewall-result toast implement one operator outcome: enabling LAN access through the Secure Network Windows firewall rule.
  • The UI and backend are propagation hops of that operation.
Behavioral complexity 🟡 Medium 🧩 Multiple interactions

  • Before, certificate material, persisted IP notices and loopback trust were handled through separate simpler paths.
  • After, failed provisioning clears several related fields, failed notice persistence remains visible in memory, refresh retries persistence without reissuing a leaf, and loopback verification requires both native identity validation and exact leaf equality.
  • New correctness conditions are that CA, leaf, key, certified IPs and published fronts remain mutually consistent across startup, refresh, stop, reset and failure paths; persisted and in-memory IP notices must converge; and the modified CA trust anchor must preserve native TLS validation while omitting only the incompatible extension.
Potential damage 🟡 Medium 🩹 Temporary loss

  • If certificate state is incorrectly cleared, regenerated, or rejected by the stricter loopback checks, Secure Network HTTPS or diagnostics can become unavailable.
  • Reverting code can restore operation, but a failed or persisted certificate transition may require restarting the service and re-establishing the generated certificate state.
  • Usually recoverable by service restart or code rollback; if a new CA was generated or trust material was adopted by clients, client re-trust may be required.
  • No automatic external repair worker is shown.
Assessed commit 62e61ff
Diagram

graph TD
  UI["Settings card"] --> API["Secure Network API"] --> SVC["Network service"] --> TLS["Pinned loopback TLS"] --> FRONT["HTTPS fronts"]
  SVC --> FW["Firewall checks"]
  API --> FW
  UI --> LOCALE["Locale messages"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Reissue CA certificates for native TLS verification
  • ➕ Could retain the TLS runtime's standard certificate-chain validation for loopback checks.
  • ➖ Would change the existing CA constraints and require a trust migration for installed clients.
  • ➖ Expands the scope beyond diagnostics.

Recommendation: Keep the scoped, loopback-only pinning approach: it preserves existing CA material while explicitly checking the expected leaf, issuer, signature, validity, and loopback names. Review its connection and failure handling closely because native verification is disabled on these diagnostic sockets; do not extend that exception to client traffic.

Files changed (41) +605 / -87

Bug fix (5) +158 / -55
SecureNetworkCard.tsxDistinguish incomplete firewall repairs in Settings +16/-17

Distinguish incomplete firewall repairs in Settings

• Both repair buttons now inspect the repair response. A false firewall_fixed result shows a warning instead of the normal success toast.

frontend/src/components/settings/SecureNetworkCard.tsx

secure-network.tsMap Domain-profile diagnostics to localized text +2/-0

Map Domain-profile diagnostics to localized text

• Maps network_profile_domain to the new diagnostic translation key.

frontend/src/lib/secure-network.ts

secure-network.tsInclude HTTP ports in status surface addresses +2/-0

Include HTTP ports in status surface addresses

• Preserves each surface's http_port in the addresses returned by the status API, enabling the Settings card's HTTPS-to-HTTP fallback.

main/routes/secure-network.ts

secure-network.tsPin loopback diagnostics and reset certificate state consistently +135/-37

Pin loopback diagnostics and reset certificate state consistently

• HTTPS and WebSocket self-checks verify the presented leaf against active certificate material, bypassing Electron's failure on the CA's IP Name Constraints. Startup isolates IP-change config writes from HTTPS provisioning, lifecycle paths clear all cached certificate fields, and Domain or unknown firewall profiles receive distinct diagnostic results.

main/security/lan-tls/secure-network.ts

windows-firewall.tsFail elevated firewall repair when UAC does not start +3/-1

Fail elevated firewall repair when UAC does not start

• Makes PowerShell elevation errors terminating and returns a non-zero exit code if no elevated process is created, rather than reporting a canceled repair as successful.

main/security/lan-tls/windows-firewall.ts

Tests (4) +383 / -32
package.jsonRun Secure Network service tests under Electron +1/-1

Run Secure Network service tests under Electron

• Switches the service test command to the Electron Node test runner so diagnostics exercise Electron's BoringSSL behavior.

package.json

secure-network-lan-integrity.test.tsAssert authenticated status includes every HTTP port +23/-0

Assert authenticated status includes every HTTP port

• Checks that the status API returns the configured HTTP port for the main, KDS, and Server App surfaces.

tests/secure-network-lan-integrity.test.ts

secure-network-service.test.tsCover pinned diagnostics and certificate lifecycle failures +350/-24

Cover pinned diagnostics and certificate lifecycle failures

• Adapts service tests to verify TLS peers under Electron and adds positive and adversarial checks for loopback certificate pinning. Also covers surface HTTP ports, Domain and unknown profiles, stale-state cleanup, and startup with an unwritable config file.

tests/secure-network-service.test.ts

secure-network-windows.test.tsCheck elevation failure handling in generated script +9/-7

Check elevation failure handling in generated script

• Asserts that the outer PowerShell script stops on elevation errors and exits non-zero without an elevated process. Removes the Secure Network service from a source-based certificate-validation assertion and fixes a duplicate import.

tests/secure-network-windows.test.ts

Other (32) +64 / -0
ar.jsonAdd Arabic firewall and Domain-profile warnings +2/-0

Add Arabic firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ar.json

bn.jsonAdd Bengali firewall and Domain-profile warnings +2/-0

Add Bengali firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/bn.json

de.jsonAdd German firewall and Domain-profile warnings +2/-0

Add German firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/de.json

en.jsonAdd English firewall and Domain-profile warnings +2/-0

Add English firewall and Domain-profile warnings

• Adds messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/en.json

es.jsonAdd Spanish firewall and Domain-profile warnings +2/-0

Add Spanish firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/es.json

fa.jsonAdd Persian firewall and Domain-profile warnings +2/-0

Add Persian firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/fa.json

fil.jsonAdd Filipino firewall and Domain-profile warnings +2/-0

Add Filipino firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/fil.json

fr.jsonAdd French firewall and Domain-profile warnings +2/-0

Add French firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/fr.json

ha.jsonAdd Hausa firewall and Domain-profile warnings +2/-0

Add Hausa firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ha.json

hi.jsonAdd Hindi firewall and Domain-profile warnings +2/-0

Add Hindi firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/hi.json

id.jsonAdd Indonesian firewall and Domain-profile warnings +2/-0

Add Indonesian firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/id.json

it.jsonAdd Italian firewall and Domain-profile warnings +2/-0

Add Italian firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/it.json

ja.jsonAdd Japanese firewall and Domain-profile warnings +2/-0

Add Japanese firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ja.json

jv.jsonAdd Javanese firewall and Domain-profile warnings +2/-0

Add Javanese firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/jv.json

ko.jsonAdd Korean firewall and Domain-profile warnings +2/-0

Add Korean firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ko.json

mr.jsonAdd Marathi firewall and Domain-profile warnings +2/-0

Add Marathi firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/mr.json

ne.jsonAdd Nepali firewall and Domain-profile warnings +2/-0

Add Nepali firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ne.json

nl.jsonAdd Dutch firewall and Domain-profile warnings +2/-0

Add Dutch firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/nl.json

pa.jsonAdd Punjabi firewall and Domain-profile warnings +2/-0

Add Punjabi firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/pa.json

pt.jsonAdd Portuguese firewall and Domain-profile warnings +2/-0

Add Portuguese firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/pt.json

ru.jsonAdd Russian firewall and Domain-profile warnings +2/-0

Add Russian firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ru.json

sq.jsonAdd Albanian firewall and Domain-profile warnings +2/-0

Add Albanian firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/sq.json

sw.jsonAdd Swahili firewall and Domain-profile warnings +2/-0

Add Swahili firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/sw.json

ta.jsonAdd Tamil firewall and Domain-profile warnings +2/-0

Add Tamil firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ta.json

te.jsonAdd Telugu firewall and Domain-profile warnings +2/-0

Add Telugu firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/te.json

th.jsonAdd Thai firewall and Domain-profile warnings +2/-0

Add Thai firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/th.json

tr.jsonAdd Turkish firewall and Domain-profile warnings +2/-0

Add Turkish firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/tr.json

uk.jsonAdd Ukrainian firewall and Domain-profile warnings +2/-0

Add Ukrainian firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/uk.json

ur.jsonAdd Urdu firewall and Domain-profile warnings +2/-0

Add Urdu firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/ur.json

vi.jsonAdd Vietnamese firewall and Domain-profile warnings +2/-0

Add Vietnamese firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/vi.json

zh-tw.jsonAdd Traditional Chinese firewall and Domain-profile warnings +2/-0

Add Traditional Chinese firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/zh-tw.json

zh.jsonAdd Simplified Chinese firewall and Domain-profile warnings +2/-0

Add Simplified Chinese firewall and Domain-profile warnings

• Adds translated messages for incomplete firewall repair and Domain-profile diagnostics.

frontend/src/lib/i18n/messages/zh.json

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Test helper comment runs three lines over the limit ⊘ Outdated
Description
The JSDoc block above connectWithCa spans three lines of prose, which exceeds the two-line limit
for new comments. The comment does explain a non-obvious reason (Electron BoringSSL rejects
GEN_IPADD Name Constraints), but the extra line adds bulk to a helper whose code already documents
the checks. The same limit applies to any future comment added around this helper.

2. Owners miss a changed-address warning ✓ Resolved
Description
startInternal() catches a failed recordIpChange() write and continues without retaining the
pending change. If the config file later becomes writable but the LAN address stays the same,
refresh() does not retry the write, so Settings continues to read the old or absent notice.


Informational

3. Test helper re-implements certificate checks instead of reusing them ✓ Resolved
Description
connectWithCa repeats the signature, issuer, validity window and host/IP checks inline, while the
PR also exports verifyLoopbackPeerCertificate from the production module to perform those same
checks. The duplicated copy can drift from the production verifier, so a later change to one side
will not be reflected in the other, and the tests may pass against a weaker verifier than the one
shipped.

4. Expired roots can pass loopback checks ⊘ Outdated
Description
verifyLoopbackPeerCertificate() checks the leaf’s validity dates but never checks the CA
certificate’s validity dates. If the service remains running past the CA’s expiry while refreshing
its leaf, the new pinned HTTPS and WebSocket probes can accept that leaf and report healthy
connections that normal certificate validation rejects.

5. Domain-network advice has no matching fix in the app ✓ Resolved
Description
The new diagProfileDomain string in every locale tells the owner to "Allow FloCafe for Domain
networks". The only firewall action the app offers, /repair with fix_firewall, calls
buildAddRuleArgs, which hard-codes profile=private. On a Domain network, an owner who clicks
"Allow other devices in Windows Firewall" re-installs a private-only rule. The repair reports
success, firewall_rule shows ok, and other devices are still blocked.

Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display > Comment parts

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · The firewall fix needs a mixed-profile follow-up, and the explicit comment-length requirement must be satisfied before merging.RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect Secure Network diagnostics, startup, status, and repair within the app.

The firewall fix needs a mixed-profile follow-up, and the explicit comment-length requirement must be satisfied before merging.

Findings

  1. P2 Domain warning still disappears ▶
  2. P2 Comment exceeds repository limit ▶

Summary

The PR fixes loopback certificate checks, adds http_port to status responses, clears cached certificate state, and improves Windows firewall feedback.

  • Loopback TLS checks verify the active certificate before passing.
  • Secure Network keeps certificate state fresh and reports each HTTP port.
  • Windows Domain profiles and firewall repair results show clear warnings.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Windows connection profiles] --> B[parseNetworkProfile]
  B --> C{Private and Domain present?}
  C -->|Yes| D[Returns private]
  D --> E[network_profile_ok]
  C -->|Domain only| F[network_profile_domain warning]
Loading

Reviews (1) · Last reviewed commit: "no-mistakes(review): Remove source-grep ..." · Reviewed by Greptile

Comment thread main/security/lan-tls/secure-network.ts Resolved
Comment thread tests/secure-network-service.test.ts Resolved
…on` alerts (`main/security/lan-tls/secure-network.ts:568` and `tests/secure-network-service.test.ts:101`) by eliminating all `rejectUnauthorized: false` usage and keeping native TLS certificate validation enabled everywhere. Root cause & invariant: - Electron 45's BoringSSL `x509_vfy` rejects IP Name Constraints (`GEN_IPADD`, OID `2.5.29.30`) on CA certificates, so the previous patch disabled TLS certificate validation (`rejectUnauthorized: false`) and re-implemented verification in `secureConnect` callbacks in both `SecureNetworkService` and `tests/secure-network-service.test.ts`. - Invariant: TLS clients in production and test code must never disable certificate validation (`rejectUnauthorized: false`); native TLS handshake verification must remain enabled while keeping the persisted CA and `/ca.cer` Name Constraints intact for LAN devices. Changes: - `main/security/lan-tls/x509.ts`: Added `caTrustAnchorPemForNodeTls(caDer)` to derive an in-memory PEM trust anchor with only the Name Constraints extension omitted so Electron's BoringSSL and OpenSSL both perform full native signature, issuer, validity, and SAN verification with `rejectUnauthorized: true`. - `main/security/lan-tls/secure-network.ts`: Replaced `createPinnedLoopbackSocket` / `verifyLoopbackPeerCertificate` (and its `rejectUnauthorized: false`) with `loopbackTlsOptions()` passing `ca: caTrustAnchorPemForNodeTls(this.ca.certificateDer)`, `servername: 'localhost'`, and leaf pinning via `checkServerIdentity` to `https.request` (with `agent: false`) and `new WebSocket(...)`. Removed now-unused `crypto` import. - `tests/secure-network-service.test.ts`: Removed `connectWithCa` (`rejectUnauthorized: false`) and passed `ca: caTrustAnchorPemForNodeTls(derFromPem(...))` directly to `https.request`, `new WebSocket`, and `tls.connect`; updated the loopback negative checks to verify live rejection of both rogue-CA and same-CA mismatched-leaf servers under Electron's BoringSSL. Verification: - `rg -n "rejectUnauthorized" main/ tests/ frontend/` confirmed zero remaining `rejectUnauthorized: false` call sites (only the negative regex assertion in `tests/secure-network-windows.test.ts`). - `npm run test:secure-network-certificates`: passed. - `npm run test:secure-network-service` (Electron BoringSSL): passed. - `npm run test:secure-network-lan-integrity`: passed. - `npm run test:secure-network-windows`: passed. - `npm run lint`: passed (0 warnings/errors on modified files). - `npm run build`: passed. - `git diff --check`: passed
@khaira777 khaira777 changed the title fix: resolve Secure Network diagnostics, firewall, and TLS state bugs fix(network): fix BoringSSL diagnostics and TLS Nov 27, 2026
khaira777 and others added 2 commits November 27, 2026 20:35
Addresses remaining Qodo and Greptile review findings on PR #1655: gives Domain network profiles precedence over Private in parseNetworkProfile() so mixed Private+Domain hosts still warn, retains unpersisted IP-change notices in memory when config.json is unwritable and retries persistence on refresh(), and clarifies diagProfileDomain wording across all 32 locales to direct Domain firewall configuration to Windows Defender Firewall or IT.
@khaira777
khaira777 merged commit b721b76 into main Nov 28, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-fix-secure-network-bugs branch November 28, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(network): fix Electron BoringSSL diagnostics and LAN TLS bugs

2 participants