Skip to content

feat(agent-handoff): Verify and pin the CLI installer from the release registry - #130060

Merged
evanpurkhiser merged 2 commits into
masterfrom
feat/agent-handoff-verify-installer
Nov 12, 2026
Merged

evanpurkhiser merged 2 commits into
masterfrom
feat/agent-handoff-verify-installer

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

The private CLI setup runbook (#129764) tells the agent to run curl -fsSL https://cli.sentry.dev/install | … bash. That runs whatever cli.sentry.dev serves at that moment, at whatever version it picks.

Since getsentry/toolkit#1962, each CLI release attaches its install script as a GitHub release asset, and the release registry lists its URL (file_urls.install) and SHA-256 (files.install.checksums["sha256-hex"]). The runbook now reads both from the cached /apps registry entry, downloads the script from that release, runs it only if the hash matches, and pins SENTRY_VERSION to the same release. The installer then verifies the CLI binary against the registry's checksums.

CLI releases are immutable, but GitHub is what enforces that. Baking in the registry checksum means the script only runs if GitHub and the registry agree, and the check is visible to anyone reading the handoff. Because the script and checksum come from the same registry entry, a CLI release opens no mismatch window.

  • sentry.agent_handoff.installer picks the installer and builds the command; the runbook only renders it.
  • Both values end up in a shell command, so only a github.com/getsentry/toolkit/releases/download/cli@<semver>/install URL and a 64-character lowercase hex checksum are accepted. The pinned version comes from that URL.
  • When the registry has no install entry (self-hosted, or before the first CLI release that ships one), the runbook uses the plain curl https://cli.sentry.dev/install | bash command.

via evan.purkhiser, @BYK.

--

View Session [Sentry]

@sentry-junior
sentry-junior Bot requested a review from a team as a code owner November 5, 2026 14:16
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 5, 2026

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/agent_handoff/runbook.py Resolved
Comment thread src/sentry/agent_handoff/runbook.py Resolved

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/agent_handoff/runbook.py Resolved

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/agent_handoff/runbook.py Resolved
Comment thread src/sentry/agent_handoff/installer.py Resolved
Comment thread src/sentry/agent_handoff/installer.py Resolved
@evanpurkhiser

Copy link
Copy Markdown
Member

This should be good to go

@wedamija

wedamija commented Nov 5, 2026

Copy link
Copy Markdown
Member

bigger thought: since toolkit#1962 each release has an install asset, and the registry has its checksum. what if we curl the release asset instead of cli.sentry.dev/install? e.g. build https://github.com/getsentry/toolkit/releases/download/cli@{version}/install from the registry version.

then the script and checksum always come from the same release, so there's no mismatch window during a CLI release. the checksum still only comes from the registry, so a tampered script still fails. and the served-hash fetch, registry refresh, ratelimit, fallback and "release in progress" text could all go.

@sentry-junior

sentry-junior Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Agreed, I think this works and it's simpler. Some details from checking the current state:

  • The registry already lists a download URL for each release asset under file_urls, so once install ships we can read file_urls["install"] and files["install"] from the same cached /apps entry instead of building the URL ourselves. The script and checksum then always come from the same release, even if the hourly cache is a version behind, which is still a matching pair.
  • The trust split stays: the script comes from GitHub release assets and the checksum from the registry. cli.sentry.dev drops out of the chain entirely.
  • The script installs the latest stable binary by default, so running an older cached release's install is still fine. If we want the binary to match exactly too, we can pass SENTRY_VERSION={version}.
  • Not live yet: [email protected] is still the latest release, and it has no install asset or registry entry. Until the next CLI release, the runbook keeps the plain curl | bash fallback either way.
  • The one piece I'd consider keeping is the last-known-good fallback. Without it, a registry entry that's missing install (for example, a release cut before Track number of processes by role #1962's craft config) would quietly drop back to an unverified install. Dropping it is reasonable if we're fine with that gap.

I'll check with @evanpurkhiser, since this replaces most of what's in the PR now.

Copy link
Copy Markdown
Member

Ahh OK so basically we would server the latest fixed version from the registry. yes ok this actually does seem a lot better

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/agent_handoff/installer.py Resolved

Copy link
Copy Markdown
Member

Jr I think we can simplify even more, do we actually need to download the installer?

I think we don't need to do that, we won't be using cli.sentry.dev/install anymore, the prompt will be pinning the sentry CLI version to whatever release registry says the latest version is

@sentry-junior sentry-junior Bot changed the title feat(agent-handoff): Verify CLI installer checksum before running it feat(agent-handoff): Pin the CLI installer to the latest registry release Nov 5, 2026
@sentry-junior

sentry-junior Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, we don't need to hash it. cli@* releases on getsentry/toolkit are immutable (immutable: true on [email protected]), so a pinned release asset can't change after it's published. The installer also already checks the CLI binary against the registry's sha256-hex before installing it. Downloading the installer to verify its own hash added nothing.

Done in 29ae569. The runbook now renders:

curl -fsSL https://github.com/getsentry/toolkit/releases/download/cli@<version>/install | <env> SENTRY_VERSION=<version> bash

<version> comes from the registry's file_urls.install, so the installer and the binary are from the same release. I dropped the checksum dance, the last-published cache and the template note. I checked that SENTRY_VERSION=0.47.0 with the current installer installs and checksum-verifies 0.47.0.

One caveat: no release has the install asset yet, so until the next CLI release the runbook keeps the plain cli.sentry.dev/install | bash. That's the same as master today.

@evanpurkhiser
evanpurkhiser enabled auto-merge (squash) November 5, 2026 19:13
@sentry-junior sentry-junior Bot changed the title feat(agent-handoff): Pin the CLI installer to the latest registry release feat(agent-handoff): Verify and pin the CLI installer from the release registry Nov 5, 2026
@evanpurkhiser

Copy link
Copy Markdown
Member

jr please rebase ci failing

…e registry

The runbook ran whatever https://cli.sentry.dev/install served, at whatever
version it picked. Each CLI release now attaches its install script, and the
release registry lists the asset URL and SHA-256. The runbook downloads the
script from that release, runs it only if it matches the registry checksum, and
pins SENTRY_VERSION to the same release. Without a registry entry it keeps the
plain cli.sentry.dev command.
@sentry-junior
sentry-junior Bot force-pushed the feat/agent-handoff-verify-installer branch from 39f78ff to 8836e89 Compare November 5, 2026 19:50
@evanpurkhiser
evanpurkhiser merged commit 2cd8c04 into master Nov 12, 2026
59 checks passed
@evanpurkhiser
evanpurkhiser deleted the feat/agent-handoff-verify-installer branch November 12, 2026 20:20

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e973f57. Configure here.

if not isinstance(sha256, str) or not _SHA256_HEX.fullmatch(sha256):
return None

return PinnedInstaller(url=url, version=match["version"], sha256=sha256)

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.

Pinned installer reads the wrong registry payload

High Severity

pinned_installer() pulls file_urls.install and files.install.checksums from the cached GET /apps index. That index is summary metadata (same pattern as /sdks); the install URL and SHA-256 live on /apps/sentry/latest, which is not cached. Missing nested fields return None, and the runbook silently emits the old unverified curl | bash command, so checksum pinning likely never activates in production.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e973f57. Configure here.

This branch was successfully deployed

1 active deployment
Preview — e973f57c Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants