diffplug / diffplug/dormouse

Make iframe previews local-first with an external-origin warning and allowlist

Aperta
#572 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
5
Fork
0
Merge medio
18h 32m
PR unite (30g)
216

Descrizione

Iframe previews are primarily for local development tools: dev servers, Storybook, and similar applications. External documentation is a useful convenience, but this renderer should not try to provide a full authenticated browser experience.

Follow-up to #571. Ship that PR as-is; this enhancement is separate. Keep its ambient Cookie/Set-Cookie stripping, with no cookie jar in this first iteration.

## Proposed behavior

- Allow local loopback targets normally. Define local by the actual loopback destination; arbitrary private-network addresses or hostname string matches do not qualify automatically.
- Before opening a non-allowlisted external origin in the iframe renderer, show a prominent warning identifying the destination, with **Open in browser**, **Allow this origin**, and **Cancel** actions.
- Scope allowlist entries to an exact origin (scheme, hostname, and port). Make entries removable; decide persistence scope during implementation.
- Apply the policy to the initial URL and subsequent cross-origin navigation, including redirects, forms, and script-driven navigation. A click handler or a notification after navigation is not a sufficient gate. Establish what can be enforced in both VS Code and Tauri before choosing the mechanism.
- Approval permits a preview; it does not enable cookie authentication or expand supported URL schemes. The current proxy supports HTTP upstreams only. Unsupported targets should retain a clear way to open in another renderer/browser.

Suggested warning copy:

> **External website preview**
>
> Dormouse's iframe proxy changes website security protections to support local development. Do not sign in or enter sensitive information here.

Avoid claiming that every external page is necessarily vulnerable to XSS. The concrete concern is that proxy rewriting changes browser protections; allowing an origin does not make authenticated use safe.

## Cookie support: defer until real tools require it

Do not add a cookie jar, cookie emulation, per-proxy IP allocation, or authenticated external browsing in this issue. Native JavaScript cookies on the shared loopback hostname remain a documented limitation; an allowlist is not cookie isolation.

As actual local tools fail, capture the tool/version, host/platform, reproduction, expected workflow, and the cookie behavior needed (server-managed session, JavaScript cookie access, CSRF, WebSockets, etc.). Use those stories to define a separate cookie enhancement and its compatibility tests.

A future jar must address caller authorization before attaching stored credentials. Restricting upstreams to localhost does not by itself prevent an unrelated caller from using a logged-in proxy session.

## Implementation references

- `docs/specs/dor-browser.md` — iframe renderer and target policy
- `docs/specs/security-local.md` — browser-pane and loopback-listener boundaries
- `lib/src/host/iframe-proxy.ts` — target handling and redirects
- `lib/src/host/iframe-proxy-rewrite.ts` — injected navigation reporting

Update the owning specs when implementing the enhancement. Validate the warning/allowlist in both hosts, including initial navigation, cross-origin transitions, cancellation, and preserved local-tool behavior.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia da docs/specs/dor-browser.md e docs/specs/security-local.md, quindi segui la gestione delle destinazioni e dei redirect in lib/src/host/iframe-proxy.ts e la segnalazione della navigazione in lib/src/host/iframe-proxy-rewrite.ts. Stabilisci l’applicazione sia in VS Code sia in Tauri prima di scegliere il meccanismo. Il lavoro è completato quando il comportamento di loopback locale rimane intatto, mentre la navigazione esterna è sottoposta a controllo tramite un’allowlist rimovibile di origini esatte e un avviso, e le specs di competenza sono aggiornate.

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

Valutazione

Stack tecnologico
tauri, typescript
Ambito
desktop, devtools, security
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.