Skip to content

fix(daemon): enforce tenant and ingress security boundaries - #5243

Closed
thymikee wants to merge 15 commits into
mainfrom
fix/daybreak-daemon-boundaries
Closed

thymikee wants to merge 15 commits into
mainfrom
fix/daybreak-daemon-boundaries

Conversation

@thymikee

@thymikee thymikee commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Closed as superseded by #5343 and #5344 on the 0.22 remediation line. Continue review and implementation there. Historical validation below remains attributed to its original commits; closure does not claim the replacements are merge-ready.

Summary

Enforce tenant ownership for cloud and local artifacts, cap in-flight uploads and RPC bodies, and stop waiting on HTTP auth hooks after disconnect. Bound replay sources at daemon admission. This addresses daemon and proxy findings in Daybreak scan wfr_62518a30795e3d4866f99342f762ecbde8dd57570bf78ea1c80892aea2c7f6d8.

Before / after

  • Artifact reads require matching tenant ownership.
  • RPC and upload requests fail with capacity reasons at the configured limits.
  • Daemon admission decides the replay source limits, including for private gateways.

Validation

At 48c1a552ea, GitHub reports 24 passing checks. The recorded local run passed 166 focused proxy and daemon ingress tests and typechecking. The Node adapter preserves the typed response when the handler cancels an unread body.

Post-close artifact ownership is covered in #5278. Client tenant propagation across upload phases and the shared staging budget are in #5281. The hookless HTTP fixture covers upload and consumption with a declared tenant. Hookless native install evidence is pending. #5282 owns the five-second RPC preauthorization deadline and slot lifecycle and is stacked on #5281.

At 5d785de57c, the command reference explains how to rerun web setup after upgrading from managed browser 0.39.0. The commit only changes documentation, so runtime tests do not apply. Hosted checks are pending.

61f0e4de9a passed merge-tree. CI pending.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.77 MB 6.78 MB +6.9 kB
Package (unpacked) 6.77 MB 6.78 MB +6.9 kB
Package (download) 2.07 MB 2.07 MB +2.5 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.3 ms 22.1 ms -0.2 ms
CLI --help 48.1 ms 46.1 ms -2.0 ms

Affected plugins

Plugin Installed (including dependencies) Unpacked Download
@agent-device/revyl 180.6 kB → 181.2 kB (+556 B) 180.3 kB → 180.8 kB (+556 B) 58.4 kB → 58.6 kB (+186 B)
@agent-device/testmu 26.1 kB → 26.5 kB (+464 B) 25.7 kB → 26.2 kB (+464 B) 9.4 kB → 9.6 kB (+208 B)
@agent-device/tizen 99.5 kB → 99.5 kB (0 B) 99.1 kB → 99.1 kB (0 B) 34.9 kB → 34.9 kB (+2 B)
@agent-device/webos 98.5 kB → 98.5 kB (0 B) 98.1 kB → 98.1 kB (0 B) 34.6 kB → 34.6 kB (+1 B)

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 27 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/proxy/src/rpc-body-budget.ts Resolved
Comment thread website/docs/docs/commands.md Resolved
@apex-sentinel-staging

This comment has been minimized.

@blacksmith-sh

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

At c4f9376, this change needs fixes before merge. The main problem is that remote install appears to fail after a successful upload when the daemon or proxy has no auth hook.

Does a caller that declares a tenant now lose access to its own upload? tenant-owned-entry.ts:38 requires an exact tenant match, and session-app-deployment.ts:80 and install-source-resolution.ts:51 read with the RPC tenant. Upload routes take the tenant from the hook or the x-agent-device-tenant header (http-authorization.ts:191), but the upload client does not send it. Over ssh -L, or agent-device proxy without authenticate, the upload would succeed and install or install-from-source would fail with "Uploaded artifact is not owned by a tenant". This affects lease-backed and --tenant connections, and it works on the base. The rule: for one caller, every route that registers a tenant-owned entry must resolve the same tenant as every route that reads it. Please send buildDaemonHttpTenantHeaders on every upload client route (legacy, preflight, finalize), and add an HTTP test that uploads with no hook and then installs with meta.tenantId. Exact matching only for hook-attested tenants is another option, but it is a compatibility choice that needs maintainer approval.

The RPC budget has 32 global slots. A slot is taken when headers arrive, before authentication, and is held through command dispatch (http-server.ts:313). The daemon body read has no short deadline of its own (about 665 s), and the proxy reads the full body before it checks authorization. So 32 slow unauthenticated requests to a tunnelled proxy can make every authenticated caller get 503. On a shared host, 32 long commands can also refuse the next caller from any tenant, as the budget test partly shows. The base serves these callers. The rule: the budget bounds bytes buffered before admission, and no caller holds a count slot past authentication or a short pre-auth deadline. This applies to every RPC entrypoint in the daemon and the proxy; the byte reservation can stay through dispatch if the body needs it. Please update security-trust.md and test that an authenticated caller succeeds while 32 unauthenticated bodies are held.

Can staged uploads exceed the documented limits? The only capacity check is in resumable preflight (resumable-upload.ts:116). Legacy POST /upload, still served and used as the client fallback, stages with no count or byte admission. A finalized resumable upload also leaves the counted map while its file stays staged. The rule: every staged byte from any upload route counts against one per-tenant and daemon-wide budget until it is consumed or expires. Reserve it after tenant authentication and before any staging directory is created, using the per-request maximum when the size is unknown.

Does close followed by agent-device artifacts --json still work on cloud providers? A lease-ID read now requires an active lease (lease.ts:571), but close releases the lease. The CLI next step and device-clouds.md still tell users to run it. On the base, BrowserStack, AWS Device Farm and TestMu AI served released leases; here the call would fail with "Lease is not active". The rule: a lease-ID read is admitted when the caller owns the lease, active or inside the existing retention window, with tenant, run and provider matching. The alternative is to change the CLI text and docs to pass the provider session ID that close returns. Either way, please test a release followed by a lease-ID read. A maintainer decision is needed here first.

Live validation is required before merge, because this changes remote app install and the PR reports no live remote or device run. After the upload fix, run agent-device proxy without authenticate (or a token-only daemon over ssh -L), connect with --tenant or a lease, and run install <local .apk or .app> on a device. The pasted output must show the upload followed by install success, not "Uploaded artifact is not owned by a tenant".

A second independent pass found the same upload ownership gap on same-origin chunk requests (daemon-artifacts.ts:199, upload-client.ts:419), and it also affects reinstall. Can the rule cover every upload transfer request, including chunks, with the same normalized tenant, while hook attestation and the proxy tenant stamp stay authoritative?

A second independent pass found that, on a daemon with no auth hook, a caller with no admitted tenant can name an existing leased session and inherit its tenant, run, lease and provider (lease-context.ts:85, lease.ts:106). The lease-exempt artifacts command then reads as that owner, unlike GET /artifacts. Should artifact authorization always come from the admitted caller, with the session used only to find the target lease and provider and then checked against that caller?

A second independent pass found that a tenant can still list, download and remove retained screenshots and recordings after its lease ends (artifact-tracking.ts:438), because entries carry no lease ID. Should each entry record its producing lease, and should inventory and download check it? This conflicts with ADR 0024, which keeps teardown recordings, so an active-lease-only requirement needs that conflict settled explicitly.

A second independent pass found that a tenant with a new lease can consume an upload from an ended lease through install, reinstall or install-from-source (artifact-tracking.ts:535). release_materialized_paths has the same gap (materialized-path-registry.ts:117). Should uploads and materialized paths record the validated lease and require it for consumption or caller-initiated deletion, while host-local entries and internal cleanup stay as they are? The client already sends the lease on transfer requests, but the daemon does not read that header.

A second independent pass found that a provider-session ID lookup skips active-lease admission after release (lease.ts:570), and a test expects that. It matches the documented past-session lookup. If only active owners may read artifacts, should this path check the resolved lease too, or should the docs and requirement state the exception?

A second independent pass found that Limrun's settled HAR lookup after release is now refused before it reaches the runtime (lease.ts:571, runtime.ts:706). The HAR can hold captured credentials. Should the owner get it in the close or release result, or should the retained owner record be an explicit exception?

