You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Accept saved state under --allowed-domains when every site in it is allowed
#2605
--allowed-domains refuses --state, state load and --restore, because loading saved state "replays saved origins before agent-browser can verify they are in the allowlist". When every origin and cookie domain in the saved state is already allowed by the list, there is nothing to verify after the fact. Could the allowlist accept saved state in that case?
Use case
An agent works in a few sites under --allowed-domains and needs to stay signed in across runs. Today the only way to do that under the allowlist is to launch fresh and set each cookie with cookies set and each localStorage entry with storage local set after navigating to its origin. That is what state load already does, but state load is refused even when the state only holds sites from the list.
Proposal
When --allowed-domains is set, accept --state, state load and --restore if every entry in the state is allowed:
each cookie's domain matches the allowlist (a leading . matched like a subdomain), and
each origins[].origin has an allowed host.
Otherwise, keep refusing, and name the first entry that isn't allowed, for example --allowed-domains is not supported with state load: cookie domain .other.com is not in the allowed domains list.
The domain filter (Fetch interception, the init script, and the WebRTC controls) would be installed before the state is applied, as for any launch under the allowlist. Saved state then only restores data for sites the filter already lets the page reach.
What stays refused
--profile, --cdp, --auto-connect, and startup args that open pages or select a profile: those can run page scripts before containment is installed, which saved state does not.
Reproduction of today's behavior (0.43.0)
agent-browser --session s --allowed-domains example.com open https://example.com/
echo'{"cookies":[],"origins":[]}'> state.json
agent-browser --session s state load state.json
# --allowed-domains is not supported with state load because loading state replays saved origins
Related: #2574 (another case where the allowlist and real sites collide), #1546 (where the refusal was added).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
--allowed-domainsrefuses--state,state loadand--restore, because loading saved state "replays saved origins before agent-browser can verify they are in the allowlist". When every origin and cookie domain in the saved state is already allowed by the list, there is nothing to verify after the fact. Could the allowlist accept saved state in that case?Use case
An agent works in a few sites under
--allowed-domainsand needs to stay signed in across runs. Today the only way to do that under the allowlist is to launch fresh and set each cookie withcookies setand eachlocalStorageentry withstorage local setafter navigating to its origin. That is whatstate loadalready does, butstate loadis refused even when the state only holds sites from the list.Proposal
When
--allowed-domainsis set, accept--state,state loadand--restoreif every entry in the state is allowed:domainmatches the allowlist (a leading.matched like a subdomain), andorigins[].originhas an allowed host.Otherwise, keep refusing, and name the first entry that isn't allowed, for example
--allowed-domains is not supported with state load: cookie domain .other.com is not in the allowed domains list.The domain filter (Fetch interception, the init script, and the WebRTC controls) would be installed before the state is applied, as for any launch under the allowlist. Saved state then only restores data for sites the filter already lets the page reach.
What stays refused
--profile,--cdp,--auto-connect, and startup args that open pages or select a profile: those can run page scripts before containment is installed, which saved state does not.Reproduction of today's behavior (0.43.0)
Related: #2574 (another case where the allowlist and real sites collide), #1546 (where the refusal was added).
All reactions