Skip to content

[Bug] Reject malformed GitHub Change IDs #772

Description

@DivyanshGarg380

Description

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

In particular, PR numbers such as 0, negative values, explicitly signed values, and values with leading zeros are accepted. Repository paths containing empty segments are also accepted.

Steps to Reproduce

  1. Call the GitHub Change ID parser with a PR number such as 0, -3, +5, or 007.
  2. Call it with a repository path containing an empty segment, such as github://github.example.com/uber//frontend/webapp/pull/42/<sha>.
  3. Observe that the parser returns no error for these malformed inputs.

Expected Behavior

Malformed Change IDs should be rejected during parsing.

PR numbers should be positive and use their canonical decimal representation, and repository paths should not contain empty segments.

Actual Behavior

The parser accepts these malformed inputs instead of returning an error.

Environment

  • Go version: go1.27.1
  • OS: Windows/amd64
  • Bazel: 8.4.1

Logs / Screenshots

Additional test cases reproduce these malformed inputs.

Additional Context

The malformed cases are now covered by unit tests.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions