Skip to content

fix(change): reject non-canonical PR numbers in github ParseChangeID - #773

Open
DivyanshGarg380 wants to merge 1 commit into
uber:mainfrom
DivyanshGarg380:DivyanshGarg380/github-changeid-canonical-pr
Open

DivyanshGarg380 wants to merge 1 commit into
uber:mainfrom
DivyanshGarg380:DivyanshGarg380/github-changeid-canonical-pr

Conversation

@DivyanshGarg380

Copy link
Copy Markdown

Why?

The GitHub Change ID parser currently accepts malformed Change IDs that do not conform to the expected format.

This can result in invalid PR numbers and repository paths being accepted as valid Change IDs.

What?

  • Reject non-positive PR numbers.
  • Reject non-canonical PR number representations such as +5 and 007.
  • Reject repository paths containing empty segments.
  • Add unit tests covering these malformed inputs.

Valid Change IDs continue to be parsed as before.

Test Plan

  • gofmt -l platform/base/change/github — no output
  • go test ./platform/base/change/github/... — passed
  • python .\tool\bazel --output_user_root=C:/bzl test //platform/base/change/github:all — passed

Added test coverage for:

  • Zero PR numbers
  • Negative PR numbers
  • Plus-signed PR numbers
  • Leading-zero PR numbers
  • Empty repository path segments

Issue

Closes #772

@CLAassistant

CLAassistant commented Oct 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

[Bug] Reject malformed GitHub Change IDs

2 participants