feat(install): download the agent from the API endpoint, drop the proxy (VAPP-35) #50

Merged
nrupard merged 1 commit from feat/vapp-35-repoint-download-to-api into main 2026-06-26 16:44:05 +02:00
Owner

What

Repoints the agent-binary download in the enrollment flow straight at the API server's public download endpoint and removes this frontend's /agent/<id> proxy, so the agent install path no longer transits the frontend (parent epic VS-54).

Changes

  • get_group_install builds agent_url as <server_url>/api/v1/agent/binary/<id>?token=<install-token>, where server_url is the same authoritative GroupServer host the corrected .vagent already uses (VS-55). It mints the scoped, expiring install token (VS-57) from the backend's GET /agentbinaries/install-token over the operator's session, so the unattended device-side curl (which has no vervain_session) is authorized.
  • Removes the /agent/{id} route and the agent_proxy handler; main collapses back to a plain dioxus::launch now that no custom axum route is needed. Drops the helpers that only served the proxy (browser_host, browser_origin, cookie_value) and the dead cookie_value test.
  • The install snippet single-quotes the URL so the shell does not glob the ? in ?token=.

Coordination

Pairs with vervain-server #74 (VS-56) (the download endpoint) and #77 (VS-57) (the install-token mint + ?token= gate). The path string /api/v1/agent/binary mirrors vervain-web's wire_paths::AGENT_BINARY_DOWNLOAD_PATH. Deploy together: the apps change references the server's wire contract.

CORS / cross-origin

The admin "Download agent" button is a plain top-level <a href> navigation, not a fetch, so a cross-origin download from api.vervain.a8n.systems is not CORS-gated; the install token authorizes it.

Acceptance criteria

  • Install snippet download host is the API host, not the frontend origin.
  • /agent/{id} route + agent_proxy removed, no dangling references (clippy --features server -- -D warnings clean).
  • No remaining apps code streams the agent binary.

Test

cargo clippy --all-targets --features server -- -D warnings clean, cargo check --target wasm32-unknown-unknown clean, cargo test --features server --bin vervain-app green (19 passed), cargo fmt --check clean.

## What Repoints the agent-binary download in the enrollment flow straight at the API server's public download endpoint and removes this frontend's `/agent/<id>` proxy, so the agent install path no longer transits the frontend (parent epic VS-54). ## Changes - `get_group_install` builds `agent_url` as `<server_url>/api/v1/agent/binary/<id>?token=<install-token>`, where `server_url` is the same authoritative `GroupServer` host the corrected `.vagent` already uses (VS-55). It mints the scoped, expiring install token (VS-57) from the backend's `GET /agentbinaries/install-token` over the operator's session, so the unattended device-side `curl` (which has no `vervain_session`) is authorized. - Removes the `/agent/{id}` route and the `agent_proxy` handler; `main` collapses back to a plain `dioxus::launch` now that no custom axum route is needed. Drops the helpers that only served the proxy (`browser_host`, `browser_origin`, `cookie_value`) and the dead `cookie_value` test. - The install snippet single-quotes the URL so the shell does not glob the `?` in `?token=`. ## Coordination Pairs with vervain-server **#74 (VS-56)** (the download endpoint) and **#77 (VS-57)** (the install-token mint + `?token=` gate). The path string `/api/v1/agent/binary` mirrors `vervain-web`'s `wire_paths::AGENT_BINARY_DOWNLOAD_PATH`. Deploy together: the apps change references the server's wire contract. ## CORS / cross-origin The admin "Download agent" button is a plain top-level `<a href>` navigation, not a `fetch`, so a cross-origin download from `api.vervain.a8n.systems` is not CORS-gated; the install token authorizes it. ## Acceptance criteria - Install snippet download host is the API host, not the frontend origin. - `/agent/{id}` route + `agent_proxy` removed, no dangling references (clippy `--features server -- -D warnings` clean). - No remaining apps code streams the agent binary. ## Test `cargo clippy --all-targets --features server -- -D warnings` clean, `cargo check --target wasm32-unknown-unknown` clean, `cargo test --features server --bin vervain-app` green (19 passed), `cargo fmt --check` clean.
feat(install): download the agent from the API endpoint, drop the proxy
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 31s
Create release / Create release from merged PR (pull_request) Has been skipped
0d6711a9c1
The install snippet's agent-binary download now points straight at the API server's public endpoint (vervain-server VS-56, /api/v1/agent/binary/<id>), built from the same authoritative server_url the corrected GroupServer uses, instead of this frontend's /agent/<id> proxy. The agent install path no longer transits the frontend (parent VS-54).

get_group_install mints a scoped, expiring install token (VS-57) from the backend's /agentbinaries/install-token over the operator's session and appends it as ?token=, so the unattended device-side curl - which carries no vervain_session - is authorized. The snippet single-quotes the URL so the shell does not glob the ?.

Removes the /agent/{id} route and the agent_proxy handler, collapsing main back to a plain dioxus::launch now that no custom axum route is needed, plus the helpers that only served the proxy: browser_host, browser_origin, cookie_value, and the cookie_value test. The admin "Download agent" button is a plain top-level anchor navigation, so the cross-origin download from the API host is not CORS-gated; the install token authorizes it.

#VAPP-35

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard deleted branch feat/vapp-35-repoint-download-to-api 2026-06-26 16:44:05 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-apps!50
No description provided.