`.sentryclirc` with a self-hosted `url` refuses commands and SDK calls whose `SENTRY_URL`, `SENTRY_HOST` or `url` option names another server
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 22/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- nodejs, typescript
- Domínio
- api, authentication, cli
Direção de pesquisa
Start with assertRcUrlTrusted in packages/cli/src/lib/sentryclirc.ts (around L422-457) and its call sites in packages/cli/src/lib/command.ts (L588-589, L895-898), then compare with the override handling in applySentryCliRcEnvShim (L398-408) and the existing mcp.ts host check (L419-429). Run the linked repro.mjs with a self-hosted .sentryclirc url and SENTRY_URL set. Done means the reproducer exits 0 for the runs that name the stand-in, while the token-trust and no-override refusals still hold.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Environment
sentrybuilt frommainat 5f11870fefae0818025715619f41a597607c4ef9 (sentry --version:0.52.0-dev.0), and[email protected]from npm, which does the same- node v26.12.1 on win32 x64, and node v20.20.2, which does the same
Steps to Reproduce
- Write
~/.sentryclirc:[defaults] url=https://sentry.example.com - Run
sentry release view example-org/1.0.0withSENTRY_AUTH_TOKENset andSENTRY_URLnaming another server (here a local stand-in for the Sentry API). - Run it again with
SENTRY_HOSTnaming that server instead ofSENTRY_URL. - Call
createSentrySDK({ url, token }).release.view({ orgVersion: "example-org/1.0.0" })withurlnaming that server. - Repeat steps 2 to 4 with no
~/.sentryclirc, and with one whoseurlishttps://sentry.io/.
Expected Result
Steps 2 to 4 send their requests to the server they name and show the release, as every run of step 5 does. With SENTRY_URL or SENTRY_HOST set (the SDK's url sets SENTRY_HOST), the .sentryclirc URL is not applied (applySentryCliRcEnvShim). I ask this only where an explicit override names where the requests go: SENTRY_URL, SENTRY_HOST or the SDK's url.
The check stays:
- for a self-hosted
.sentryclircURL the CLI applies, with neither variable set; - for a
.sentryclircwhose[auth] tokenbecomes the token in use (L385-L396), so the file's token does not go to the server the environment names.
I leave the refusal of createSentrySDK({ token }) without url as it is: its requests would go to sentry.io (sdk-types.ts#L21-L26) while the file names another server, so that refusal flags a real conflict.
Actual Result
Steps 2, 3 and 4 each fail with exit code 13 (Host Scope) before sending any request. Step 2:
$ SENTRY_URL=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Error: Config at <tmp>\home-self-hosted\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:62387).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exit 13; requests the stand-in received: none
Step 4:
> createSentrySDK({ url: "http://127.0.0.1:62387", token: "example-token" }).release.view({ orgVersion: "example-org/1.0.0" })
Config at <tmp>\home-self-hosted\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:62387).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exitCode 13
exit 13; requests the stand-in received: none
Every run of step 5 reaches the server and shows the release.
assertRcUrlTrusted checks the .sentryclirc URL whether or not the environment overrides it, and the command wrapper calls it before every command that does not opt out (L588-L589, L895-L898).
docs/operations/stdio-auth.md describes this refusal for sentry mcp as "the same check every CLI command applies", made "instead of sending any token to that host". With SENTRY_URL or SENTRY_HOST set, no request goes to that host: with a .sentryclirc naming sentry.io, step 5's requests go to the server the environment names. sentry mcp --host, which the same page says runs "as if SENTRY_URL were set", already skips the check (mcp.ts#L419-L429, from #1801), while its deprecation warning says to "use SENTRY_HOST instead" (mcp.ts#L403-L407, mcp/args.ts#L99-L109), which this check refuses. No test that expects the refusal sets SENTRY_URL or SENTRY_HOST.
#2538 (for #2537) trusts a .sentryclirc URL that matches the url claim of an sntrys_ token read from a .sentryclirc. It leaves this case as it was: the token here comes from the environment, and the SDK's token becomes SENTRY_AUTH_TOKEN as well (sdk-invoke.ts#L46-L49). #2580 meets the same refusal from the SDK, under a .sentryclirc above the repository root that sentry commands do not read.
Reproducer
https://gist.github.com/YevheniiKotyrlo/04b4403a8fcd7cec71b53ccd051615cc
It runs steps 2 to 5 in a temporary folder against a local stand-in for the Sentry API that records each request. Each run starts from the caller's environment without its SENTRY_* and GIT_* variables and sets its own: TMPDIR, TEMP and TMP (a folder inside the temporary folder), HOME and USERPROFILE (one of three home folders), SENTRY_CONFIG_DIR (a folder of its own), the step's SENTRY_URL or SENTRY_HOST with SENTRY_AUTH_TOKEN (or the SDK's url and token), and SENTRY_CLI_NO_TELEMETRY, SENTRY_CLI_NO_UPDATE_CHECK and NO_COLOR. The verdict depends on the home folder, the server named and the token. SENTRY_CONFIG_DIR keeps out a stored login, which would let the check pass, and the response cache; the last three keep telemetry, the update check and colour out of the runs. It exits 1 while a run that names the stand-in is refused (exit 13, or the refusal's words, with no request sent), 0 once those runs reach the stand-in, 2 when a step fails or the run ends another way. A .sentryclirc that sets url in a folder above the temporary folder would apply to every run, so the reproducer then stops with 2; point TMPDIR (TEMP and TMP on Windows) at a folder with none above it. It needs Node 20+, and no Sentry account.
node repro.mjs # sentry@latest from npm
node repro.mjs 0.50.0 # a given version from npm
node repro.mjs <toolkit> # a getsentry/toolkit checkout: runs `pnpm run bundle` in packages/cli first
Its result on main:
RESULT (exit 1): defect shows (sentry 0.52.0-dev.0 built from 5f11870fefae): the self-hosted .sentryclirc URL refused 3 of 3 runs that name another server (SENTRY_URL, SENTRY_HOST, createSentrySDK url), with no request sent; the runs without it reached the stand-in
Its whole output on main
node v26.12.1 on win32 x64
$ # sentry: getsentry/toolkit at 5f11870fefae0818025715619f41a597607c4ef9, no uncommitted changes
$ pnpm run bundle # in packages/cli
$ sentry --version
0.52.0-dev.0
# HOME: no .sentryclirc
$ SENTRY_URL=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
exit 0; requests the stand-in received: GET /api/0/organizations/example-org/ -> 200, GET /api/0/organizations/example-org/releases/1.0.0/ -> 200
# HOME: .sentryclirc naming sentry.io (url=https://sentry.io/)
$ SENTRY_URL=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
exit 0; requests the stand-in received: GET /api/0/organizations/example-org/ -> 200, GET /api/0/organizations/example-org/releases/1.0.0/ -> 200
# HOME: .sentryclirc naming a self-hosted server (url=https://sentry.example.com)
$ SENTRY_URL=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Error: Config at <tmp>\home-self-hosted\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:62387).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exit 13; requests the stand-in received: none
# HOME: no .sentryclirc
$ SENTRY_HOST=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
exit 0; requests the stand-in received: GET /api/0/organizations/example-org/ -> 200, GET /api/0/organizations/example-org/releases/1.0.0/ -> 200
# HOME: .sentryclirc naming sentry.io (url=https://sentry.io/)
$ SENTRY_HOST=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
exit 0; requests the stand-in received: GET /api/0/organizations/example-org/ -> 200, GET /api/0/organizations/example-org/releases/1.0.0/ -> 200
# HOME: .sentryclirc naming a self-hosted server (url=https://sentry.example.com)
$ SENTRY_HOST=http://127.0.0.1:62387 SENTRY_AUTH_TOKEN=example-token sentry release view example-org/1.0.0
Error: Config at <tmp>\home-self-hosted\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:62387).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exit 13; requests the stand-in received: none
# HOME: no .sentryclirc
> createSentrySDK({ url: "http://127.0.0.1:62387", token: "example-token" }).release.view({ orgVersion: "example-org/1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/example-org/ -> 200, GET /api/0/organizations/example-org/releases/1.0.0/ -> 200
# HOME: .sentryclirc naming sentry.io (url=https://sentry.io/)
> createSentrySDK({ url: "http://127.0.0.1:62387", token: "example-token" }).release.view({ orgVersion: "example-org/1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/example-org/ -> 200, GET /api/0/organizations/example-org/releases/1.0.0/ -> 200
# HOME: .sentryclirc naming a self-hosted server (url=https://sentry.example.com)
> createSentrySDK({ url: "http://127.0.0.1:62387", token: "example-token" }).release.view({ orgVersion: "example-org/1.0.0" })
Config at <tmp>\home-self-hosted\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:62387).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exitCode 13
exit 13; requests the stand-in received: none
RESULT (exit 1): defect shows (sentry 0.52.0-dev.0 built from 5f11870fefae): the self-hosted .sentryclirc URL refused 3 of 3 runs that name another server (SENTRY_URL, SENTRY_HOST, createSentrySDK url), with no request sent; the runs without it reached the stand-in
- Linguagem predominante
- TypeScript
- Estrelas
- 975
- Forks
- 189
- Merge médio
- 19h 57min
- PRs com merge (30d)
- 542
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de getsentry/toolkit
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
getsentry/toolkit#2583 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
getsentry/toolkit#2531 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
mcp-feedback-pattern
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
getsentry/toolkit#2458 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
getsentry/toolkit#2444 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
mcp-feedback-pattern
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
getsentry/toolkit#2362 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de getsentry/toolkit
Issues semelhantes
-
sumHorizontal, maxHorizontal, minHorizontal, allHorizontal, anyHorizontal, struct and argSortBy treat strings as literals instead of column namesTalvez já em andamento @tomaionescu assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
pola-rs/nodejs-polars#486 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
jaegertracing/jaeger-ui#4853 ·
Mantenedores costumam responder em até 1 dia
-
area/plugins platform/linux reproduced type/bug version/v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
anomalyco/opencode#66970 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
area:tui enhancement platform:macos
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
anthropics/claude-code#112838 ·
-
Add: Sports First TV (US)Abertaapproved check:passed streams:add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia