Skip to content

test(browser): add fixture connector for public egress control - #20

Merged
senamakel merged 83 commits into
epic/7328-security-busfrom
tinycomputer-7328-public-control
Oct 23, 2026
Merged

senamakel merged 83 commits into
epic/7328-security-busfrom
tinycomputer-7328-public-control

Conversation

@senamakel

Copy link
Copy Markdown
Owner

Adds a test-connector-gated final TCP connector seam to TinyComputer's loaded browser module. The module still uses its real BusAuthorizer and consumes the exact authorized public socket; the fixture-only map redirects only 8.8.8.8:<port> to 127.0.0.1:<same-port> and fails closed for every other socket. Feature-off builds reject the test-only config field.

A loaded-module Chromium test asserts the public address through authorization, grant consumption, and lease validation, then reads the actual response body from a local listener. The callback host in this TinyComputer-owned test is a fixture policy. OpenHuman's follow-up must compose this seam with real TinySecurity policy before tinyhumansai#111 is complete.

Validation: cargo fmt --all -- --check; cargo clippy --all-targets --all-features -- -D warnings; cargo build --all-targets --all-features; cargo test --all-features; feature-on cdylib build and feature-off library check. The focused loaded-module Chromium test is opt-in and documented in crates/tinycomputer-browser/src/egress/README.md; hosted CI currently has no Chromium-backed lane for it.

Part of tinyhumansai/openhuman#7328
Refs tinyhumansai#111

senamakel and others added 30 commits October 22, 2026 01:21
…d socket

The live Chromium egress test now keeps the fixture listener open after the
first response and counts any further connections, so a policy-denied
navigation that still reaches the previously allowed socket is caught instead
of passing silently. The fixture also serves a minimal HTML document and
signals via a oneshot channel once its response is written, letting the test
wait on the actual request rather than on the server task finishing.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Collapse a two-line let binding back onto a single line so the live
chromium egress test matches the surrounding formatting. No behaviour
change.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ress-7328

test(browser-egress): exercise host authorization through module
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…erence

Update the vendored submodule pointers for agent-browser, agent-desktop,
tinybus and tinyinference to their latest revisions.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a 2.27 section describing the optional opaque host_context on ContinueTaskRequest, how it is copied unchanged into ReviewActionRequest during consequence review, and that the bus redacts it from Debug output. Notes that hosts using the relay must validate and bind the context themselves, and that omitting the field preserves prior behavior.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Regenerate the lockfile, dropping unused transitive crates and
consolidating duplicate dependency versions. The workspace crates are
also pinned back to 0.9.4, matching the current manifests.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The bus host test double now declares the review method confidential, and the
bus port calls it through call_confidential so the request is routed over the
confidential path.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The review method is no longer marked confidential, so the bus port now
invokes it through the plain call path instead of call_confidential. The
test host's confidential attribute was dropped to match.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The continue_with_handle test helper now supplies a HostContext so the
fixture matches the current task input shape.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The continue task schema now documents an optional host_context string marked
x-host-only, so hosts can pass opaque context for consequence review without
agents setting or modifying it. A test asserts the field is present and flagged
as host supplied.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…hosts

Adds a test asserting that the bus port denies a review carrying host
context when the host is not confidential, and that the host never sees
the request.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The consequence gate now accepts an optional host callback destination from
the `consequence_host` config field and sends reviews carrying host context
over a confidential call to that unique name. Requests with host context are
rejected when no confidential callback was configured, so sensitive context
can no longer reach an unconfidential host.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The README now explains that setting consequence_host to the unique
destination from ModuleHost::prepare_host_callbacks enables confidential
consequence reviews, and that a ContinueTask carrying host context fails
closed unless that callback is configured. The BusPort constructor call in
the tests was updated to pass the new optional host argument, and two
blocks were reindented.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The ContinueTask request schema no longer advertises host_context, since
that field is injected by the trusted host and is not an agent-settable
argument. The schema test now excludes it from the documented fields and
asserts it is absent rather than checking its x-host-only marker.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a test asserting that the describe schemas document every field of the
continuation request, mirroring the existing coverage for plan requests.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…nsequence-context

feat: relay host context to consequence reviews
…refuse Return before a stop

A flow's click gate only knew a 12-word substring list, so "Post",
"Transfer $500", "Checkout", "Log out" and "Sign" were pressed inside
an ordinary step with no approval. They are now matched as whole words,
with "Sign in" carved out.

The confirm shortcut pressed Return on a window even when the flow stops
before an irreversible step; in a composer Return sends. It is now
refused outside a search box whenever the flow declares a stop_before.
The two tinyinference crates are now declared as git dependencies pinned to a
revision instead of path dependencies, so an embedding workspace can redirect
them to its own shared copy. A matching patch entry keeps standalone builds on
the vendored submodule, and the vendored submodules are bumped to their latest
commits.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ngle-inference

fix(deps): share TinyInference with embedding workspaces
…tion-gate

