Skip to content

feat(apps): serve app web origins over the dashboard connection - #36967

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
LachlanLindsay:feat/app-web-origin
Nov 15, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
LachlanLindsay:feat/app-web-origin

Conversation

@LachlanLindsay

@LachlanLindsay LachlanLindsay commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An app that frames its own backend's pages works when the dashboard is opened from another machine over a single forward of the dashboard port.

An app whose UI embeds its backend's web pages (for example a local reverse proxy in front of a third-party editor) has to point its frame at http://127.0.0.1:<backend port>. The browser resolves that address on its own machine. When the gateway runs on a remote desktop and the dashboard is opened from a laptop through ssh -L <port>:localhost:<port>, everything that goes through the dashboard works, but the frame dials a port on the laptop where nothing listens, and the pane stays blank. The only workaround is a second forward per app, which breaks whenever an auto port changes and collides with the same app on the laptop.

Why it matters

Running the gateway on a remote dev machine and the browser or desktop app on a laptop is a common setup. Today, any app that frames a page of its own is unusable there, with no error explaining why.

Not a goal

  • A dashboard reached over a published HTTPS host (a tunnel service, a reverse proxy): there is no wildcard name or certificate for per-app hosts there.
  • Remote Crew panes whose forward port differs from the remote gateway's port, and Session Manager forwards. Both keep today's behaviour.
  • Any change to the /apps/<app>/api/ proxy, its signing, or frame-backed contribution points.
  • The Web Preview panel's framing of arbitrary loopback dev servers.

What changed (motivation → approach → change)

The frame needs an origin the browser can reach over the dashboard's own connection, but it cannot share the dashboard's origin: the framed page may be a third party's scripts, and on the dashboard's origin they could read its page and credentials.

So the gateway gives each opted-in app its own site on the dashboard's port: http://<app>.apps.localhost:<dashboard port>. Browsers resolve every *.localhost name to their own loopback, so that name rides the same forward as the dashboard, and the gateway tells it apart by Host. localhost is not a public suffix, so the name is a different site: the dashboard's host-only cookies are never sent to it.

  • Opt-in: backend.webOrigin: true in the manifest (src/kiro_crew/apps/manifest_sections.py, src/kiro_crew/apps/manifest.py), parsed like signedPrincipal. Names over 63 characters are refused, because the name becomes a DNS label.
  • Routing: a new middleware (src/kiro_crew/apps/app_web_origin.py, placed by src/kiro_crew/dashboard/server_runtime/middleware_chain.py) sits just inside the deny-audit boundary, ahead of the host canonicalization and the Host barrier. A Host under .apps.localhost never reaches a dashboard layer. It is served only to a direct local request, on a port the dashboard's own loopback origins name, for an installed, enabled, opted-in app with a running backend. A request that arrives on the Session Manager listener is refused before any backend lookup. Anything else gets 421 or 404. HTTP and WebSocket are relayed, with streaming and an idle bound, and a WebSocket message is capped at 64 MiB. Each serve and each refusal is written to the security event log.
  • Credentials: Authorization, the internal-auth headers, relay headers, every X-KiroCrew-* header and the dashboard's own cookies are dropped. The request is not signed: a backend trusts the proxy signature as proof the API proxy forwarded a call, and a framed third-party page must not be able to produce one.
  • Response: hop-by-hop headers and Clear-Site-Data are dropped, Set-Cookie loses Domain, and each comma-separated CSP policy loses only its frame-ancestors, replaced by one policy naming the dashboard's loopback origins.
  • Dashboard: http://*.apps.localhost:* is added to the CSP frame-src and connect-src (src/kiro_crew/dashboard/server_runtime/security_headers.py). The CSRF allowlist does not gain it.
  • Discovery: appWebOrigin(name) on the App SDK, seam level 8 (src/kiro_crew/apps/app_sdk_level.py and its website mirror). It returns the origin when the dashboard is on localhost, 127.0.0.1 or kirocrew.localhost over http, and null otherwise (including [::1], which frame-ancestors cannot name), so an app keeps its old frame there and on older hosts.

Considered and not taken: serving the app under a path on the dashboard origin, which shares the dashboard's origin; a capability path in an opaque sandbox, which gives no cookies or storage; a second listener per app, which needs another forward; and forwarding app ports automatically, which misses a manual ssh -L and breaks when ports change.

Backwards compatibility

Compatible: the manifest key is additive and ignored by older gateways, apps that do not opt in see no change, and a Host under .apps.localhost was refused by the Host barrier before this change.

Removes nothing: no route, key, header or accepted input that main serves today is removed or narrowed; the only change on existing responses is one more source in the dashboard CSP's frame-src and connect-src.

Tests

  • test/test_app_web_origin.py, run through the real middleware in front of a real loopback backend:
    • host parsing and canonicalization: case, a trailing dot, lookalike and rebinding names, labels that are not valid, a missing port;
    • refusals: another app, a wrong port, a forwarded or proxied peer;
    • no dashboard credential reaches the backend: cookies, Authorization, forged proxy, principal and relay headers;
    • path, query and body forwarded unchanged;
    • response hardening (Set-Cookie Domain, Clear-Site-Data, frame-ancestors);
    • a WebSocket round trip, with subprotocol and header rules;
    • the WebSocket cap in both directions (a message over it closes with 1009 and never reaches the other side), and close codes: each side's own code reaches the other, and an empty, dropped or out-of-range close becomes 1000, 1001 or 1002;
    • a request on the Session Manager listener is refused, HTTP and WebSocket, and never reaches the backend;
    • each serve and each refusal writes one security event log row, with no query string;
    • 502 when the backend is down;
    • opt-in, enabled and running are all required;
    • the manifest parse and the name-length rule;
    • CSRF refuses the app origin while the dashboard's own origin passes;
    • the dashboard CSP admits exactly http://*.apps.localhost:* as its wildcard name.
  • website/src/app-sdk/webOrigin.test.ts: appWebOrigin on localhost, 127.0.0.1 and kirocrew.localhost, with the browser's port kept, and null for [::1], Remote Crew pane names, published hosts, https and malformed app names.
  • Updated: the dashboard chain order pin, the lazy-import table, the connect-src allowlist test, and the list of loopback trust sites.
  • Determinism: test/test_app_web_origin.py passed 5 runs at -n 4 (64/64 each time), and its WebSocket, close-code, audit and Session Manager tests passed 20 repeats at -n0.

Proof: not provable -- other: feature PR; the new tests fail on main because the module and manifest key do not exist there

Manual verification

This was checked end to end in headless Chromium on Linux. The real middleware and the real dashboard CSP ran in front of a real app backend: a local reverse proxy to a stub third-party site, with HTTP, a save endpoint and a WebSocket. The browser could reach the gateway only through a raw TCP forwarder standing in for ssh -L. Through the app origin, the framed page rendered, picked up the dashboard theme, saved an edit, held a live WebSocket, and followed a link to another page. The browser sent the app host only the app's own cookie and never the dashboard cookie. A POST from the app origin to a dashboard API was refused, while the dashboard's own POST was accepted. The same checks passed without the forwarder. With appWebOrigin absent, as on an older host, the app fell back to its loopback frame. On the same setup: a request on a Session Manager listener (a second listener on the same runner) got 421 for HTTP and WebSocket; a 5 MiB WebSocket message reached the stub site, while one over 64 MiB closed the relay with 1009 and never reached it; and every served request left one granted row in the security event log.

Not verified: Safari or WebKit (the local WebKit build would not start), Firefox, and the desktop app shell.

Screenshots / video

Why no screenshot: the only frontend change is a new SDK function with no rendered surface; the dashboard looks identical.

Related Issues

Closes #36965

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 443dac6047930859916367483fc22a47462ddfd7 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 443dac6

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 443dac6047930859916367483fc22a47462ddfd7 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 443dac6

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 14, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own.

This adds an opt-in per-app site, .apps.localhost:, which the gateway relays to the app's backend. I found no blocking defect. The new middleware runs ahead of the Host barrier and token auth, so its own checks are the boundary, and they hold: a request on the Session Manager listener (caught by socket port), a relayed request, a proxied or forwarded request, a non-loopback peer and the Unix socket are all refused before any backend lookup. What gets through is a direct local request or an ssh -L forward, which gives no more access than the backend's own loopback port does today. No credential, X-KiroCrew-* header or dashboard cookie is forwarded, nothing is signed, and response cookies and CSP are hardened. The CSRF allowlist does not gain the new origin. Opt-in, enabled and running are checked again on every request. The audit-500 finding from the earlier GPT review is fixed, and tests cover the security-relevant paths. The remaining notes are a design caveat about cross-app SameSite cookies, slight over-claiming in the description, and CI jobs that were still running at review time.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 443dac6047 · 1577 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@LachlanLindsay

Copy link
Copy Markdown
Contributor Author
  • Preserve separate policies in combined CSP headers

fixed in c7c2852: _without_frame_ancestors now splits the header on , into policies, drops only the frame-ancestors directive from each, and keeps every other directive and every non-empty policy.
test_response_hardening and test_response_is_hardened send frame-ancestors 'none', script-src 'none'; frame-ancestors * and require script-src 'none' to survive, through the helper and through a real request; both fail with the old split.

