Skip to content

fix(revyl): require explicit artifact origins - #5261

Closed
thymikee wants to merge 8 commits into
fix/daybreak-provider-boundariesfrom
fix/daybreak-revyl-artifact-origins
Closed

thymikee wants to merge 8 commits into
fix/daybreak-provider-boundariesfrom
fix/daybreak-revyl-artifact-origins

Conversation

@thymikee

@thymikee thymikee commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Require operator-configured exact origins before Revyl uploads build bytes or passes a storage URL to its worker. Keep storage policy daemon-owned and outside credential fingerprints. Each plugin option entry remains one origin. Review follow-up clarifies daemon setup, the loopback exception, and empty-array override; invalid policy errors no longer echo userinfo or query secrets. Stacked on #5244.

Before / after

  • Before: one artifactOrigins entry could admit two origins. After: the entry fails with invalid_provider_url.
  • Before: a daemon policy value could trigger a credential mismatch in a key-only CLI shell. After: the daemon applies the policy without fingerprinting it.
  • Before: invalid origin errors included the full configured value. After: errors contain only the typed reason and general guidance.

Validation

Head: 2ed3a6e360. Focused pnpm exec vitest run --project unit-core packages/provider-revyl/src/revyl-client.test.ts passed 25/25, including secret-redaction coverage. Prior focused index.test.ts passed 8/8 at b0b908d377; applicable CI passed at that prior head. CI at this head is pending. Live Revyl install remains unverified because no live credentials or device were available.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.74 MB 6.74 MB +150 B
Package (unpacked) 6.73 MB 6.73 MB +150 B
Package (download) 2.06 MB 2.06 MB +58 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 36.5 ms 42.3 ms +5.7 ms
CLI --help 85.5 ms 80.9 ms -4.7 ms

Affected plugins

Plugin Installed (including dependencies) Unpacked Download
@agent-device/revyl 180.5 kB → 182.1 kB (+1.6 kB) 180.2 kB → 181.7 kB (+1.6 kB) 58.5 kB → 59.1 kB (+584 B)

@thymikee
thymikee force-pushed the fix/daybreak-revyl-artifact-origins branch from 531ff1c to b5230fe Compare November 30, 2026 15:02
@blacksmith-sh

This comment has been minimized.

@thymikee
thymikee force-pushed the fix/daybreak-revyl-artifact-origins branch from b5230fe to c868267 Compare November 30, 2026 15:06
@apex-sentinel-staging

This comment has been minimized.

@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: 2 new findings on 4a0f877. The verdict and the full list are in the summary comment.

Comment thread packages/provider-revyl/src/index.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

The review of 1426a0a found two problems to fix: one admits origins that were not configured as separate entries, and one can stop hosted-app lease allocation.

A second independent pass found that one artifactOrigins entry can admit two origins. An embedded operator can pass ['https://storage.example,https://other.example']. The option array is joined into an environment value, and credential resolution splits it again, so both origins are accepted. A Revyl backend that controls the ticket can then make the daemon send session build bytes to other.example, or make the worker receive a presigned download URL for it. Each option array entry should be validated as exactly one origin, in every path that resolves credentials from the option, including setup and verification. Only REVYL_ARTIFACT_ORIGINS should be split. A test should show that the combined entry is rejected.

A second independent pass found that daemon-only artifact policy can stop a hosted-app lease. A daemon can start with REVYL_API_KEY and a valid REVYL_ARTIFACT_ORIGINS, while a separate CLI shell supplies only the same key. At d282619, the first open for a Revyl profile with --provider-app succeeded in this setup. Now the credential fingerprints differ, and lease allocation returns provider-credentials-changed, although this route uses no session artifact ticket. REVYL_ARTIFACT_ORIGINS should stay daemon-owned: no manifest or plugin list of credential variables should include it. Policy changes should still require the documented daemon restart. A test should show that a caller with only the key can allocate against such a daemon.

Not blocking: these can be taken or left: add an error hint to the refused-origin failure that names the variable, the option, administrator approval and agent-device daemon stop, says whether upload_url or download_url was refused, and does not suggest copying the returned origin; mention install-from-source wherever help, the README and the Revyl docs say install needs the variable; say that both upload and download origins must be listed; add the variable to the provider comparison row and, if it stays fingerprinted, say that every allocating shell needs the same value; share one transport rule for configured and returned URLs, possibly through normalizeDaemonPublicOrigin; make artifactOrigins required at least on RevylCredentials and RevylRuntimeOptions and drop the ?? [] fallbacks; add a test that carries a two-entry variable, and also the option, from plugin setup to the upload request; add an unlisted-origin uploadSessionArtifact test that sends no request, or drop the transport checks that set membership now covers; write "non-loopback literal IP host" in SECURITY.md, which is also outside the published package files although the README links to it; and replace the private security-finding link in the PR summary with a one-line problem statement.

For maintainers: Revyl install and install-from-source work on the base without this setting and now fail until it is configured. This matches the stated requirement.

A live Revyl run at this head is required before merge, because this changes the install path and #5244 states that the storage-origin contract is unverified. First, with a daemon that has no REVYL_ARTIFACT_ORIGINS, install <id> <build> --json should return reason invalid_provider_url with details.origin and upload nothing. Then, after agent-device daemon stop and with the approved origins set, the same install should complete on iOS or Android. Report only the upload_url and download_url origins, with no presigned URLs, and whether they stay the same in a second session.

CI jobs pass at this head. One other check is still pending and exercises no code route.

Not verified here: local tests, the author's reported local checks, the linked private finding, and real Revyl storage origins, including whether upload and download share one and whether they stay stable.

Before merge, the two problems need fixes and the live install evidence needs to be recorded. The PR is also still a draft stacked on #5244.

@apex-sentinel-staging

This comment has been minimized.

@thymikee
thymikee force-pushed the fix/daybreak-revyl-artifact-origins branch from 1426a0a to 8ade3bf Compare November 30, 2026 17:02
@thymikee

thymikee commented Nov 30, 2026 •

Copy link
Copy Markdown
Member Author

Addressed the two blocking code findings at b0b908d377:

  • The plugin keeps each artifactOrigins option entry intact through connect resolution, setup, and verification. A combined entry with two origins fails invalid_provider_url; a two-entry array succeeds. The focused test covers all three routes.
  • REVYL_ARTIFACT_ORIGINS is removed from the version 1 manifest and version 2 credential declaration. It remains daemon-owned policy, so a separate key-only CLI shell does not need to mirror it to pass the credential fingerprint. The test covers key-only verification and daemon setup with the policy.

The branch was restacked on #5244 at 33f91219f2, with the original five Revyl commits patch-identical by range-diff. The focused test passes 8/8 at the final head. The prior CI head found a type mismatch in test fixtures and an unused export; both are fixed in the new head, with CI pending. A live Revyl install with unlisted and listed origins remains required before merge; no live Revyl credentials or device were available in this run.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

At b0b908d, both code problems from the 1426a0a review are fixed, with no new required code changes. Live install evidence is still missing.

A combined artifactOrigins entry is now refused, and the added test asserts this on all three routes. The daemon-only origin policy should also no longer stop a caller with only REVYL_API_KEY from allocating a lease.

Two earlier threads no longer apply and can be resolved: the plugin JSDoc and the README name REVYL_ARTIFACT_ORIGINS, and the reason row and its generated docs row cover artifact origins.

A live Revyl run at b0b908d is required before merge, because this changes the install path and #5244 states that the storage-origin contract is unverified. First, with a daemon started without REVYL_ARTIFACT_ORIGINS, install <id> <build> --json should return reason invalid_provider_url with details.origin and upload no build bytes. Then, after agent-device daemon stop and with the approved origins set on the daemon, the same install should complete on iOS or Android. Report only the upload_url and download_url origins, with no presigned URLs, and whether they stay the same in a second session. Optionally, open the session from a separate shell that has only REVYL_API_KEY, to show that lease allocation does not return provider-credentials-changed.

The Body rules check was cancelled, not failed, and it is the only check not passing. The cause is likely unrelated, because this diff touches no workflow, PR body script or gate. A re-run should settle it.

Not verified here: local tests, including the reported 8/8 focused run and the added combined-entry test, so CI at this head is the authority. The combined-entry URL parse result was reasoned from the URL spec. Key-only lease allocation was traced through code, and no test or live run drives that route. Real Revyl storage origins were also not checked, including whether upload and download share one and whether they stay stable across sessions.

Before merge, the live install evidence needs to be recorded. The PR is also still a draft stacked on #5244.

@thymikee
thymikee marked this pull request as ready for review November 30, 2026 19:15

@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 14 files

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

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

Comment thread packages/provider-revyl/README.md Resolved
Comment thread src/commands/schema/cli-help.ts Resolved
Comment thread packages/provider-revyl/SECURITY.md Resolved
Comment thread packages/provider-revyl/src/index.ts Resolved
Comment thread packages/provider-revyl/src/index.ts Resolved
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 2ed3a6e

Since the review of b0b908d: 0 new · 0 still open · 0 no longer raised

No open findings.

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

💬 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.

@thymikee

Copy link
Copy Markdown
Member Author

At 2ed3a6e, no blocking code problem remains, but the PR is not ready to merge because the live Revyl run requested in the earlier review is still missing. The PR body also says it was not run. The review thread points raised since then are fixed.

These threads no longer apply and can be resolved: setup steps now export REVYL_ARTIFACT_ORIGINS and stop the daemon before connect, in both the README and the Revyl docs page. CLI help now calls the origins daemon-applied policy, not credentials. Error details now hold only the reason, with a test. Security wording now says "non-loopback literal IP host", which matches the code. Loopback exception is now in the JSDoc. Option override is now documented, including that [] admits no origin. Error message now names the environment variable, the artifactOrigins option and the configured API URL.

Before merge, please record one live Revyl run. First, start a daemon without REVYL_ARTIFACT_ORIGINS. install <id> <build> --json must return reason invalid_provider_url with details.origin, and no build bytes may be uploaded. Then run agent-device daemon stop, export the approved origins, and repeat the same install. It must complete on iOS or Android. Report only the upload_url and download_url origins, with no presigned URLs, and say whether they stay the same in a second session.

The 3 reported checks show no failures at this commit.

Not verified here: no tests were run locally, so the focused test run and the new redaction test rely on those checks. Real Revyl storage origins were not checked. The daemon ownership of REVYL_ARTIFACT_ORIGINS was traced at b0b908d; the newer changes do not touch that route, and it was not fully traced again.

The PR has merge conflicts with main.

It is also stacked on #5244. Next, resolve the conflicts and add the live run evidence.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Recommend closing this layer. A key-only Revyl setup can currently install a local build. The empty default allowlist rejects every ticket until an operator configures storage origins and restarts the daemon. The storage PUT uses a presigned URL and carries no Revyl API bearer. If restricting destinations for build bytes is required, establish the provider’s storage contract separately and assess an opt-in policy. No live install or conflict resolution is needed to close this PR.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Closing this layer following the maintainer's scope review. The storage PUT uses its presigned URL and sends no Revyl API bearer (deployment.test.ts asserts the absent authorization header), while the new empty default origin list can reject build upload in a key-only setup. A provider storage-origin policy needs its own contract and opt-in design if required later.

@thymikee thymikee closed this Dec 1, 2026
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