Dashboard › cli › Distillation
51ab3ece-55a3-41f0-9e86-fa7b33c1a058["lore_tm_v1_Yg_TmI_Aay0fwwKZ1alv2zKEwwmp-oAIp_POuiBWDcI","lore_tm_v1_ZiDv8tOZKkxM6AEpEmpRdv1Se5xv8oXGjJt2cksAaqI","lore_tm_v1_ZDzsd34w-YKYlNg69OUfPd6Y9_Nagh1X1QeGnyN0rfk","lore_tm_v1_0S0bPxhZ7P4EGqSOBJgemVXaMESqaFzIs6h9tf2nOBQ","lore_tm_v1_QMjtVjdMOY67kTq84TUGHTBnajxvSigX79L4FgwgVsQ","lore_tm_v1_bktxJm2cWC0eegyp7Q8G4JxBRmZA6hSDXBuPPRen7zo","lore_tm_v1_FBOqGYueeDxTcRnImm05YWmpuFnY5QjpmXsdk187Ud8","lore_tm_v1_Qa8Zy0X1TAQCzPZYk6HxACB5mQ8r8_aIjQ3v2_lqZz8","lore_tm_v1_iPfPHOqUo1X8gVcnm2i_AmZ0hhPcb4rKK3jocnVuzf0","lore_tm_v1_MFM4cJI1yyp6c1rFbQdY3d3fbiq0z4j7MDmYu4_tzJI","lore_tm_v1_h8iyUyyBICNTw_xO5enBhbVfOEKneYPswfUtSBcMFIM","lore_tm_v1_a0BPVg0LB-VAh158E4jtYsmEshhHoJ5TMRkV6Ue0Ln0","lore_tm_v1_xGJdENAu-Snn2pQFtZydgRcqUl8rzoy9fqx8IlaBas8","lore_tm_v1_2yhWKfD-1JmqvTYLdDavDlJU4omQ2WE4V4eMzbVZ-a8","lore_tm_v1_AbO6gTezNFYSTSPZsX5fBH0qkUptKSRU8bmL3vg8mn0","lore_tm_v1_b1sq8qdAeGrbSy9GDNsfq9uUEAz5y0P4UQ0sFMILRIs","lore_tm_v1_2WZpBANrIrDz8UJCVqis9UjUyUReuv6y_4QFeDAa1HQ","lore_tm_v1_JhT8kNFMNOV5uNQQiqa4UkfAswMfuGr5to2I-nZXlgM","lore_tm_v1_YnJdRqEzGrLrSu2elzly4V0sOhWPK9tQTGrp55uRtoU"]
Date: Sep 10, 2026
packages/cli/src/lib/oauth.ts fetchWithConnectionError(url, init) manually follows redirects with redirect: "manual" and MAX_REDIRECTS; for each request it clones request headers, applies applyCustomHeaders(headers, request.url), fetches with custom TLS options, and returns non-redirect responses.fetchWithConnectionError() accepts statuses 301, 302, 303, 307, and 308; getRedirectUrl() throws ApiError for missing or invalid Location; redirects beyond MAX_REDIRECTS throw ApiError("Too many redirects (maximum ${MAX_REDIRECTS})", response.status, undefined, request.url).isHostTrusted(destination, url) before continuing; an untrusted destination throws HostScopeError("OAuth request", normalizeOrigin(destination) ?? "<unknown host>", normalizeOrigin(url)).getRedirectRequest() changes a non-GET/non-HEAD request to GET for 303, changes POST to GET for 301/302, and otherwise preserves request semantics with new Request(destination, request).assertRefreshHostTrusted() in packages/cli/src/lib/oauth.ts obtains refreshUrl = getSentryUrl() and rejects an untrusted refresh endpoint with HostScopeError("OAuth refresh token", normalizeOrigin(refreshUrl) ?? "<unknown host>", getActiveTokenHost()); it is defense-in-depth for mutation of SENTRY_HOST/SENTRY_URL outside URL-argument or rc-shim guards.packages/cli/src/lib/db/schema.ts defines org_regions.source_origin as TEXT, introduced in schema version 17. Documentation says it is the origin returning the regional URL, and rows only extend trust for credentials scoped to that control-silo origin.apply_patch to packages/cli/src/lib/api/projects.ts failed because expected import line import { getSdkConfig } from "../sentry-client.js"; was not found.packages/cli/src/lib/api/organizations.ts listOrganizations() reads cached organizations through getCachedOrganizations() and returns cached { id, slug, name, orgRole? } values when nonempty; on cache miss it calls listOrganizationsUncached().listOrganizationsUncached() queries organizations from controlSiloUrl = getControlSiloUrl() using paginated listOrganizationsPage, then calls setOrgRegions() with each org’s slug, regionUrl: org.links?.regionUrl ?? controlSiloUrl, sourceOrigin: controlSiloUrl, orgId, orgName, and orgRole.packages/cli/src/lib/api/projects.ts imports getCachedOrganizations from ../db/regions.js and getApiBaseUrl from ../sentry-client.js, indicating active-origin-aware organization-cache updates were being applied.project delete never suggests sentry auth login; re-authenticating via OAuth will not change permissions.packages/cli/src/commands/project/delete.ts buildPermissionError(orgSlug, projectSlug) first reads getCachedOrgRole(orgSlug) and falls back to getOrganization(orgSlug); users with member or billing roles receive a 403 explaining that deletion requires Manager, Owner, or Admin and should contact an org admin. The documented alternative for privileged roles is checking custom-token project:admin scope, not OAuth re-login.registerTrustedRegionUrls() at packages/cli/src/lib/db/regions.ts:76, with call sites at regions.ts:233 and regions.ts:282; related tests are packages/cli/test/lib/security/sntrys-claim-mismatch.test.ts:380 and packages/cli/test/lib/db/auth.host.test.ts:220.packages/cli/src/lib/db/regions.ts, packages/cli/src/lib/api/organizations.ts, packages/cli/src/lib/api/projects.ts, packages/cli/src/commands/project/delete.ts, and packages/cli/src/commands/org/list.ts.test.poolOptions was removed and previous poolOptions must be top-level options.SENTRY_AUTH_TOKEN defers to stored OAuth unless SENTRY_FORCE_ENV_TOKEN=1.packages/cli/test/lib/db/schema.test.ts with a migration regression intended to verify legacy org_regions rows remain unproven after upgrading to schema version 17.packages/cli/src/lib/oauth.ts:200: Biome rule lint/complexity/noExcessiveCognitiveComplexity measured fetchWithConnectionError() complexity 17, above maximum 15. The check processed 17 files in 4s, applied no fixes, and reported 1 error.packages/cli/src/lib/oauth.ts to refactor the excessive-complexity redirect logic. No post-refactor validation result was shown.