A second independent pass found that legacy POST /upload bypasses the cap even for the standard client: a capacity 503 from preflight becomes undefined and triggers the legacy route (upload-http.ts:149, upload-client.ts:322). With the shared reservation above, can the client also keep the typed capacity refusal and not fall back?

A second independent pass found that unauthenticated or still-authenticating daemon requests can fill the RPC pool, including a complete body waiting on a stalled auth hook (http-server.ts:324). Can header credentials be checked before the shared pool is charged, with body-token and hook authentication under their own short deadlines and limits?

A second independent pass found the same problem in the proxy: the body read only follows the request abort signal, and external authentication can hold a slot while the client stays connected (daemon-proxy.ts:209). Can one short ingress deadline cover both the body read and the hooks?

A second independent pass found that an over-limit proxy read awaits reader.cancel() before it releases the reservation (rpc-body-budget.ts:58). If cancellation stalls, the charge stays. Should the refusal path release and return the budget error without waiting for cleanup?

A second independent pass found that the Node proxy can drop the connection instead of returning the capacity 503: cancelling the adapted body destroys the unfinished request before the response is written (rpc-body-budget.ts:31). Can the Node adapter write the refusal first, with independent cancellation kept for the Fetch entrypoint?

A second independent pass found that direct tenant HTTP through a tunnel or gateway, with no auth hook and no network-access marker, passes without publicNetworkOnly (http-authorization.ts:68). That admits managed web binds and skips raw replay validation. Should remote-tenant provenance be derived at trusted ingress for direct and proxied HTTP, with the host-local transport left on its local path?

A second independent pass found that replay source bundles with empty names and texts add nothing to either budget (script-source.ts:31), so many of them still reach suite discovery. Can empty names be rejected, and each bundle carry a minimum cost or the bundle count be capped?

Not blocking: these can be taken or left: make the web refusal help and commands.md say it covers requests through the remote proxy or to a daemon with an auth hook; leave the download-path paragraph to #5246; move or rename the reason table holding UPLOAD_CAPACITY_EXCEEDED and type the flags parameter in remote-host-input-policy.ts as DaemonRequest['flags']; and extend the daemon budget test to destroy the held requests and show that the next authenticated RPC succeeds.

Could a smaller design cover this: the tenant header on every upload route instead of a daemon special case; one aggregate RPC byte budget with a short pre-auth deadline and the count slot released at authentication or removed, mirrored in the proxy; one staged-byte budget in upload admission; lease-ID reads through the registry's existing post-release ownership record; and the web refusal and replay bound as a separate small PR? The package grows by 4.1 kB. Only the post-close artifacts behavior needs a maintainer decision first.

The dispatch slot thread still applies. These threads no longer apply and can be resolved: this one, as the hook now follows the request abort signal; this one, as the body read now cancels on abort and releases; this one, as lease admission no longer depends on a tenant being present; this one, as the capacity error now maps to 503; and this one, as the commands.md wording matches the code (only the CLI help differs, noted above).

22 of 23 checks pass, including the unit and repo guard jobs that cover the changed daemon, proxy and replay code. The Body rules check was cancelled, not failed; it checks the PR description, and the cancellation looks unrelated to this diff, likely replaced by a newer run.

Not verified here: no tests or live runs were done, and the upload and post-close failures were traced in code but not reproduced. The upload case assumes no auth hook and no proxy authenticate; the post-close case assumes the CLI still sends the released lease ID. Slot release on a mid-body disconnect was not checked on the pinned Node version or for the CLI proxy adapter, and the cancelled check's log was not read.

Before merge, make upload and install resolve one tenant, with an HTTP upload-then-install test and the live remote install. Then release the RPC count slot at authentication with a pre-auth deadline, put every upload route under one staged-byte budget, and restore or re-document post-close artifacts --json.

Copy link
Copy Markdown
Member Author

