Skip to content

Enforce add-labels target restrictions - #60362

Merged
pelikhan merged 8 commits into
mainfrom
copilot/fix-vulnerability-in-add-labels
Sep 12, 2026
Merged

Enforce add-labels target restrictions#60362
pelikhan merged 8 commits into
mainfrom
copilot/fix-vulnerability-in-add-labels

Conversation

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

The add_labels handler trusted model-provided item numbers over the configured target, allowing labels to be applied outside the triggering issue or pull request.

Changes

  • Runtime enforcement

    • Default omitted targets to triggering.
    • Ignore model-provided item numbers for triggering and fixed numeric targets.
    • Accept model-selected targets only when configured with target: "*".
  • Regression coverage

    • Cover explicit and default triggering targets, fixed targets with and without conflicting model output, and wildcard targets.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Enforce add-labels target configuration Enforce add-labels target restrictions Sep 12, 2026
Copilot AI requested a review from pelikhan September 12, 2026 01:14
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot update safe output specifications and derived specification tests to ensure no regressions

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update safe output specifications and derived specification tests to ensure no regressions

Addressed in 57c73a7: added normative AL-001–AL-005 target-authorization requirements, a specification conformance test, and requirement-linked runtime regression tests.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot review remove-labels, replace-labels for the same problem

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot review update-issue

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review remove-labels, replace-labels for the same problem

Addressed in 0fe865a: remove-labels and replace-labels now enforce omitted/triggering, fixed, and wildcard target authorization, with updated specifications and regression tests.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review update-issue

Addressed in b42c169: update-issue already enforced normal triggering/fixed target precedence; the remaining temporary-ID path is now wildcard-only, with UI-001–UI-005 specification requirements and regression tests.

@pelikhan
pelikhan marked this pull request as ready for review September 12, 2026 02:21
Copilot AI balanced review requested due to automatic review settings September 12, 2026 02:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Runtime target validation accepts invalid numeric values, and the replace-label specification contains conflicting wildcard requirements.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Enforces configured target authorization for label-related safe outputs and update handlers.

Changes:

  • Restricts agent-selected item numbers to wildcard targets.
  • Documents target precedence and runtime enforcement.
  • Adds regression and specification coverage.
File summaries
File Description
actions/setup/js/add_labels.cjs Enforces add-label target selection.
actions/setup/js/add_labels.test.cjs Tests target authorization modes.
actions/setup/js/remove_labels.cjs Enforces remove-label target selection.
actions/setup/js/remove_labels.test.cjs Tests removal target modes.
actions/setup/js/replace_label.cjs Enforces replacement target selection.
actions/setup/js/replace_label.test.cjs Tests replacement target modes.
actions/setup/js/update_handler_factory.cjs Limits temporary-ID resolution to wildcard mode.
actions/setup/js/update_handler_factory.test.cjs Tests update target authorization.
docs/src/content/docs/specs/safe-outputs-specification.md Documents authorization requirements.
pkg/workflow/replace_label_formal_test.go Expands formal target-mode cases.
pkg/workflow/safe_outputs_specification_add_labels_test.go Checks add-label specification requirements.
pkg/workflow/safe_outputs_specification_remove_labels_test.go Checks remove-label requirements.
pkg/workflow/safe_outputs_specification_update_issue_test.go Checks update-issue requirements.
specs/replace-label-spec.md Revises target-resolution specification.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread actions/setup/js/add_labels.cjs Outdated
itemNumber = Number(target);
}

if (!itemNumber || Number.isNaN(Number(itemNumber))) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a04e12b: fixed targets now must resolve to a positive integer, with regressions for -1, 1.5, and Infinity.

Comment thread actions/setup/js/remove_labels.cjs Outdated
itemNumber = Number(target);
}

if (!itemNumber || Number.isNaN(Number(itemNumber))) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a04e12b: fixed targets now must resolve to a positive integer, with regressions for -1, 1.5, and Infinity.

Comment thread actions/setup/js/replace_label.cjs Outdated
itemNumber = Number(target);
}

if (!itemNumber || Number.isNaN(Number(itemNumber))) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a04e12b: fixed targets now must resolve to a positive integer, with regressions for -1, 1.5, and Infinity.

| `label_to_remove` | `string` | Yes | 128 characters | Name of the label to remove from the target item. The label need not currently be present on the item (see §5.3.4). |
| `label_to_add` | `string` | Yes | 128 characters | Name of the label to add to the target item. The label need not pre-exist in the repository (see §5.4). |
| `item_number` | `integer` or temporary-ID `string` | No | — | Issue or pull request number to target. When absent, falls back to the triggering item derived from the GitHub Actions event context. May be a temporary-ID string resolved by the gh-aw temporary-ID framework. |
| `item_number` | `integer` or temporary-ID `string` | No | — | Issue or pull request number to target when `target: "*"` is configured. When absent, falls back to the triggering item derived from the GitHub Actions event context. May be a temporary-ID string resolved by the gh-aw temporary-ID framework. |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 471e84e: the target configuration table now states that wildcard targets fall back to the triggering item when item_number is absent.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Copilot AI and others added 2 commits September 12, 2026 03:50
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Ran the PR finisher pass. Addressed review feedback in 471e84e and a04e12b; local validation passes. CI must be re-triggered by a maintainer, and the replied review threads need maintainer resolution.

@pelikhan

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/34671542142/job/103494922703#step:4:1

Addressed in 9c8810e: the checkout runtime-order test now excludes the unrelated compiler-injected execution-evidence step, matching its existing treatment of observability steps. make agent-report-progress passes locally.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

…lity-in-add-labels

# Conflicts:
#	pkg/workflow/checkout_runtime_order_test.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Resolved in merge commit 030337d4ab: merged current main, resolved the checkout runtime-order test conflict, and validated the merged tree with make agent-report-progress.

@pelikhan
pelikhan merged commit 119a382 into main Sep 12, 2026
44 checks passed
@pelikhan
pelikhan deleted the copilot/fix-vulnerability-in-add-labels branch September 12, 2026 04:56
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.89.8

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.

3 participants