fix(flow): gate post/transfer/checkout/logout/sign and refuse Return before a stop
Add a live Chromium test that loads a page spawning a worker which fetches a
denied private address, asserting the request reaches the host egress
authorizer and never connects directly. The fixture server now takes an owned
body so the generated page HTML can be passed in.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted the browser egress live tests to satisfy rustfmt, wrapping
overlong lines and collapsing a multi-line format! call. No test
behaviour changed.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Expand the lint allowlist for the opt-in real-Chromium test module to cover
too_many_lines and unused_async, and sort the existing entries. The module
doc comment now wraps TinyComputer in backticks for consistency.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 28 commits October 23, 2026 03:19
Adds a new live test module covering authority denial, and lets the fixture
egress host report a grant generation that differs from the requested one so
those cases can be exercised.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Replace the manual read check with an assert, use map_or_else for the URL
path fallback, and scope the observations lock to a block so it drops
before the proxy is closed. Add an allow for the long test function to
keep clippy quiet.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
A `do` step had a fixed eight turns (`DO_TURNS`). On a shop's cart or
checkout one step can need more moves than that, and the step then fails
as not accomplished while it is still making progress.

- `TaskBudget.max_do_turns` and `RunFlowRequest.max_do_turns`: optional,
  8 when unset, capped by the module at 32 (`MAX_DO_TURNS`).
- The task controller passes the budget's limit to every flow run.
- Contract 2.28; the thresholds table, the task docs, the StartTask
  schema and the described budget list the field.
…le-do-turns

Let a task set how many turns a do step may spend
…rror-class-first

fix(browser): classify page script errors before keyword matches
…eclines-approval

test(consequence): a host denial turns a service-level approval into a decline
…-helper-cache-dir

test(accessibility): helper cache dir and reply-id matching
test(browser): cover redirects and proxied transport classes
Adds a feature-gated bind_with_test_connector entry point that lets host
integration tests substitute the final TCP connector while keeping
authorization, grant consumption, and proxy forwarding on the production
path. The connector receives the socket address only after authorization
and consumption, so tests can map approved public socket operations onto a
local fixture listener without making real network connections.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wrap the fixture listener accept and the client read in five second
timeouts so a stalled proxy fails the test with a clear message instead
of hanging indefinitely.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reorder the fixture await so the response is inspected before the fixture task is joined, and include the captured calls in the status assertion message to make failures easier to diagnose.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The fixture password constant and the proxy auth header now use the
tinycomputer username and a renamed secret so the test matches the
credentials the proxy actually expects. The listener accept call was
also reflowed to satisfy formatting.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a crate-level allow for clippy's expect_used, panic, and unwrap_used lints in the feature-gated connector integration tests, since panicking assertions are the intended style there.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a test-connector feature that lets host integration tests replace only the final TCP connect in the egress proxy, so authorization, grant consumption, and proxy forwarding still run on their normal paths. The fixture connector receives the exact approved socket and maps it to a local listener, keeping live tests off the public network.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The live test referenced the connector install helper through the
tinycomputer crate name, which does not resolve from within the crate's own
test module. Switching to a crate-relative path keeps the test compiling
without changing what it exercises.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test connector override now records the policy id and generation it was
installed for, and lookups only return it when both match, so a fixture can no
longer leak into a differently scoped egress policy. The live test helpers were
extended to start browsers under an explicit policy and generation and to share
observations across sessions, which lets the new scoping behaviour be exercised.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The assertion that all calls after the third start with "validate:" now
includes a message printing the observed calls, so a failure shows the
actual callback and connector event order instead of a bare panic.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…uests

The live public connector test now expects the fixture lease validation call to
appear immediately after the socket connect, and checks that any remaining
calls are background public requests that stop at authorization rather than
reaching the connector.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The feature-gated test_support module and its process-global connector slot
are gone; the test-connector override now lives on BrowserDefaults as an
exact public-to-loopback socket mapping, so fixtures no longer need a
global install step and the connector is scoped to the configuration that
created it.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Host integration tests can now supply a single approved-to-fixture socket
mapping through the TinyComputer module config instead of installing a
process-wide connector, so the live egress tests exercise the same
grant-consumption path as production. The egress README documents the
test-only field and the stricter module-config mapping, and config tests
cover its parsing.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The TestConnectorMap fields and its connector method are now pub(crate) so
other modules in the crate can build and inspect the map under the
test-connector feature.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Move the egress proxy construction out of the navigate handler into a
bind_egress_proxy method on Linked, so the test-connector and default
paths share one place. The existing tests now set the test_connector
field to None under the test-connector feature to match the struct.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Explain that the loaded-module Chromium test is opt-in and excluded from
hosted CI, and add the local command for running it with Chromium installed.
Also note the test's use of a local HTTP listener and the fixture callback
host, with real policy composition covered by the OpenHuman fixture.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The egress README now spells out how a test-connector build supplies the
test-only module-config mapping, naming the browser.egress.test_connector_map
key and its approved/fixture JSON shape so the fixture is discoverable without
reading the parser.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that the enforced launcher binds its egress proxy on
127.0.0.1 before any browser is opened, so the local-only binding guarantee
is exercised directly.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit 35b9f5b into epic/7328-security-bus Oct 23, 2026
12 of 13 checks passed
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.

3 participants