Skip to content

fix(issue): Handle GitHub-style #SHORTID in issue identifiers#1004

Draft
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/issue-identifier-hash-fragment
Draft

fix(issue): Handle GitHub-style #SHORTID in issue identifiers#1004
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/issue-identifier-hash-fragment

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 22, 2026

This PR addresses CLI-1G1, where sentry issue view commands were failing with a ValidationError: Invalid issue identifier: contains "#" (URL fragment).

Root Cause:
AI agents (like claude-code and codex) frequently pass GitHub-style issue identifiers such as org/project#SHORTID. The parseIssueArg function in src/lib/arg-parsing.ts was stripping / characters but not # before calling validateResourceId. The validateResourceId function, designed to prevent URL injection, correctly rejects # as a forbidden URL fragment character, leading to the ValidationError.

Solution:

  1. Pre-process #fragment: In parseIssueArg, before the general validateResourceId call, a new parsing step detects and extracts a trailing #fragment.
  2. Validate fragment: The extracted fragment (intended as the issue's short ID) is validated independently using validateResourceId to ensure it doesn't contain other forbidden characters.
  3. Rewrite input: The original input is then rewritten to prefix/fragment (e.g., org/project/SHORTID) or just fragment if no prefix was present. This allows the existing slash-parsing logic to correctly interpret the identifier.
  4. Improved error message: If the # is used incorrectly (e.g., multiple #s, empty fragment), a more helpful ValidationError is thrown, suggesting the correct org/project/SHORTID format.
  5. Downstream flow: Subsequent parsing steps (numeric, colon, slash, dash, suffix-only) now operate on the normalized input, ensuring the rewritten value is processed correctly.

This change allows sentry issue view to correctly parse org/project#SHORTID inputs while maintaining robust validation against malicious or malformed identifiers.

Fixes CLI-1G1

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1004/

Built to branch gh-pages at 2026-05-22 10:38 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

0 participants