@LachlanLindsay

Copy link
Copy Markdown
Contributor Author
  • Accept the browser's default-port Host spelling

fixed in c7c2852: parse_app_host reads a missing port as 80; the dashboard-port check still applies, so a portless Host is served only when 80 is one of the dashboard's ports, and the backend still receives <name>.apps.localhost:80.
test_default_port_host_is_served_only_by_port_80_dashboard covers both sides (200 on a port-80 dashboard, 421 on 5476); it and test_parse_app_host fail with the old parse.

@LachlanLindsay

Copy link
Copy Markdown
Contributor Author
  • Do not advertise an origin that excludes an IPv6 parent

fixed in c7c2852: appWebOrigin returns null on [::1], so the app keeps its own fallback frame, and [::1] is removed from the gateway's _DASHBOARD_LOOPBACK_HOSTS with a comment: a CSP host-source cannot name a bracketed IPv6 literal, so frame_ancestors_value could never admit that parent.
webOrigin.test.ts now requires null for [::1]; spec 18i and the api-reference row name the three hosts that get an origin.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 14, 2026
@LachlanLindsay

Copy link
Copy Markdown
Contributor Author

Opus 5.5 finding on c7c2852e5 (span 797bddb5c4bd, an uninvited Session Manager peer reaching an opted-in app backend) is fixed in e5e11ff86.

  • The app web origin router now refuses a request that arrived on the Session Manager listener before any backend lookup. It checks by listener (SsmGate.owns, the socket's local port), because the router runs before that listener's gate has marked the request.
  • It reads the gate from the same GateRef the chain hands to token auth, which the gateway fills before that listener accepts its first connection.
  • Pinned by test_the_session_manager_listener_never_reaches_a_backend (HTTP and WebSocket, the backend sees nothing) and the new apps/app_web_origin.py entry in test_ssm_loopback_trust_sites.py's PREDICATE_SITES.

The same push, from local review before it, also:

  • caps a relayed WebSocket message at 64 MiB in each direction (a larger one closes with 1009);
  • writes a granted security event log row for every served request (refusals were already recorded);
  • relays the close code of the side that ended instead of 1006;
  • adds the app web origin row to the feature map.

Rebased onto main at c4bfed8bc.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 443dac6047930859916367483fc22a47462ddfd7 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The diff adds no dashboard control, label or state. The new pieces are a backend relay, a manifest key and an App SDK function (appWebOrigin), so there is nothing a screenshot needs to show.

[UX-REVIEWED] 443dac6

Description read

[DESCRIPTION-READ] 36ee0236626208101b66552cb48fa7ab75791640501bd0bde67c9daec414e003

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 443dac6047930859916367483fc22a47462ddfd7 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this is a generic App Kit seam aimed at a real failure (a blank frame over one ssh -L forward). Nothing is removed, and it is reversible behind a manifest opt-in.

Notes

  • Every app shares one site, apps.localhost, because localhost gets the default public-suffix rule. One app's framed third-party script can therefore send same-site requests that carry another app's SameSite cookies. Stripping Domain stops cookies being shared, but it does not stop cross-app CSRF. The spec should say so, so that app authors don't rely on SameSite here.
  • appWebOrigin returns an origin from the dashboard's host alone, so on a browser that cannot resolve *.apps.localhost the frame goes blank again. The spec relies on "the no-cors reachability probe an app runs". If the SDK shipped that probe with a fallback, each app would not have to write its own.

[DESIGN-REVIEWED] 443dac6

Description read

[DESCRIPTION-READ] fb3a2de9da7728e3d27ecdd260a063376af99f2891446804f18ddce90646adfa

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 443dac6047930859916367483fc22a47462ddfd7 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing here blocks. The new public surface has no consumer in this repo, and none can be counted here, since apps ship from outside core and the description names none. The connect-src widening is for a probe only a hypothetical app runs.

Notes

  • Item 2/3 — inherited: the only user named is "for example a local reverse proxy in front of a third-party editor". Grepping webOrigin / appWebOrigin on base finds 0 consumers, and no App repo: is named, so the manifest key and the SDK export are one-way-door surface supported by an example alone.
  • Item 5 — inherited: connect-src gains http://*.apps.localhost:* for "an app's no-cors reachability probe". appWebOrigin does no probe, and no caller in the diff fetches that origin. Subtraction: remove + APP_WEB_ORIGIN_CSP_SOURCE from connect_src_extra in security_headers.py, which drops the third allowed entry in test_dashboard_security_headers.py.

What this change ships

Inventory (10 items) — 8 justified

Intent: let an app that frames its own backend's pages work when the dashboard is reached over one ssh -L forward. ADDITION.

  1. An opted-in app is served at <app>.apps.localhost:<dashboard port>, over HTTP and WebSocket — justified
  2. New manifest key backend.webOrigin, off by default, with a name limit of 63 characters — zero consumers in this repo, external use unnamed
  3. New SDK export appWebOrigin(name) at seam level 8 — zero consumers in this repo, external use unnamed
  4. Every dashboard's CSP frame-src admits http://*.apps.localhost:* — justified
  5. Every dashboard's CSP connect-src admits the same source — inherited, for a probe no app is named running
  6. Dashboard cookies, Authorization and X-KiroCrew-* headers are dropped, and nothing is signed — justified
  7. Backend responses lose Domain on cookies and Clear-Site-Data, and frame-ancestors is replaced — justified
  8. A SEL row for each serve and each refusal — justified
  9. Non-local peers, the SSM listener and ports the dashboard does not serve get 421 — justified
  10. WebSocket messages up to 64 MiB, and normalized close codes — justified

[FIRST-PRINCIPLES-REVIEWED] 443dac6

Description read

[DESCRIPTION-READ] 6e7a7b48ca9eea98872e54ff75656c0ce7115457d68a3b35e7478d3c71cf20a8

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@LachlanLindsay

Copy link
Copy Markdown
Contributor Author

Thanks for re-running shard 7, Bolin. It failed again on the same known flake, test_the_scan_is_linear_not_quadratic ("2k tokens took 0.660s", tracked in #37446), in run 43672693644. This PR doesn't touch the denied-commands code, and everything else on 2a60c5a2b is green, including all five AI reviews. Could you re-run the failed job once more? If #37451 lands first, I'm happy to rebase onto it instead.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Opus 5.5 finding on 251fc9fac5 (aiohttp.ClientWSTimeout is missing on aiohttp 3.9 and 3.10, which setup.cfg allows) is fixed in 635dcf03eb, amended into the one commit:

  • _relay_websocket gets its ws_connect timeouts from _ws_connect_timeouts(). It returns ClientWSTimeout(ws_receive=None, ws_close=10.0) when aiohttp has it, and otherwise timeout=10.0, receive_timeout=None: the same two bounds, spelled the way 3.9 and 3.10 name them. The floor in setup.cfg stays where it is.
  • test_ws_connect_timeouts_on_every_supported_aiohttp pins both spellings; the second one runs with ClientWSTimeout deleted from aiohttp.
  • Checked for real: a WebSocket round trip with the same ws_connect keywords (max_msg_size 64 MiB, autoclose=False) works on aiohttp 3.9.5 (no ClientWSTimeout) and on 3.14.1 with -W error::DeprecationWarning.

I also read the rest of the module for other APIs newer than 3.9: WebSocketResponse(max_msg_size=, autoclose=), ClientTimeout(sock_read=), StreamReader.iter_any() and request.body_exists all exist in 3.9.

GPT 6.1 Review on 251fc9fac5 said "review incomplete" while its lane run was still going; this push reruns it. Local: the app web origin, composition contract and routes facade suites pass (121), plus flake8, mypy, black and the comment-history gate.

An app that frames its own backend's pages had to point the frame at
the backend's loopback port. The browser resolves that on its own
machine, so a dashboard reached through one ssh -L forward showed a
blank frame: the port only exists on the gateway's host.

An app can now set backend.webOrigin: true. The gateway serves its
backend at http://<app>.apps.localhost:<dashboard port>, routed by Host
on the dashboard's own listener, HTTP and WebSocket. A *.localhost name
resolves to the browser's own loopback, so the frame rides whatever
carries the dashboard, and it is a different site from the dashboard,
so no dashboard cookie or script reaches it.

Only direct local requests on a dashboard port are served, and only
for an enabled, opted-in, running app. The gateway forwards no
credential of its own and signs nothing there, and the response may
set only host-only cookies, cannot clear site data, and may be framed
only by the dashboard. The dashboard CSP admits the names in frame-src
and connect-src; the CSRF allowlist does not. appWebOrigin(name) on
the App SDK (seam level 8) gives an app its origin, or null where none
is served.
@bolichen97

Copy link
Copy Markdown
Contributor

GPT 6.1 finding on 635dcf03eb (F1, app_web_origin.py:315: an unguarded SEL write turns every app web origin decision into a 500 when the singleton cannot be built) is fixed in 443dac6047, amended into the one commit:

  • _refusal and _record_grant now write through one helper, _audit, which follows the dashboard middleware's _audit_denied. It is best-effort: when the write raises, the decision still stands (the app is served, a refusal keeps its 404 or 421), the row is lost, and a warning says so. When sel_is_warm() is False (the startup warm failed, so the next sel() would retry construction with file I/O), the write runs in asyncio.to_thread; a warm singleton is written in place, as before.
  • test_a_failing_audit_never_changes_the_decision: with a SEL whose every write raises, warm and cold, a served request returns 200 from the backend, and the two refusals return 404 and 421.
  • test_a_cold_audit_singleton_is_written_off_the_event_loop: the cold write runs off the loop thread and the warm write on it.

Local: the app web origin, security header, composition contract, SSM trust site and routes facade suites (177), test_sel_startup_warm.py, test_sync_io_in_async_gate.py and the flake ratchet (203), plus flake8, mypy, black, the comment-history gate and check_sync_io_in_async.py all pass.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

This adds a new concept, so it needs a design sign-off from a maintainer before it can merge. A maintainer will post the decision here. To propose a design, follow the request-for-change process in CONTRIBUTING.md (docs/request-for-change/).

The review found no blocking defect on this head. The change adds a new path that serves app backends before dashboard token auth and adds sources to the dashboard CSP. A maintainer decides whether to accept that.

For the security review: SSM listener, relayed, proxied and forwarded requests, non-loopback peers, and ports the dashboard does not serve all get 421 before any backend lookup. The backend target is fixed to 127.0.0.1. Dashboard cookies, X-KiroCrew-* headers and relay headers are stripped through the API proxy's own strip list, and a subset test pins that. Cookie Domain is removed from responses. frame-ancestors is replaced in each CSP policy, and every other directive is kept. The CSRF allowlist does not gain the new origin. The new tests use bound waits and port 0.

Optional:

  • The docs say each app gets "its own site". Every app origin shares the site apps.localhost, so SameSite does not protect one app from a page that another app frames. Consider "own origin", plus one sentence telling apps to check Origin or a CSRF token on routes that change state (manifest-reference.md, api-reference.md, spec §18k).
  • _record_grant writes a granted SEL row for every relayed request, asset GETs included. The SEL is size-bounded, and the dashboard's own audit records only mutating /api/ calls. Consider keeping only the refusal rows, or one row per WebSocket open or non-GET request.
  • Authorization is dropped on the app origin, so a framed site that uses bearer or Basic auth will not work. Consider forwarding it on this origin, or saying in the app docs that it is dropped.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The design reads well: the router sits inside the deny-audit boundary and ahead of the Host barrier, it refuses Session Manager listener requests by socket, it drops every gateway credential and X-KiroCrew-* header, it strips Domain from cookies, and it replaces only frame-ancestors in the backend's CSP. Nothing that main serves today is refused by this change, and the feature is off unless a manifest sets backend.webOrigin: true. I read the whole diff at 443dac6, including the tests and the SDK files. All 96 checks are green.

One blocking point: the PR adds new regex matching in product code, and the project does not take regex based parsing or validation in product code.

  1. apps/app_web_origin.py: _LABEL_RE = re.compile(r"^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$"), used by parse_app_host.
  2. website/src/app-sdk/webOrigin.ts: LABEL_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/, used by appWebOrigin.

Suggested replacements:

  • Gateway: main already has the single app name contract, app_name_error in apps/manifest_names.py. A label could be accepted when len(label) <= 63 and app_name_error(label) is None, which also keeps this door in line with every other door that admits an app name. If you want the check to stay local, a plain character test works too: non empty, at most 63 characters, every character in string.ascii_lowercase + string.digits + "-", and the first and last character not -.
  • SDK: the same plain test, for example name.length >= 1 && name.length <= 63 && [...name].every((c) => ALLOWED.has(c)) && !name.startsWith('-') && !name.endsWith('-'), with ALLOWED a Set of the lowercase letters, digits and -.

The existing test_parse_app_host cases and the webOrigin.test.ts refusal cases (a.b, -x, x-, 64 characters, a_b, Docs) already pin the behaviour, so they show whichever replacement you pick keeps it.

Happy to approve once both patterns are replaced.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 15, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 15, 2026 19:00
@bolichen97
bolichen97 disabled auto-merge November 15, 2026 19:06
@bolichen97
bolichen97 merged commit 860a01b into kirodotdev:main Nov 15, 2026
97 of 98 checks passed
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Framed app page is blank when the dashboard is reached through one SSH forward

3 participants