Enforce add-labels target restrictions - #60362
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot update safe output specifications and derived specification tests to ensure no regressions |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in |
|
@copilot review remove-labels, replace-labels for the same problem |
|
@copilot review update-issue |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in |
There was a problem hiding this comment.
🟡 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
| itemNumber = Number(target); | ||
| } | ||
|
|
||
| if (!itemNumber || Number.isNaN(Number(itemNumber))) { |
There was a problem hiding this comment.
Addressed in a04e12b: fixed targets now must resolve to a positive integer, with regressions for -1, 1.5, and Infinity.
| itemNumber = Number(target); | ||
| } | ||
|
|
||
| if (!itemNumber || Number.isNaN(Number(itemNumber))) { |
There was a problem hiding this comment.
Addressed in a04e12b: fixed targets now must resolve to a positive integer, with regressions for -1, 1.5, and Infinity.
| itemNumber = Number(target); | ||
| } | ||
|
|
||
| if (!itemNumber || Number.isNaN(Number(itemNumber))) { |
There was a problem hiding this comment.
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. | |
There was a problem hiding this comment.
Addressed in 471e84e: the target configuration table now states that wildcard targets fall back to the triggering item when item_number is absent.
|
@copilot run pr-finisher skill |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Ran the PR finisher pass. Addressed review feedback in |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in |
|
@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>
Resolved in merge commit |
|
🎉 This pull request is included in a new release. Release: |
The
add_labelshandler trusted model-provided item numbers over the configured target, allowing labels to be applied outside the triggering issue or pull request.Changes
Runtime enforcement
triggering.triggeringand fixed numeric targets.target: "*".Regression coverage