Upload findings from this review are addressed in stacked draft PRs #5278 and #5281:

  • The client sends the normalized tenant on legacy, preflight, finalize, and same-origin chunk requests. HTTP coverage uploads with no auth hook, then dispatches install under the same tenant.
  • fix: bind artifact access to producing lease #5278 validates the upload lease header and binds preflight, chunk, finalize, and the retained upload to that lease. Its HTTP test uploads through the resumable routes, then dispatches install under that lease.
  • fix: bind upload ownership and shared staging capacity #5281 reserves one shared tenant/global budget before legacy or resumable staging. Finalized artifacts retain the reservation until cleanup; archive expansion is charged before extraction. A capacity 503 remains typed and does not trigger legacy fallback.

The focused tests pass at #5281 head 645614df8f. New-head CI and live remote/device install are pending. Both PRs remain drafts.

thymikee commented Nov 30, 2026 •

Copy link
Copy Markdown
Member Author

Ingress findings from the review at c4f9376 are addressed in draft #5282, stacked on the upload fix #5281 (head 2fa24d99e06061a716c4c077491069f0a2d0a87e).

  • Removed the 32-request count gate from both daemon and proxy RPC paths. Thirty-two unfinished unauthenticated bodies, or stalled authentications, no longer consume dispatch slots that refuse an authenticated caller.
  • Applied a five-second pre-auth deadline to the daemon and proxy body read and auth hook. The 128 MiB aggregate buffered-byte reservation remains through dispatch. The proxy releases its charge without awaiting a stalled body cancellation.
  • The Node proxy now writes a refusal before closing an unfinished request. Direct daemon HTTP calls with an admitted tenant receive remote input restrictions without relying on a proxy network marker; unscoped host-local calls retain their local path.
  • Updated the trust documentation and regenerated the error-reason page from its source table. Focused tests cover 32 held bodies plus authenticated dispatch, disconnect recovery, stalled cancellation, the Node 503 response, hook deadline, and direct tenant provenance. Six edited test files passed: 97 tests on the ingress commit at this head. CI and live remote/device validation remain pending under the worker handoff.

The upload, lease, and replay findings are handled in their separate stacked PRs; #5282 contains only the ingress and provenance changes.

@thymikee

Copy link
Copy Markdown
Member Author

Replay source admission follow-up: draft #5277 rejects empty entry and file names and caps raw requests at 256 bundles and 2,048 files before suite discovery. The focused source test passes 6/6; #5277 checks are green. This addresses the zero-cost empty-source concern in the review. It remains stacked on #5243 and is not merged.

@thymikee
thymikee added this pull request to stack #5294 December 1, 2026 06:33
@apex-sentinel-staging

This comment has been minimized.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

At c41ac49, this change still needs fixes before merge. The earlier replay source budget gap is fixed: empty names are now rejected, and restricted requests are capped at 256 bundles and 2,048 files. The upload tenant, RPC slot, post-close artifact and live-run items remain.

Remote install still appears to fail after a successful upload when there is no auth hook (ssh -L, or agent-device proxy without authenticate). tenant-owned-entry.ts:38 requires an exact tenant match, but the upload client sends no tenant header on any upload route, including same-origin chunks. The upload is then registered with no tenant, so install, reinstall and install-from-source with --tenant or a lease fail with "Uploaded artifact is not owned by a tenant", while the base succeeds. The rule: every upload route must resolve the same normalized tenant as the RPC that consumes the upload. The tenant header part of draft #5281, with its upload-then-install HTTP test, needs to land in this branch.

The global limit of 32 RPC slots is still charged before authentication and held through dispatch, and the proxy still reads the full body before authenticating. So 32 slow unauthenticated bodies, or 32 long authenticated commands, make the next authenticated caller get 503 on a shared or tunnelled host, where the base serves that caller. The rule: no caller may hold shared count capacity needed by others, and bytes and time spent before authentication must be bounded, on every RPC entrypoint in the daemon and the proxy. Draft #5282 needs to land here, removing the count gate and adding those bounds.

A lease-ID artifacts read still requires an active lease, but close releases it, while the CLI next step and device-clouds.md still tell users to run artifacts --json after close. This breaks post-close reads on BrowserStack, AWS Device Farm and TestMu AI, and refuses the Limrun HAR after release. Please record the maintainer decision, then either admit the owner inside the retention window or change the CLI text and docs, and test a release followed by a lease-ID read.

A live run is required before merge, because this changes remote app install admission and no live run is reported. After the upload fix lands in this branch, run agent-device proxy without authenticate (or a token-only daemon over ssh -L), connect with --tenant or a lease, and run install <local .apk or .app> on a device. The pasted output must show the upload followed by install success, not "Uploaded artifact is not owned by a tenant".

Also, a second independent pass found that the client now infers the restricted policy from the URL and refuses before RPC. For example, behind a private HTTPS gateway that forwards RPC to a token-only daemon without the public-network marker, the daemon does not apply the restricted policy, and the base accepts a suite of 257 small .ad files that fits the wire limit. The client now rejects it, and does the same for a replay or test over 2,048 files, also as a batch step. The rule: the client may refuse only what the selected daemon would refuse. Please remove the URL-based refusal and keep the count checks and split-suite hint at daemon admission; a client preflight is fine only when the selected transport positively identifies the same public-network policy.

Not blocking: these can be taken or left: align the CLI help ("public-network remote daemon") with the docs ("non-local remote daemon") to match whichever daemons enforce the counts, and share the limit constants and assert helpers between script-source.ts and script-source-bundle.ts through one fs-free module.

For a follow-up issue, not for this PR: land the shared staging reservation from draft #5281, since only resumable preflight checks capacity; and land the related parts of draft #5282 for the proxy refusal path and direct tenant HTTP policy.

The dispatch slot hold thread still applies.

All 23 checks pass at this commit.

Not verified here: no tests or live runs were executed, and the carried-over failures were confirmed by reading the code, not reproduced. The fixes in drafts #5278, #5281 and #5282 were not reviewed and are not part of this commit. No maintainer decision was found in the PR comments on post-close artifact reads or on the ADR 0024 teardown recording conflict.

Before merge, remote install must succeed after upload for --tenant and lease-backed connections.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Addressed the URL-based replay count refusal at 47da63588e: the client no longer infers daemon policy from the URL or refuses suite/file counts before RPC. The count limits remain at daemon admission. This also removes the remoteSourceLimits context and duplicate client-side count rules. Four focused test files passed (38 tests); CI is pending. The other points in your review (upload tenant propagation, preauth RPC/proxy budget, post-close artifact reads, and live tenant install) still need separate resolution.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@blacksmith-sh

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

At head 34e15e22d7, Coverage failed in the unchanged daemon-client-startup-race.test.ts private startup-timeout case. The focused file passed locally at this head (27/27). I reran only the failed CI job to check for a runner timing failure; that rerun is pending. No test or production code was changed for this failure.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apex Sentinel: 1 new finding on 48c1a55. The verdict and the full list are in the summary comment.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Disposition for the review at ac878118c7, checked against 48c1a552ea and the owning stack layers.

GitHub reports 24 passing checks at 48c1a552ea.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

The review of 48c1a55 has findings. The Node listener now returns the proxy capacity refusal, and the managed browser ref-fill path has patch-equivalent live readback in #5273. The earlier upload, admission and post-close artifact findings remain open.

A tenant-scoped install through a hookless daemon or proxy uploads an ownerless artifact, then fails with UNAUTHORIZED before reaching the platform. Could the normalized tenant from the consuming request be sent by both preparation paths on every daemon-origin upload request, while preserving attested ownership and ticket-only headers for external chunks? The fix in #5281 is not in this branch. Upload preparation

On /rpc and /rpc/checked, the daemon reserves shared capacity before authentication and holds it through dispatch. Slow bodies, connected authentication hooks or admitted commands can fill all 32 slots and cause later legitimate calls to receive 503 RPC_BODY_CAPACITY_EXCEEDED. Bound pre-auth bytes and time with an RPC-specific deadline, and release the pre-auth charge at admission before dispatch. RPC admission

Closing a cloud session removes its active lease before the documented lease-ID artifacts request can reach its provider, even when the provider retains the capture. Admit owner-scoped artifact reads using retained tenant, run and provider ownership for the retention window while keeping work admission active-only, or document another supported post-close route that preserves lease-keyed captures. Artifact admission

The Android APK receipt belongs to #5281, which contains the missing upload fix, so it does not demonstrate this head's hookless upload-to-install route. Before merge, record the resulting SHA, device and output for a hookless proxy or tunneled token-only daemon with explicit --tenant or a scoped lease, showing upload completion, real install success and installed package verification. Install preparation

The proxy also reserves shared RPC capacity before authentication and holds it through the upstream response. Stalled bodies or connected hooks and admitted upstream work can exhaust the 32 slots and return 503 PROXY_RPC_BODY_CAPACITY_EXCEEDED to later valid callers. Apply bounded pre-auth bytes and deadlines in the shared handler, and release the reservation before forwarding. Proxy budget

The managed web backend pin changes to 0.42.0, so a host provisioned with 0.39.0 can fail with TOOL_MISSING after upgrading agent-device. Document rerunning agent-device web setup in the same state directory for existing installations, including CI and MCP hosts. Web setup

A second independent pass found that the exact tenant ownership check rejects the ownerless upload from a tenant-scoped install without an auth hook. Could the tenant-header change from #5281 be included here for legacy upload, preflight and retry, same-origin chunks and finalize, with an upload-then-install HTTP test through the production router? Keep external chunks ticket-only and retain the exact ownership check. Tenant ownership

A second independent pass found that both listeners still charge the shared RPC count before authentication and hold it through dispatch or the upstream response. Could #5282's finite body and authentication deadlines and dispatch-independent admission accounting be included here? Daemon admission

A second independent pass found that the documented artifacts command still cannot read a released cloud lease by ID. Could the owner-scoped retention route be restored, or the help and guide changed to a supported provider-session route, with a test that releases a lease and reads its artifacts? Lease admission

The upload tenant thread still applies despite its resolution; zero lower-priority threads still apply. The fill separator thread does not apply because the pinned parser preserves the value and #5273 confirms the separator case.

Body rules was cancelled; its cancellation cause is unverified, and its title and body checks appear unrelated to the patch. No conflicts are known. Before merge, land upload scope propagation, finite pre-auth deadlines and dispatch-independent accounting in both listeners, restore an owner-scoped post-close artifact route, document web reprovisioning, record the live install evidence and confirm Body rules.

Not verified here: local gates, tests and device runs were not performed; primary run output for the reported 166 tests and typecheck was not provided. The browser receipt does not verify network confinement or an in-place upgrade from 0.39.0.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

The managed browser upgrade item in the review of 48c1a55 is addressed in 5d785de57c. The web command reference now tells users with only 0.39.0 installed to rerun agent-device web setup with the upgraded CLI in the same state directory, including each CI or MCP host. Setup installs the pinned 0.42.0 backend in that directory. The live ref-fill receipt in #5273 still applies to that PR’s tested head. Hookless native install evidence remains pending.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

The review of 5d785de still finds regressions from the earlier review. The documentation delta addresses the command guidance, but the tenant upload, RPC admission, and post-close artifact issues remain. The 25 hosted checks are green, and the previously cancelled Body rules check has no failing head job to attribute. There are no conflicts.

A tenant-scoped install through a token-only daemon or proxy without an auth hook can upload successfully and then fail with UNAUTHORIZED before platform dispatch. Both preparation paths must carry the consuming request’s normalized tenant through legacy upload, preflight and retry, same-origin chunks, and finalize; retain the exact ownership check, attested scope, and separate ticket headers on external storage PUTs. Upload preparation

Daemon RPC calls can receive 503 RPC_BODY_CAPACITY_EXCEEDED before authorization when admitted commands hold the listener-wide slots. Both RPC routes must bound body receipt and authorization with a dedicated deadline and release the preauthorization slot at admission, while retaining the buffered-byte limit. Daemon ingress

After a releasable cloud session closes, the documented lease-ID artifacts lookup can reject its owner before reaching a provider that retains the captures. Artifact reads must use retained tenant, provider, and supplied run ownership during the retention window while work admission stays active-only, or a supported post-close path must preserve lease-keyed captures and be documented and verified. Artifact admission

The Android emulator receipt belongs to #5281, and the #5278 HTTP fixture uses a test dispatcher. Before merge, the candidate with the tenant fix must have a live receipt that records its SHA and device and shows upload completion, platform install success, and installed package verification through a hookless proxy or tunneled token-only daemon with an explicit tenant or equivalent scoped lease. Deployment

