Repository navigation
feat(apps): let an app's own agent browse its approved sites unasked - #38333
Conversation
Sensitive Change ReviewSensitive files changed:
|
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The grant is narrow and approved by the owner, both enforcement points read one fresh source and fail closed, and rendered evidence is attached. Notes
[DESIGN-REVIEWED] f4fc457 Description read[DESCRIPTION-READ] 637e5592d78787dd4f0aedebdecb532f24c6854143bbb5751892d5097d10b3c9 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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The one new UI element, the "Browsing sites" row in the existing approval box, follows the pattern of the rows beside it. The blind reader read it correctly, and shots 1→3 show it before and after approval. Notes
[UX-REVIEWED] f4fc457 Description read[DESCRIPTION-READ] 28d20e230809c8b8809e820f0c4c5b0ef55a66dbb012aebc1f92ee19fd789fe7 That sha256 names everything this verdict read: the PR description, plus the 7 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The grant is opt-in and nothing gets it by default: the owner has to approve it, and it is confined to one app's own dashboard slot and its approved pages. The closest existing mechanism, What this change shipsInventory (10 items) — 9 justifiedIntent: an app's own agent works the owner's approved websites without an approval card on every step, and the app page controls that tab's playback right away. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] f4fc457 Description read[DESCRIPTION-READ] 5c11763f351f3277c3caf21a43390b645fe2498e96d8a42400dd1f78c75081cf That sha256 names the PR description this verdict read. Recompute it with |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: This change adds nothing to the three shell deny tiers. It adds one grant row ( TIGHTENING: the browser op route's committed-URL gate ( ADJUDICATED: 15 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: I wrote candidates in posix and windows spellings. The diff's only platform-shaped assumptions are about URLs:
No candidate could probe the URL-matcher assumptions. Those are covered under UNADJUDICATED. UNADJUDICATED:
[SCOPE-REVIEWED] f4fc457 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
bc66573 to
81b46e8
Compare
Sensitive change review
|
81b46e8 to
e2e8959
Compare
Sensitive change review
|
e2e8959 to
cd1e9b9
Compare
Sensitive change review
|
Sensitive change review
|
cd1e9b9 to
e15422c
Compare
Sensitive change review
|
e15422c to
b6c8adb
Compare
bc9f739 to
39a922a
Compare
Sensitive change review
|
1 similar comment
Sensitive change review
|
An app whose agent works a website for the owner met an approval card on every browser call, and Always allow is refused for Crew's own tools, so search-and-play took a dozen clicks. permissions.browserSites names exact https origins plus a path pattern each. Install never approves them: the owner approves them on the app's page (an owner-approved, explicit-only staged family). While the app is enabled, trusted and approved, the tool gate's new app-browser-sites row approves the app's OWN sessions' browser calls, and only a navigate or new tab onto those pages. The op route holds such a session to the pages whoever approved the call: a request off them is site_not_allowed, and a landing off them is moved to about:blank by the existing landing checks. POST /api/browser/media is the owner's play, pause, seek and volume on that session's tab, through a walker method run in the isolated world. It refuses the internal secret, non-owners and app tokens, and any session no app with approved sites owns. The SDK's useBrowserMedia hook reaches it; APP_SDK_LEVEL is 10. The owner accepted the risk of the agent typing and clicking in a logged-in browser on the approved sites; a stronger sandbox is a follow-up. Closes #38306
Sensitive change review
|
39a922a to
f4fc457
Compare
Continuous play: can an app's backend learn a song ended and wake its agent with the page closed?No, not today. Checked on this head:
With the page open, the page's Smallest missing piece, not built here: a gateway-side watcher for a held app session's tab. It would read the |
|
This changes behaviour users already rely on, so it needs a design sign-off from a maintainer before it can merge. A maintainer will post the decision here. This PR adds a grant that lets an app's own agent run browser calls with no approval card per step. A design that lets an agent skip a person's approval is decided by a maintainer and the security reviewer, so this review does not approve it. The open RFC #38322 covers app access to Crew's browser through a different permission ( Review result on f4fc457: no blocking defect found. The review traced the For the security review:
|
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 30% chance that this change introduces a defect, above the 12% limit for approving on its own. This PR adds an owner-approved
The one real weakness is the residua Tier: 2, held for a person: security-sensitive path. 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 |
bolichen97
left a comment
There was a problem hiding this comment.
Review of f4fc457.
Not approving: the code-change-approver says a person should decide, and the Captain asks for a maintainer design sign-off, including whether browserSites stands alone or folds into RFC #38322 (permissions.browser with an act verb). That call is a maintainer's, not mine. No blocking code defect found on this head.
What I checked, against the four questions that matter for this grant:
- Who approves the sites.
browserSitesis registered explicit-only (apps/point_grants.py) and is in_OWNER_APPROVED_FAMILIES(apps/manager_records.py:1145), so an install approves none. I also traced the legacy paths: a missing set approves nothing (_read_approved_grants, manager_records.py:1000), and an "approve what is declared" set freezes explicit-only families to[](manager_records.py:1050). So the app cannot approve its own sites; only the owner's approval writes them. - Browsing outside the list. I probed
url_matchesandentry_refusaldirectly. Refused: other subdomains (m.youtube.com), look-alike hosts (www.youtube.com.evil.com), any port (:443too), user info,http, dot segments,%2e/%2fescapes,\@evil.com. Entries that are IP literals (127.0.0.1,10.0.0.1,169.254.169.254),localhost,[::1], and*.wildcards are refused. Every landing is also ANDed with the existing public-URL gate (browser_ops._site_gate), so redirects and links off the list are blanked by the same landing checks. - What "unasked" skips. Only the gate's
app-browser-sitesrow, after every deny row and governance;confirm_toolsstill asks,classifier_onlyskips the row, and the row needs adashboard:slot, verified@kirocrew-core/browseridentity, and an on-list URL fornavigate/tabs new. A subagent, cron or channel session of the app keeps its card. - Reuse by another app or chat. The gate row keys on
facts.appfrom the slot's_app, so another app's slot or a person's chat gets no grant.
Notes for the person deciding (non-blocking):
src/kiro_crew/dashboard/handlers/browser_media.py:104and:114: the media route checks that the slot belongs to an app with approved sites, not to the app whose page is calling. The scoped client is a same-origin owner-cookie fetch, so any app page that declares/api/browser/mediacan play, pause, seek or read the state of another app's tab if it knows that slot key. Impact is small (media controls only, no browsing), but it is a cross-app reach. Comparing the slot's_appwith the calling page's host-bound session would close it.src/kiro_crew/apps/browser_sites.py:83: entries use theframeSourceshost rules, which do not resolve DNS.https://foo.local/xor an internal hostname is accepted as an entry, and the public-URL gate does not catch it either. The owner still approves it on the app page, so this is a consent-text question rather than a hole.src/kiro_crew/apps/browser_sites.py:198/dashboard/handlers/browser_ops.py:397: once a slot was granted, it is held toNO_PAGESfor the life of the process after its sites go, even for calls the owner approves by hand. Fails closed, but the Captain's point about bounding it or saying so in the refusal text stands.src/kiro_crew/dashboard/handlers/browser_media.py:92: a media POST refused bycapabilities.browsewrites no audit row;audit=request.method != "GET"would match the sibling routes (also raised by the Captain).- The residual named in the body (the shim resolves a key other than the slot the gate approved, so the route does not confine the call) is real; it is accepted in the spec, and the decision should say whether that is acceptable.
Bot findings on this head: GPT 6.1 and Opus 5.5 no findings; Design, UX, First Principles and Security Scope PASS. I agree with the Captain's four security notes; none is a defect in the shipped paths.
Tests: ran test/test_app_browser_sites.py, test_gate_tiers.py, test_browser_live_routes.py, test_browser_browse_governance.py, test_hooks_composition_contract.py, test_json_object_body_guard.py and test_mcp_listing_import_budget.py on this head: 439 passed.
AI-assisted, sent by Bolin Review bot
|
Maintainer decision, @iamwhatever: this PR is on hold until the browser RFC #38322 (app SDK browser: a permission-gated view, read and annotate surface) is decided. Both give apps a way into the browser, so we want that design settled first and then fit this change into it, rather than land two separate grants. No code changes are asked for now; the review findings above still apply when it resumes. AI-assisted, sent by Bolin Review bot |
Follow-up to #38333 from the review on it (5947126093). A media POST refused by capabilities.browse now writes its audit row, like the sibling routes; the state poll (GET) still does not. A slot held to NO_PAGES after its app's sites were withdrawn now says so in its refusal, and how the hold ends: enable the app and approve its sites again. Behaviour is unchanged. The spec now says the media route cannot tell one app's page from another's: a page module runs with the owner's cookie, so that needs an app-scoped credential, which is out of scope here.
…38866) Follow-up to #38333 from the review on it (5947126093). A media POST refused by capabilities.browse now writes its audit row, like the sibling routes; the state poll (GET) still does not. A slot held to NO_PAGES after its app's sites were withdrawn now says so in its refusal, and how the hold ends: enable the app and approve its sites again. Behaviour is unchanged. The spec now says the media route cannot tell one app's page from another's: a page module runs with the owner's cookie, so that needs an app-scoped credential, which is out of scope here. Co-authored-by: zejiangg <zejiangg@amazon.com>
Problem / Motivation
Goal: An app's own agent can drive Crew's browser on the pages the owner approved for that app, without an approval card per step, and the app's page can pause, play, seek and set the volume of that tab at once.
An app whose agent works a website for the owner (search it, open a result, play it) meets an approval card on every
browsercall, and "Always allow" is refused for Kiro Crew's own tools. One search-and-play is 8-15 calls, so the owner either clicks a dozen cards or gives up. The app page has no way to pause or change the volume of that tab without starting an agent turn.Why it matters
Apps that need the owner's own logins and sound (first: the Mood Music app, playing YouTube and bilibili in the owner's Chrome on a Mac-local gateway) cannot use the browser in practice today. The only wider workaround, a standing grant for the browser tool, would cover every agent on every site.
Not a goal
What changed (motivation → approach → change)
Goal → the narrowest grant that removes the per-step card for one app only → three pieces.
Declaration and approval.
permissions.browserSiteslists exacthttps://origins plus a path pattern each (https://www.youtube.com/watch,https://www.bilibili.com/video/*;*matches any run of characters by a linear search with no backtracking; the query is not compared). Entries are validated likeui.frameSourcesorigins plus a strict path (apps/browser_sites.py). The family is staged, explicit-only, and in_OWNER_APPROVED_FAMILIES, so an install never approves it: the owner approves it on the app's page, which says what it allows.app_browser_sites(app)reads it fresh per call and is empty unless the declaration validates, the entries are approved, the app is enabled and trusted.Two enforcement points. A new grant row in the tool gate,
app-browser-sites(a thin facade row,hooks._tier_app_browser_sites, whose conditions inapps/browser_sites.gate_grantsare imported only when a call reaches it, so nothing is added to an MCP listing's imports and the listing ceilings stay at main's values; after every deny row and governance), approves a call only when the caller is the app's own dashboard slot (facts.appon adashboard:session key, the kind the op route resolves; a subagent or channel session the app started keeps its card), the call is@kirocrew-core/browserby verified identity, the app holds sites, and a URL the call names (navigate,tabs new) is one of them.confirm_toolsstill asks;classifier_onlyskips it. The op route (browser_ops.session_sites) holds every op of such a session to the pages whoever approved it: a request off them answerssite_not_allowedbefore the browser is touched, and the op context's page gate is narrowed so a redirect, link or history landing off them is moved toabout:blank(redirect_refused) by the existing landing checks. A slot the gate approved a call for stays held once its sites are gone (it then opens no page), so a call approved before a revoke or a manifest edit never runs unconfined. I picked refusal over falling back to a card for off-list pages: the gate cannot see where a click lands, the route can, and a refusal fails closed.Media buttons.
POST /api/browser/media(handlers/browser_media.py) runs a new walker method,media, in the isolated world on the session's own tab: play, pause, seek, volume, state of the main<video>/<audio>. It refuses the internal secret (403internal_secret_required), non-owners and app tokens (owner_only), askscapabilities.browse, and acts only for a slot an app with approved sites owns (not_app_browser). It never starts the browser (no_tab), and leaves a tab the person has taken over alone (user_in_control), under the same takeover fence the agent's ops take. A play the browser refuses gets one click on the element to unlock autoplay, after the page is judged again (per request, so a tab that moved to another site unlocks again). Astateread writes no audit row, since a player polls it. The SDK'suseBrowserMediahook reaches it (APP_SDK_LEVEL10, joining the batch level 10 opened on main).Continuous play (owner's scope addition). The state read (
GET /api/browser/media?session_key=:paused,ended,currentTime,duration, ...) is the signal;useBrowserMedia(sessionKey, { pollMs, onEnded })callsonEndedonce per ending, derived in the page from the state it already polls. That is the smallest fit with the existing app-kit pattern (page polls an owner route through the scoped client): no new route, event or SSE stream, and nothing the agent can reach. The page can then send the app's own agent a message, or post to the app's own backend. With the page closed nothing reads the tab, so no ending is seen (details in a PR comment).Risk the owner accepted. The app's agent types and clicks unasked in a browser that may hold the owner's logins, on the approved pages only. A stronger sandbox is a follow-up. Residual: the route finds the session from the key the browser tool's shim resolves; a call whose shim cannot name the app's slot is not confined there, while the gate approved it for that slot.
Docs: app-kit-platform §44, manifest and API reference, browser.md (security rows), the gate table in memory-skills-hooks.md.
Backwards compatibility
Compatible: the field is new and optional, the route and hook are new, and a session no app with approved sites owns browses exactly as before.
Removes nothing: no route, key, row or behaviour is hidden, deleted or tightened for any existing caller.
Tests
test/test_app_browser_sites.py(new): entry validation and URL matching (dot segments, escaped separators, port, user info, look-alike hosts refused); install approves nothing and the owner's approval does; disable, withdrawn trust, a dropped site and an invalid live edit end the grant at once; the gate row approves only the app's own browser call on its pages and leaks to no other app, caller, tool, server, unverified identity or off-list URL;confirm_toolsandclassifier_onlystill ask; the op route refuses an off-list request before the browser and blanks an off-list landing, and a person's session is unchanged; a subagent, cron or channel session of the app keeps its card; a pathological landing path against a many-star pattern stays linear; the media route refuses the internal secret and an app token, leaves a taken-over tab alone, refuses a session no app with sites owns, validates action and value, never starts the browser; a refused play clicks once and a play that starts clicks nothing, also after the tab moves to another site; a state poll writes no audit row; media on an off-list page is blanked.stateread); every mutant fails the new tests.test/test_gate_tiers.py: the golden order and one scenario for the new row.test/test_browser_live_routes.py,test/test_browser_browse_governance.py: the media route joins the owner-only and governed route lists.test/test_hooks_composition_contract.py: the row is listed as a facade definition (gate_tiersis at its line cap, and an owner module would add to every listing's import count).test/test_mcp_listing_import_budget.py: unchanged. The media state read is aGET, so a player's poll writes no audit row.AppDetailPageCoverage.test.tsx: the staged sites row and its consent;AppSdkBrowserMedia.test.tsx: the hook.Proof: not provable -- other: new feature; every guard is covered by the mutation checks above instead.
Manual verification
website/scripts/capture-38306-browser-sites-approval.mjson the built SPA: the staged row, the consent it sends, the approved state, light and dark.about:blank. That needs the app PR that declares the sites.Screenshots / video
Staged browsing sites on the app's page (light, dark):
After approval
Related Issues
Closes #38306
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.