Skip to content

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

Merged
behinddwalls merged 1 commit into
uber:mainfrom
DivyanshGarg380:DivyanshGarg380/github-changeid-canonical-pr
Oct 5, 2026
Merged

behinddwalls merged 1 commit into
uber:mainfrom
DivyanshGarg380:DivyanshGarg380/github-changeid-canonical-pr

Conversation

@DivyanshGarg380

Copy link
Copy Markdown
Contributor

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.

@behinddwalls
behinddwalls enabled auto-merge October 5, 2026 17:39
@behinddwalls
behinddwalls added this pull request to the merge queue Oct 5, 2026
Merged via the queue into uber:main with commit 6884180 Oct 5, 2026
16 checks passed
@behinddwalls
behinddwalls deployed to stack-rebase October 5, 2026 17:51 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
stack-rebase — 7908db7e Deployed Oct 5, 2026 by behinddwalls via Rebase Stack #556
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

3 participants