Skip to content

pr-labeler: a title scoped constructor or toString kills the label job through a bare prototype lookup #4125

Closed

Description

.github/workflows/pr-labeler.yaml looks both of its tables up bare: typeToKind[type] at line 192 and scopeToArea[s] at line 205. Neither table has a null prototype, so a key inherited from Object.prototype resolves to a function instead of to nothing. A function is truthy, so it gets added to the label set, and the [...toAdd].some(l => l.startsWith('area/')) at line 218 then throws l.startsWith is not a function and the step dies.

Reproduced with the same lookup shape and the same consumer:

vm-instance      string   -> area found
constructor      function -> THROWS: l.startsWith is not a function
toString         function -> THROWS: l.startsWith is not a function
hasOwnProperty   function -> THROWS: l.startsWith is not a function

Both entry points are reachable from a title. The scope is captured by ([^)]+) or [^\]]+, so constructor, toString, hasOwnProperty and __proto__ all pass through it. The type is constrained to ^([a-z]+), which still admits constructor, so a title of constructor: anything reaches it on its own.

Sizing it rather than escalating it: the workflow triggers on pull_request_target, so the title is attacker-controlled from a fork, but the consequence is a dead labeling step. No code runs and no token is exposed. What it costs is that the pull request gets no labels at all, and the failure is quiet in the same way as #4124, because nobody goes looking at a labeler that did not label.

Object.hasOwn(scopeToArea, s) and Object.hasOwn(typeToKind, type) close both sites. This belongs next to the double-backport bug: same class, a title parsed into a lookup that silently yields something other than a mapping, and both would be caught by the contract test this workflow does not have.

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug
    area/ciIssues or PRs related to CI workflows, GitHub Actions, automation
    on Sep 7, 2026
  2. added
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/backlogGeneral backlog priority. Lower than priority/important-longterm
    and removed
    triage/needs-triageIndicates an issue needs triage by a maintainer
    on Sep 23, 2026
  3. added a commit that references this issue on Oct 5, 2026
    6e4c9c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/ciIssues or PRs related to CI workflows, GitHub Actions, automationkind/bugCategorizes issue or PR as related to a bugpriority/backlogGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions