Skip to content

fix(runtime+pwa): block local-secret cloud fallback and stale HTML precache#140

Merged
koala73 merged 4 commits into
koala73:mainfrom
lawyered0:codex/critical-bug-sweep-2
Feb 20, 2026
Merged

fix(runtime+pwa): block local-secret cloud fallback and stale HTML precache#140
koala73 merged 4 commits into
koala73:mainfrom
lawyered0:codex/critical-bug-sweep-2

Conversation

@lawyered0

@lawyered0 lawyered0 commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • prevent cloud fallback for local-only sidecar endpoints (/api/local-*) in desktop runtime fetch patch
  • ensure local secret/config routes never send payloads to remote hosts on local errors
  • add runtime E2E regression proving no remote fallback for:
    • /api/local-env-update
    • /api/local-validate-secret
  • apply deploy/cache guardrail fixes so SPA HTML is network-driven (not precached)
    • remove index.html from Workbox precache glob
    • explicitly disable navigateFallback (navigateFallback: null)
    • add deploy guardrail test coverage for navigateFallback: null

Why

  • Desktop secret-management routes can carry API keys and credentials; they must remain local-only even when local calls fail.
  • Precaching HTML can serve stale shell documents after deploy and point users at deleted chunk hashes.

Changes

  • src/services/runtime.ts
    • classify /api/local-* as local-only
    • block cloud fallback for local-only routes on both:
      • non-OK local responses
      • local fetch/network errors
  • e2e/runtime-fetch.spec.ts
    • add test: runtime fetch patch never sends local-only endpoints to cloud
  • vite.config.ts
    • remove index.html from Workbox precache globPatterns
    • set navigateFallback: null to prevent default SW navigation fallback route generation
  • tests/deploy-config.test.mjs
    • assert precache glob remains HTML-free
    • assert navigateFallback: null and no navigateFallbackDenylist

Validation

  • npm run typecheck
  • npm run test:e2e:runtime ✅ (6/6)
  • npm run test:sidecar
  • npm run test:data
  • npm run build

@vercel

vercel Bot commented Feb 20, 2026

Copy link
Copy Markdown

@lawyered0 is attempting to deploy a commit to the eliehabib projects Team on Vercel.

A member of the Team first needs to authorize it.

@lawyered0 lawyered0 changed the title fix(runtime): keep local sidecar endpoints from leaking to cloud fix(runtime+pwa): block local-secret cloud fallback and stale HTML precache Feb 20, 2026
@vercel

vercel Bot commented Feb 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview, Comment Feb 20, 2026 3:59am

Request Review

@koala73
koala73 merged commit 2ca033f into koala73:main Feb 20, 2026
2 of 4 checks passed
facusturla pushed a commit to facusturla/worldmonitor that referenced this pull request Feb 27, 2026
…ecache (koala73#140)

## Summary
- prevent cloud fallback for local-only sidecar endpoints
(`/api/local-*`) in desktop runtime fetch patch
- ensure local secret/config routes never send payloads to remote hosts
on local errors
- add runtime E2E regression proving no remote fallback for:
  - `/api/local-env-update`
  - `/api/local-validate-secret`
- apply deploy/cache guardrail fixes so SPA HTML is network-driven (not
precached)
  - remove `index.html` from Workbox precache glob
  - explicitly disable `navigateFallback` (`navigateFallback: null`)
  - add deploy guardrail test coverage for `navigateFallback: null`

## Why
- Desktop secret-management routes can carry API keys and credentials;
they must remain local-only even when local calls fail.
- Precaching HTML can serve stale shell documents after deploy and point
users at deleted chunk hashes.

## Changes
- `src/services/runtime.ts`
  - classify `/api/local-*` as local-only
  - block cloud fallback for local-only routes on both:
    - non-OK local responses
    - local fetch/network errors
- `e2e/runtime-fetch.spec.ts`
- add test: `runtime fetch patch never sends local-only endpoints to
cloud`
- `vite.config.ts`
  - remove `index.html` from Workbox precache `globPatterns`
- set `navigateFallback: null` to prevent default SW navigation fallback
route generation
- `tests/deploy-config.test.mjs`
  - assert precache glob remains HTML-free
  - assert `navigateFallback: null` and no `navigateFallbackDenylist`

## Validation
- `npm run typecheck` ✅
- `npm run test:e2e:runtime` ✅ (6/6)
- `npm run test:sidecar` ✅
- `npm run test:data` ✅
- `npm run build` ✅
koala73 added a commit that referenced this pull request Jun 19, 2026
…#4351)

Resolves all 3 critical Dependabot alerts without changing runtime behavior:

- shell-quote 1.8.3 -> 1.8.4 (root + pro-test) via overrides. It is a
  transitive peer dep of the dead react-devtools-core/react-native tree;
  the bump is a security patch with no runtime impact. (#140, #141,
  GHSA-w7jw-789q-3m8p)
- vitest ^2.1.2 -> ^3.2.6 (consumer-prices-core), a dev-only test tool.
  All 54 tests pass and `tsc` builds clean under v3; zero production
  dependencies changed and no CI job runs it. (#139, GHSA-5xrq-8626-4rwp)

Also folded in, since it was the sole remaining blocker keeping the
security-audit gate red on every PR:

- undici 7.24.5 -> 7.28.0 (scripts), an in-range (^7.x) direct-dep patch
  for the SOCKS5 ProxyAgent TLS bypass (GHSA-vmh5-mc38-953g, high).

Removed the now-obsolete GHSA-w7jw-789q-3m8p baseline entries from
audit-production-dependencies.mjs (shell-quote is patched, not deferred)
and re-pointed the two baseline tests at advisories that are still
baselined. Full audit matrix passes exit=0 across all 6 workspaces;
lockfiles are idempotent (npm ci-safe).

Claude-Session: https://claude.ai/code/session_01JWozy1k6rwrf6ENB3XSJDR
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.

2 participants