Repository navigation
Conversation
Size Report
Startup median (7 runs, lower is better):
Affected plugins
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 5 new findings on 6c83c5b. The verdict and the full list are in the summary comment.
|
At 6c83c5b, artifact access is not yet reliably bound to the producing lease. Some valid downloads, uploads and lookups now fail, and some callers can reach another lease's artifacts. These changes are needed before merge.
A second independent pass found that A second independent pass found that RPC artifact inventories also authorize by caller-selected scope ( A second independent pass found that upload and install accept a substituted lease ( A second independent pass found that valid provider-bound installs now fail at the same upload check. Proxy and provider leases require run and any bound provider, device or client fields, and the HTTP caller supplies none to this check. A direct bearer-only daemon also fails now, because the client sends the lease without a tenant header. Uploads should be admitted by the authenticated tenant and run against the active lease, with one upload-specific check carried through every phase. Direct leased connections need credentials that establish this scope. A second independent pass found that execution can drop the admitted lease ( A second independent pass found that recording recovery can hand one lease's recording to another ( A second independent pass found that one lease can get different owner values ( A second independent pass found that materialization release trusts a claimed lease and can lose the real owner ( A second independent pass found that protocol 3 peers now disagree on artifact requests ( A second independent pass found that some artifact lookups that worked before now fail ( Would a smaller design work here? Drop the run header, bind each store to Not blocking: these can be taken or left: one shared tenant-and-lease owner check with a typed reason instead of copies after The open thread on the run header still applies, and so do 4 lower-priority open threads. Repo Guards & Compatibility and Coverage fail, and the PR description places both failures at the wire-compat gate. They are likely caused by this change, which edits the daemon HTTP contract and upload and artifact declarations that the gate checks. Not verified here: tests were not run, and job logs were not used to confirm the author's test results or the CI cause. No current production caller was confirmed to send a lease and tenant without a run, so the confirmed affected group for the first finding is older clients and callers that pass Next, remove the client-declared run header from artifact admission and bind stores to the admitted lease. Then settle the ADR 0006 wire-compat decision so that Repo Guards and Coverage pass. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on ef7540c. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 6399fb9. The verdict and the full list are in the summary comment.
|
Leased installs and uploads that worked on base now fail with 401 at 6399fb9, so this needs changes. Since the earlier review, a missing run on provider-session lookup is refused, expired lease owners are pruned, the empty inventory on a leased session is now a typed error, and the stale contracts comment is fixed. The problems below remain or are new. upload-http.ts:148: the lease header without request-finalization.ts:112: artifact registration, upload consumption and materialized-path retain and release still bind the declared screen-recording-stop-recovery.ts:102: this file is unchanged. Can recovery still replay a completed recording from closed lease A and register it under lease B for the same session name and simulator? That appears likely and would hand one lease's recording to another. The recording manifest should store the producing lease at start, and replay should require a match and keep the original tenant and lease. session-app-source-deployment.ts:160: could you confirm whether materialization release still compares the declared ended-lease.ts:36: could you confirm the behavior after proxy close? The session-only lookup now has a typed error and the docs show upload-http.ts:163: a second independent pass found that, for a basic active lease, claiming the matching run of another lease in the same tenant is enough to authorize legacy upload, preflight, chunk receipt and finalize. The gate and the resumable store trust the asserted headers. Is there any authenticated tie between the caller and that lease? Every leased upload phase, and RPC upload consumption, should require verified authority (such as a lease grant or a lease binding on the principal) and use that canonical lease. upload-http.ts:163: a second independent pass found that owners of proxy leases bound to a device or client, or of provider leases, are refused at upload preflight and legacy upload. Read admission requires the bound provider, device and client fields, which these install, reinstall and local-source requests do not satisfy, while base accepted them. Should upload have its own active-lease admission that verifies the principal's grant and returns the canonical lease, leaving those constraints on device RPC admission? upload-http.ts:154: a second independent pass found that leased installs on a direct daemon without an HTTP auth hook now return 401. Preflight and legacy upload headers omit the tenant (upload-client.ts:262, upload-client.ts:310), so authorization resolves none, while base accepted bearer authentication. Can the direct client's credential establish the owner tenant and producing lease on every leased upload request, with daemon admission using that verified scope? upload-http.ts:164: a second independent pass found that upload stores the header spelling of the lease ID (also here), while registry admission accepts other casings. An owner who uploads with an upper-case ID and installs with the lower-case one fails the equality check, though base accepted the transfer. Can upload admission return the registry lease, so ticket creation, chunks, finalize, registration and install consumption all use its canonical ID? upload-http.ts:150: a second independent pass found that the compatibility report holds. A v0.21.45 client passes the check against protocol 3, then gets 401 on leased uploads, and the artifact download incompatibility remains. Should the changed authorization contract be versioned under ADR 0006, with the compatibility ledger and peer metadata updated and a remote-client regression test showing refusal before any transfer or command dispatch? lease.ts:104: a second independent pass found that a supplied lease ID is enough to pass the new session guard, so artifacts ownership is still caller-selected. Daemon inventory does not validate the run, cloud lease lookup trusts the selected scope, and provider-session lookup can take the lease from the selected session. Can daemon inventory and both cloud lookups require the same authenticated lease-read admission, treating a provider session ID only as a lookup key whose recorded producer is checked before dispatch? lease.ts:104: a second independent pass found that session-name lookup loses the owner's retained inventory after proxy close. The guard checks only live sessions, the saved lease ID is cleared, and artifacts defers allocation, so the follow-up returns the unleased inventory instead of the retained recording. Can the close result or saved connection carry verified authority for the completed lease during retention, with the explicit lookup documented too? lease.ts:615: a second independent pass found that the documented SDK example, a provider-session lookup with no configured run, still fails, now with Not blocking: the guard at lease.ts:104 also appears to refuse the documented past-session lookup (provider session ID and For a follow-up issue, not for this PR:
Of the open threads, upload compatibility break and proxy forwards headers still apply, as does 1 lower-priority thread. These no longer apply and can be resolved:
Repo Guards & Compatibility and Coverage fail at the wire-compat and closure gates. This PR likely causes it: the description attributes both to the changed upload and artifact wire declarations, and the diff touches that route. Not verified here: tests and CI logs were not run or read; it was not confirmed that remote CLI connections put the saved lease into the artifacts flags (the non-blocking note assumes so); a base-version proxy in front of a new daemon was not checked. Before merge, leased installs and uploads from base-built clients, and from new clients given |
6399fb9 to
820196a
Compare
820196a to
d091508
Compare
|
At d091508, leased uploads that work on the base branch still fail with 401. The rebase changed no PR code, so none of the blocking items from the earlier review of 6399fb9 is closed.
The other earlier items also remain. Finalization, app deployment and install-source stores bind the declared lease, not the admitted one. Recording stop recovery can re-register a closed lease's recording under another lease. Materialization release compares the declared lease. Upload phases trust asserted lease and run headers. Bound proxy and provider lease owners are refused at preflight. Direct leased installs without a tenant get 401. The caller's lease ID casing is stored. The artifact download and run-header contract is not versioned. Artifact lookup after proxy close loses the saved lease. The documented SDK provider-session lookup without a run fails. Most share one root. One admission helper that returns the canonical registry lease for the attested tenant, used by every upload phase, artifact read, finalization store and release route, can close them together. A second independent pass found that the upload gate likely rejects an active lease owner with a valid tenant credential in all four phases: legacy, preflight, direct PUT and finalize. The fallback from preflight to legacy upload fails too, so local-file install, reinstall and install-from-source stop before dispatch. All four phases must admit the caller through the verified active lease and take the run from it, keeping the current request shape where the credential can establish authority. If existing clients need a new grant, negotiate it before transfer under ADR 0006. A second independent pass found that a direct daemon without an HTTP auth hook likely returns 401 even with the bearer credential, lease and run. Auth yields no tenant and the client sends no tenant header on preflight or legacy upload. The base route succeeded. Upload admission must resolve the owned lease scope, including the canonical tenant, for the authenticated direct client, and use it through transfer and install. A second independent pass found that owners of leases bound to a provider, device key or client ID are likely refused at preflight and legacy upload, even with tenant, lease and run. Upload supplies only those three fields, but the registry also requires the device-operation ownership fields. Upload needs its own ownership check on the canonical active lease. The install RPC should keep enforcing the full device scope. A second independent pass found that an uppercase hex lease ID passes registry lookup but is stored as spelled. A later chunk, finalize or install with the canonical spelling is then likely refused. Admission must return the canonical lease, and preflight, chunks, finalize, registration and RPC consumption must use its ID. A second independent pass found that upload admission likely lets a caller use another basic lease of the same tenant by declaring its lease and run. The caller can register uploads under it and, with an upload ID, act on its resumable upload. Install paths also trust the request lease field. Every upload phase and RPC consumption must verify a lease-bound grant or authenticated lease principal and compare that lease with the upload's producer. A second independent pass found that HTTP artifact inventory and download likely return 401 to owners whose client sends a lease without a run, including base-built clients, while protocol 3 is still advertised. Both routes must authorize from the verified producer lease and derive the run from its record where the current credential identifies the lease. Any incompatible credential requirement must be negotiated before dispatch. A second independent pass found that artifact reads likely trust a caller-selected producer. A same-tenant caller who knows another lease and run can read its inventory, bytes or provider URLs through HTTP or RPC inventory, which is exempt from normal lease admission. HTTP reads and both RPC inventory modes must apply the same verified lease-read authority, resolving a provider session ID to its recorded producer first. A second independent pass found that a capture on a leased session with no declared lease ID is likely registered without a lease. Another caller with a tenant credential can then list or read it. An install admitted through session scope also cannot consume its lease-bound upload. Output registration, upload consumption, and materialized path retention and cleanup must use the admitted canonical lease. Output recovered from an earlier request must keep its original producer. A second independent pass found that materialization release likely has no verified owner. A tenant caller with another materialization ID can declare its lease through the generic command and delete its paths. The dedicated RPC drops the lease, so the real owner cannot release them. Both RPC paths must verify the lease owner and pass the admitted lease to the handler, and retention must store that canonical lease. A second independent pass found that after proxy close clears the stored lease, the documented A second independent pass found that the documented SDK lookup by provider session ID, from a client with no configured run, likely now fails with The missing run header thread still applies, as do two lower-priority threads. These no longer apply and can be resolved: this one, because the missing-registry 401 occurs only on embedded test servers; expired owner pruning, the empty leased-session inventory error and the provider-session run refusal, because each requested change is present. Repo Guards & Compatibility and Coverage fail. The likely cause is this change: it adds a required run header to the upload and artifact wire declarations in Not verified here: the failing CI logs were not read, no tests were run, and the earlier likely findings on recording stop recovery, materialization release and post-close artifact lookup were not traced again against unchanged code. Before merge, leased installs and uploads from base-built clients, and from new clients with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 4 new findings on d091508. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
All reported issues were addressed across 44 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 6194cf9. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
c287bab to
8d5cf14
Compare
This comment has been minimized.
This comment has been minimized.
| function admitArtifactLease( | ||
| req: http.IncomingMessage, | ||
| tenantId: string | undefined, | ||
| leaseRegistry: LeaseRegistry | undefined, | ||
| ): string | undefined { | ||
| const value = req.headers[DAEMON_HTTP_LEASE_HEADER]; | ||
| if (value === undefined) return undefined; | ||
| const runId = req.headers[DAEMON_HTTP_RUN_HEADER]; | ||
| if ( | ||
| typeof value !== 'string' || | ||
| !value.trim() || | ||
| (runId !== undefined && typeof runId !== 'string') || | ||
| !leaseRegistry | ||
| ) { | ||
| throw new AppError( | ||
| 'UNAUTHORIZED', | ||
| 'Artifact lease requires an admitted tenant and lease registry', | ||
| { | ||
| reason: ARTIFACT_DOWNLOAD_REASONS.leaseAdmissionRequired.reason, | ||
| }, | ||
| ); | ||
| } | ||
| const leaseId = normalizeRequiredLeaseId(value); | ||
| leaseRegistry.assertArtifactLeaseReadAdmission({ leaseId, tenantId, runId }); | ||
| return leaseId; | ||
| } |
There was a problem hiding this comment.
No longer raised on 46a98d5, with the code it pointed at unchanged: withdrawn, not fixed.
Moved from an earlier thread.
🆕 🟡 Minor · GET /artifacts with an absent lease header now hides every leased artifact from its owner
A client that recorded a screenshot under a lease polls GET /artifacts without x-agent-device-lease-id and gets artifacts: []. canReadArtifact's "no scope means unscoped" branch keeps only entries whose entry.leaseId === undefined, so every lease-bound artifact is filtered out. The same omission causes readDownloadableArtifactEntry to throw ARTIFACT_LEASE_MISMATCH; the response's downloadScope is the only place the client learns the id it must send.
Suggested change
Either reject an inventory/download request for a tenant that has lease-bound artifacts and names no lease (typed INVALID_ARGS naming the lease requirement), or fall back to listing the tenant's artifacts for the leases the registry says that tenant holds. Keep the note in the protocol-4 migration docs.
Details
persona: javascript
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.
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 8d5cf14. The verdict and the full list are in the summary comment.
- 🟡 Minor · readDeploymentLeaseScope casts client leaseBackend to LeaseBackend without validating it ·
packages/daemon/src/server/http/http-rpc-methods.ts:200 - 🟡 Minor · resolveInstallSource's default owner drops the lease and rejects leased uploads ·
packages/daemon/src/sessions/install-source-resolution.ts:40
| function readDeploymentLeaseScope(params: Record<string, unknown>): DaemonRequest['meta'] { | ||
| return { | ||
| tenantId: readStringParam(params, 'tenantId'), | ||
| runId: readStringParam(params, 'runId'), | ||
| leaseId: readStringParam(params, 'leaseId'), | ||
| leaseBackend: readStringParam(params, 'leaseBackend') as LeaseBackend | undefined, | ||
| leaseProvider: readStringParam(params, 'leaseProvider'), | ||
| deviceKey: readStringParam(params, 'deviceKey'), | ||
| clientId: readStringParam(params, 'clientId'), | ||
| }; | ||
| } |
There was a problem hiding this comment.
No longer raised on 46a98d5.
🆕 🟡 Minor · readDeploymentLeaseScope casts client leaseBackend to LeaseBackend without validating it
A protocol-4 client posting { leaseBackend: "android-instances" } to install-from-source or release-materialized-paths gets that value typed as LeaseBackend via the as LeaseBackend | undefined cast on readStringParam, bypassing the validating readers used by sibling fields. It reaches lease admission and the registry's backend-keyed lookup as a value no schema produces, surfacing as a mismatch or empty lookup instead of INVALID_ARGS.
Suggested change
Read leaseBackend through the same validating param reader the lease RPC params use (or reuse leaseScopeFromRequest's projection), so an unsupported backend is INVALID_ARGS at the boundary.
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.
| export function resolveInstallSource( | ||
| req: DaemonRequest, | ||
| owner: Pick<LeaseScope, 'tenantId' | 'leaseId'> = { tenantId: req.meta?.tenantId }, | ||
| ): { | ||
| source: DaemonInstallSource; | ||
| cleanup: () => void; | ||
| } { |
There was a problem hiding this comment.
No longer raised on 46a98d5, with the code it pointed at unchanged: withdrawn, not fixed.
🆕 🟡 Minor · resolveInstallSource's default owner drops the lease and rejects leased uploads
resolveInstallSource defaults owner = { tenantId: req.meta?.tenantId } with leaseId undefined, so prepareUploadedArtifact compares undefined against a staged entry's lease and throws ARTIFACT_LEASE_MISMATCH for uploads staged under a lease. The default parameter keeps this reachable at any call site that hasn't resolved the admitted lease.
Suggested change
Make owner a required parameter (no default) so a call site that hasn't resolved the admitted lease fails to typecheck instead of silently resolving an unscoped owner.
Details
Also raised here
Also raised at this location by persona maintainability: resolveInstallSource's default owner omits leaseId, disabling the new lease check — The new second parameter of resolveInstallSource defaults to { tenantId: req.meta?.tenantId }, which carries no leaseId, so a caller that omits it calls prepareUploadedArtifact with undefined for the lease and an upload staged under a lease is refused with ARTIFACT_LEASE_MISMATCH. Every current caller passes the owner explicitly, so nothing is wrong today; the risk is the shape of the default, which silently drops the half of the scope pair this PR just made mandatory. Require the owner argument, or build the default from the same resolveRequestOrSessionLeaseScope(req, ...) the handlers use so both fields come from one source.
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.
Apex Sentinel · ✅ Approve · review of
|
| Finding | Fixed by | Where |
|---|---|---|
| http-rpc-methods readDeploymentLeaseScope is a client-declared scope injection surface | thymikee | ef7540c · reply |
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.
Summary
Bind upload stages, retained downloads, provider artifacts, and materialized paths to the admitted tenant and producing lease. Tenant authentication establishes authority. Stacked on #5243.
Before / after
--sessionand no lease or run flags, provider-session lookup uses the named cloud connection's lease and run.Validation
At
c287bab53a, five CLI transport tests passed. The added assertion failed on8bd855d69b. At8bd855d69b, both AST parity cases and all 19 hosted checks passed. Ata5c5a46b4c, five CLI transport tests passed, including two historical cases that failed atf5ba4128b3. At5cddfe7e32, 83 CLI transport and HTTP output tests passed.On combined tip
2c6b09defdwith this layer atd7e2b68cab, iOS 26.2 verified package and local ZIP staging, install, and path release through a hookless HTTP proxy with explicit tenant and retained lease. Protocol-4 live evidence is pending for omitted-run staging, URL source install, recording stop or restart recovery, post-close inventory, producing-owner download, typed wrong-lease refusal, and authenticated historical provider lookup. Bearer-only and session-only staging still need an ownership decision.46a98d5310extracts the artifact scope block to address Fallow. Merge-tree clean through #5281 and #5282. CI pending.