Proxy RPC calls can receive 503 PROXY_RPC_BODY_CAPACITY_EXCEEDED before authentication when admitted upstream requests hold the shared slots. The shared handler used by both entry points must bound preauthorization and release its slot before forwarding, with buffer accounting tied to retained bytes. Proxy budget

A second independent pass found that the unchanged strict ownership check can reject the caller’s ownerless upload on a hookless tenant-scoped install. Could both upload call sites derive the normalized lease scope and propagate it through every same-origin upload phase while keeping external chunks ticket-only, or could #5243 and #5281 be landed together? Ownership check

A second independent pass found that 32 admitted long-running daemon commands or stalled bodies can exhaust the unchanged preauthorization slots and reject a valid caller. Could the count end at admission and use an RPC-specific deadline, or could #5243 and #5282 be landed together? Daemon ingress

A second independent pass found that 32 long upstream requests, stalled bodies, or connected hooks can exhaust the unchanged proxy slots and reject a valid caller. Could the shared handler release the reservation before forwarding and bound preauthorization, or could #5243 and #5282 be landed together? Proxy budget

A second independent pass found that the unchanged active-lease check rejects the documented lease-ID artifacts route after session close. Could retained ownership admit artifact reads while work remains active-only, or could a supported post-close route be documented and verified, or #5243 and #5278 be landed together? Artifact admission

The upload scope thread still applies despite its resolution; zero lower-priority threads still apply. The fill thread was withdrawn because the pinned parser preserves the value and the prior receipt covers the same provider and tool code.

Not verified here: local gates, tests, and device runs were not performed; the original scan report and primary output for the reported 166 tests and typecheck were not supplied. The browser ref-fill receipt carries forward with a matching production-file diff; an in-place managed browser 0.39.0 upgrade was verified by source trace only. Before merge, the candidate needs matching upload scope, dispatch-independent daemon and proxy preauthorization, owner-scoped post-close artifact access, and the live hookless install receipt.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

For the hookless native install request, the delegated iOS 26.2 run on isolated e2e-apex used combined stack tip 2c6b09defdcfddb76dbd2a83b6a3629fac7c2d68 (#5243 5d785de57c → #5278 d7e2b68cab → #5281 e3ba3f57bc → #5282 2c6b09defd). Through the HTTP proxy with no auth hook, using an explicit tenant and retained lease, the 19.6 MiB local package upload reached 100%, platform install succeeded, and the installed bundle ID and executable matched the fixture.

This covers the requested hookless iOS install on the combined candidate that includes the tenant fix from #5281. The standalone #5243 head had no live install run. The post-close artifact and RPC ingress evidence requests remain open.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

The maintainer’s three behavior requirements belong in one release candidate. #5281 preserves upload tenant scope through every same-origin phase, #5282 bounds daemon and proxy preauthorization separately from execution, and #5278 admits post-close reads under the retained producing scope while work remains active-lease only. The existing hookless iOS 26.2 receipt covers explicit-tenant package and local ZIP staging/install and materialized-path release at combined tip 2c6b09defdcfddb76dbd2a83b6a3629fac7c2d68.

The live #5281 branch at 0cd48fbd30 and #5282 at 08fb3a0b6f still descend from #5278 fe6452bc3f. They must be replayed over the updated #5278 before a new combined candidate can be evaluated. Preserve the old receipt at its recorded SHA. Update the shared security guide’s active-only cloud-artifact wording to cover retained ownership for reads, and align its hookless upload wording with the staging decision. The standalone root still carries the old upload and ingress behavior. Post-close provider and recording evidence, native overlap and combined-listener refusal and recovery remain open.

* fix(replay): bound source bundle and file counts

* fix: let empty replay source lists reach suite discovery

* fix: preflight remote replay source counts on client

* chore: format replay source preflight

* fix(replay): enforce remote source limits in nested batch steps

* fix(replay): type structured batch regression fixture

* fix: preserve batch step error details
* docs(security): design remote web network confinement

* docs(security): phase remote web confinement

* docs(security): correct Chromium proxy bypass

* docs(security): require isolated confined browser sessions

* docs(security): bind remote web confinement to session state

* docs(security): cover DNS64 in remote web confinement design

* fix(web): carry remote network policy into browser provider

* fix(web): own confined browser refusal at launch

* fix(web): refuse confined commands before provider cleanup

* refactor(web): keep confinement admission before browser effects

* docs(web): scope remote refusal to tenant ingress

* fix(web): prove confined default provider composition
* fix(web): classify public network destinations before proxy connect

* fix(web): admit only allocated IPv6 destination ranges

* refactor(web): separate destination admission decisions
* fix(providers): bound credential endpoints and responses

* fix(providers): require origin fences for authenticated downloads

* fix(providers): bound Limrun control responses

* fix(providers): satisfy response boundary gates

* fix(providers): share response failure vocabulary

* fix(providers): cancel stalled Limrun response reads

* docs: regenerate provider response reasons

* chore(gates): refresh contracts export snapshot

* test(providers): narrow stalled response observation

* fix(providers): preserve observed Limrun rejection status

* test(providers): await client-observed rejection body

* test(providers): observe retry conflict body seam

* fix(providers): keep response reason in existing closure

* fix: preserve anonymous Limrun release redirects and BOM decoding

* fix(providers): close credential and response boundaries

* fix(contracts): keep response reasons in remote facade

* docs(contracts): summarize provider response reason

* fix(providers): narrow response bounds to buffered bodies

* fix(revyl): report oversized responses with shared reason
* chore: update managed browser for session security fixes

* fix: preserve literal double dash in web ref fill

* test(web): expect batch fill separator

* test(web): decode batch stdin from supported buffer input

* chore(web): format batch fill expectation
@thymikee
thymikee force-pushed the fix/daybreak-daemon-boundaries branch from 5d785de to 61f0e4d Compare December 2, 2026 16:54
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 61f0e4d

Since the review of 5d785de: 1 new · 0 still open · 1 no longer raised (1 deferred)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/daemon/src/server/resumable-upload.ts:132 🆕 Upload capacity refusal says "Too many uploads" when the byte budget is exceeded

Reviewed with this repository's own Sentinel configuration (7c6ef4a2ed46).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apex Sentinel: 1 new finding on 61f0e4d. The verdict and the full list are in the summary comment.

Comment on lines +132 to +155
function assertResumableUploadCapacity(options: BeginResumableUploadOptions): void {
let tenantCount = 0;
let tenantBytes = 0;
let totalBytes = 0;
for (const entry of RESUMABLE_UPLOADS_BY_ID().values()) {
totalBytes += entry.sizeBytes;
if (entry.tenantId === options.tenantId) {
tenantCount += 1;
tenantBytes += entry.sizeBytes;
}
}
if (
tenantCount < MAX_ACTIVE_UPLOADS_PER_TENANT &&
RESUMABLE_UPLOADS_BY_ID().size < MAX_ACTIVE_UPLOADS_TOTAL &&
tenantBytes + options.sizeBytes <= MAX_RESERVED_UPLOAD_BYTES_PER_TENANT &&
totalBytes + options.sizeBytes <= MAX_RESERVED_UPLOAD_BYTES_TOTAL
) {
return;
}
throw new AppError('COMMAND_FAILED', 'Too many active resumable uploads', {
reason: UPLOAD_FINALIZE_REASONS.capacityExceeded.reason,
retriable: true,
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🆕 🟡 Minor · Upload capacity refusal says "Too many uploads" when the byte budget is exceeded

A single 5 GiB file on an idle daemon is refused with Too many active resumable uploads even though the byte budget (4 GiB per tenant, 16 GiB total) was the limit crossed. UPLOAD_CAPACITY_EXCEEDED carries no details field, so a caller cannot tell a count refusal it should shard around from a size refusal it must shrink the file for.

Suggested change

Name the exceeded limit and the observed/limit values in the UPLOAD_CAPACITY_EXCEEDED details (uploadCount/sizeBytes/limit), so a client can tell a count refusal from a reserved-bytes refusal.

Details

persona: javascript, maintainability

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.

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.

1 participant