Skip to content

fix: three defensive bug fixes (DSN cache poisoning, region silent catches, projects silent catches) - #1433

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/sentry-cli-bug-fixes-d99d
Draft

fix: three defensive bug fixes (DSN cache poisoning, region silent catches, projects silent catches)#1433
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/sentry-cli-bug-fixes-d99d

Conversation

@cursor

@cursor cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Three independent bug fixes found via codebase analysis. Each addresses a different class of silent failure that made debugging CLI issues difficult.


Fix 1: dsn-cache.ts — Empty DSN cache poisoning

Root cause: When setCachedDetection() is called with an empty allDsns array (no DSNs found), it stores dsn="" and project_id="" in the dsn_cache table. getCachedDsn() then returned these entries as valid cache hits.

Reproduction: Run any CLI command in a project with no Sentry DSN configured. The empty row gets stored, then subsequent detectDsn() calls waste time verifying a bogus cache entry before falling through to full scan.

Fix: Guard getCachedDsn() to return undefined when dsn is empty.


Fix 2: region.ts — Silent catches in resolveEffectiveOrg

Root cause: Two catch blocks silently swallowed errors from resolveOrgRegion() and listOrganizationsUncached(), making org resolution failures invisible in debug output.

Reproduction: Org resolution fails due to network error or auth issue — user sees the raw slug used as fallback with no explanation of why resolution failed.

Fix: Add log.debug() calls so errors are visible with --verbose.


Fix 3: api/projects.ts — Silent catches in project operations

Root cause: Multiple catch blocks in listProjects, seedProjectCaches, findProjectByDsnKey, and tryGetPrimaryDsn silently swallowed errors, making it impossible to diagnose why DSN detection, project resolution, or shell completions were not working.

Reproduction: Any of these best-effort operations fail (e.g., cache write error, network timeout in region fan-out) — user gets no diagnostic output.

Fix: Add log.debug() calls to all silent catch blocks.

Open in Web View Automation 

cursoragent and others added 3 commits August 17, 2026 12:08
When setCachedDetection() is called with an empty allDsns array (no DSNs
found during detection), it writes dsn="" and project_id="" into the
dsn_cache table. getCachedDsn() previously returned these entries as valid
cache hits, causing downstream code to receive a CachedDsnEntry with an
empty DSN string. This wastes time on verification attempts and inflates
cache hit telemetry with bogus entries.

Guard getCachedDsn() to return undefined (cache miss) when the stored DSN
is empty, so the caller falls through to a fresh detection scan.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
The two catch blocks in resolveEffectiveOrg() silently swallowed errors from
resolveOrgRegion() and listOrganizationsUncached(), making it impossible to
diagnose why org resolution fell back to the raw slug. Network errors, auth
issues, and API failures were completely invisible in debug output.

Add log.debug() calls so errors are visible with --verbose, following the
project's catch-block logging standard.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
…rations

Multiple catch blocks in api/projects.ts silently swallowed errors:
- listProjects: cache population failures invisible
- seedProjectCaches: project/DSN cache seeding failures invisible
- findProjectByDsnKey: per-region lookup failures invisible
- tryGetPrimaryDsn: DSN key fetch failures invisible

All of these are best-effort operations that correctly fall back on error,
but the silent catches made it impossible to diagnose why DSN detection,
project resolution, or shell completions were not working. Add log.debug()
calls so errors are visible with --verbose.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 17, 2026 12:12pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant