Skip to content

fix(ci): gate type labels for trusted PRs - #490

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-fork-prs-self-applying-labels-issue
Jun 10, 2026
Merged

fix(ci): gate type labels for trusted PRs#490
JSONbored merged 1 commit into
mainfrom
codex/fix-fork-prs-self-applying-labels-issue

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Prevent untrusted fork PR authors from using pull_request_target runs to cause privileged repository label writes based on attacker-controlled PR titles.
  • Preserve label-integrity for downstream scoring by only allowing deterministic type-labeling for trusted actors or same-repository PRs.
  • Reduce workflow privileges by removing unused write permissions that could be abused by fork-triggered runs.

Description

  • Add isTrustedPullRequestForLabeling which returns true for author_association values OWNER, MEMBER, or COLLABORATOR, or when the PR head.repo.full_name equals the base.repo.full_name (same-repo PRs).
  • Gate pull_request_target handling in getTypeLabelDecision to skip with reason untrusted-pull-request-author for untrusted PRs and short-circuit shouldFetchReferencedIssues to avoid authenticated fetches for untrusted forks.
  • Remove the unnecessary pull-requests: write permission from .github/workflows/type-label.yml while keeping issues: write for legitimate label operations.
  • Add focused unit tests in test/unit/github-type-label.test.ts covering trusted-author labeling, skipping untrusted fork PRs, same-repository PR behavior, and avoiding issue fetches for untrusted forks.

Testing

  • Ran git diff --check which completed without issues.
  • Ran unit tests with npm test -- --run test/unit/github-type-label.test.ts and all tests in that file passed (30 passed).
  • Ran TypeScript checks with npm run typecheck which completed successfully.
  • Ran npm run actionlint as part of validation which completed (using fallback tooling) without failing the change.

Codex Task

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 17fdd0e Commit Preview URL

Branch Preview URL
Jun 10 2026, 06:26 AM

@ghost

ghost commented Jun 9, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #490 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 9, 2026
@ghost ghost added the gittensory:reviewed label Jun 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored force-pushed the codex/fix-fork-prs-self-applying-labels-issue branch from 5611625 to 17fdd0e Compare June 10, 2026 06:25
@JSONbored
JSONbored merged commit 038e523 into main Jun 10, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/fix-fork-prs-self-applying-labels-issue branch June 10, 2026 06:30
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant