Skip to content

Self-hosted url in .sentryclirc is refused with its own token #2537

Done

Description

@sentry-junior

When a project's .sentryclirc has both an sntrys_ org token in [auth] token and a matching self-hosted [defaults] url, every command refuses to run: "Refusing to route requests here because it doesn't match the host your Sentry credentials are for." This is the setup sentry wizard writes for self-hosted projects (#2525, #2529).

  • assertRcUrlTrusted (packages/cli/src/lib/sentryclirc.ts) trusts a non-SaaS rc URL only when it matches getActiveTokenHost() or a stored login's host.
  • env-token-host.ts already treats an sntrys_ token's embedded url claim as authoritative, but it snapshots the host at boot, before applySentryCliRcEnvShim copies the rc token into SENTRY_AUTH_TOKEN. A token set later "was not scoped by this snapshot", so the rc token's claim is never consulted.
  • An env sntrys_ token plus a matching rc url already works.
  • Threat to keep covering: an attacker who can write or append to a .sentryclirc, or add a project-level one under a global rc that holds the token, but can't read the token. They must not be able to point an existing token at another host. SENTRY_CUSTOM_HEADERS also must not attach to hosts that only the rc shim names.

Scope chosen by @BYK: apply the claim check to rc-injected sntrys_ tokens only. Opaque tokens from .sentryclirc keep being refused for a self-hosted rc url.

via @BYK.

--

View Session [Sentry]

Activity

  1. linear-code commented on Nov 26, 2026

    @linear-code
  2. added a commit that references this issue on Nov 27, 2026
    03396b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions