Skip to content

Normalize blocked labels and cover run-step sanitization - #75793

Merged
pelikhan merged 7 commits into
mainfrom
copilot/aw-top10-09-normalize-labels
Nov 8, 2026
Merged

pelikhan merged 7 commits into
mainfrom
copilot/aw-top10-09-normalize-labels

Conversation

Copilot AI commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Blocked-label checks could miss case or Unicode variants, while run-step sanitization needed explicit coverage for expressions in comments and expanding heredocs.

  • Label policy: Normalize candidate labels and blocked patterns before blocklist matching in replace_label.
  • Run-step sanitizer: Add regression coverage for comment and expanding-heredoc expressions; clarify that quoted heredoc expressions remain for validation.
Blocked pattern: "blocked"
Incoming label:  "blocked"
Result:          rejected

Copilot AI changed the title [WIP] Normalize labels before security filtering Normalize blocked labels and cover run-step sanitization Nov 8, 2026
Copilot AI requested a review from gh-aw-bot November 8, 2026 02:12
@pelikhan
pelikhan marked this pull request as ready for review November 8, 2026 03:13
Copilot AI adaptive review requested due to automatic review settings November 8, 2026 03:13
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: gpt56 max · ~1 AIC · ⌖ ~2 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: gpt56 max · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #75793

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR Specification Reviewer failed to deliver outputs. Please review the logs for details.

Generated by PR Specification Reviewer for #75793

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-08T03:16:33Z
review_event: COMMENT
top_themes: [glob-pattern semantics under Unicode normalization]
files_reviewed: [actions/setup/js/replace_label.cjs, actions/setup/js/replace_label.test.cjs, pkg/workflow/run_step_sanitizer_test.go]
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

What this change does: It normalizes blocked-label matching and adds regression coverage for run-step expressions in comments and expanding heredocs. It also keeps quoted-heredoc expressions for the existing validator.

Should fix

  1. The new sanitizer case duplicates comment coverage (pkg/workflow/run_step_sanitizer_test.go:L237-260)

    • What this is: The table already has expression in bash comment extracted at L153-166, which covers the same comment expression and replacement.
    • Problem: The added case repeats that behavior while testing expanding-heredoc extraction, so four assertions are unrelated to the new regression and make the test less focused.
    • Fix: Remove the comment expression and its matching expected run, env key, and env value entries; leave the expanding-heredoc expression as the sole case here.
    • If we skip it: Comment handling has two overlapping tests, while a future failure in either test gives less focused feedback about what changed.

Verdict: fix 1 first.
Lean: -4 lines possible.

Generated by ✂️ Ponytail Reviewer for #75793 · codex · routed: gpt56 max · ~3 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again

Comment thread pkg/workflow/run_step_sanitizer_test.go Outdated
name: "expressions in comments and expanding heredocs are extracted",
step: map[string]any{
"run": strings.Join([]string{
`# docs: ${{ github.event.issue.title }}`,

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.

Lean: The comment expression is already covered by expression in bash comment extracted above; remove this duplicate line and its matching expectations so this new case tests only expanding-heredoc extraction.

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.

Removed the duplicate comment expression and its expectations in 8ecbdff.

@github-actions github-actions Bot 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.

Found one correctness concern: normalizing blocked glob patterns can convert compatibility/entity-encoded characters into active glob syntax and broaden existing policies. The inline comment describes the case and requested mitigation. No tests or builds were run (static review).

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

Comment thread actions/setup/js/replace_label.cjs Outdated
const normalizedLabelName = hardenUnicodeText(labelName);
if (blockedPatterns.length > 0) {
const isBlocked = blockedPatterns.some(pattern => matchesSimpleGlob(labelName, pattern));
const isBlocked = blockedPatterns.some(pattern => matchesSimpleGlob(normalizedLabelName, hardenUnicodeText(pattern)));

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.

hardenUnicodeText applies NFKC/entity decoding to the glob pattern itself, so compatibility characters that were previously literal can become glob syntax. For example, a configured blocked pattern containing a full-width * (or *) is converted to * and begins matching every label, broadening an existing policy unexpectedly. Please preserve glob metacharacter semantics while normalizing pattern text (or document/test this intentional behavior).

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.

Preserved original wildcard operators and escaped normalized literal fragments in 8ecbdff, with regression tests.

@github-actions github-actions Bot 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.

Reviewed PR head 3d5ebad4edb2e104d8d3d9a440366707dec0e49c against specs/replace-label-spec.md v1.0.3 (RL-001, RL-003, RL-007) and specs/compiler-threat-detection-spec.md v1.0.97 (CTR-006).

The run-step sanitizer test updates are aligned regression evidence for the existing CTR-006 contract; no compiler specification change is needed. The intentional blocklist normalization changes the observable RL-003 matching contract, so I synchronized specs/replace-label-spec.md to v1.0.4 (2026-11-08), clarifying normalization of candidate labels and blocked patterns before glob matching. Commit fbca885 is queued for publication to the PR branch.

No blocking conformance findings. This was a static review; tests were not run per review policy.

Generated by PR Specification Reviewer for #75793 · copilot · gpt50 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.7K
Comment /review-specs to run again

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /tdd and /codebase-design. The Go run-step change is sound and its test passes. The label normalization blocks the reported bypasses, with one fail-open risk to address.

📋 Key Themes & Highlights

Key Themes

  • Blocklist fail-open: a non-string blocked entry now silently matches nothing (see inline comment on replace_label.cjs).
  • Allowlist asymmetry: the blocklist uses normalized labels, while the allowlist still uses raw labels.
  • Test gaps: the case variation row was already passing before this change, and the pattern-side normalization and label_to_remove paths are not covered.

Positive Highlights

  • ✅ The Go change correctly scans comments and expanding heredocs while leaving quoted heredocs for the validator. The new test covers this and passes.
  • ✅ Normalization keeps glob metacharacters such as ~* and *[bot] intact, so existing patterns still match.
  • ✅ The heredoc comment is clearer about why quoted heredocs are not rewritten.

@copilot please address the review comments above.

Comments that could not be inline-anchored

actions/setup/js/replace_label.test.cjs:264

**[/tdd]** The `case variation` row already passed before this change, since `matchesSimpleGlob` is case-insensitive. It doesn't guard the fix. The code also normalizes the *pattern* side with `hardenUnicodeText(pattern)`, and no test covers that path or `label_to_remove`. <details> <summary>💡 Suggested tests</summary> ```js it("should reject a label matching a Unicode-variant blocked pattern", async () => { const handler = await main({ blocked: ["blocked"] }); const result = await handle...

actions/setup/js/replace_label.cjs:63

**[/tdd]** A non-string entry in `blocked` now fails open silently. `hardenUnicodeText` returns `""` for non-strings, and `matchesSimpleGlob` treats an empty pattern as no match, so that rule stops blocking. The old code threw a `TypeError` on `pattern.toLowerCase()` for the same value. <details> <summary>💡 Suggested fix</summary> Reject non-string entries explicitly rather than skipping them: ```js const isBlocked = blockedPatterns.some(pattern => { if (typeof pattern !== "string") throw ...

actions/setup/js/replace_label.cjs:69

**[/codebase-design]** The blocklist compares the normalized label, but the allowlist compares the raw label. The two checks disagree on what a label is. A full-width allowlist entry like `bug` can never match, and a raw `bug` label is rejected even though it normalizes to `bug`. Both results fail closed, so this is not a bypass, but it is surprising. <details> <summary>💡 Suggested fix</summary> Decide whether the asymmetry is intended. If it is, document why exact matching is required for th...

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 5.4K
Comment /matt to run again

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

Unicode normalization can turn existing blocklist matches into non-matches, allowing previously rejected non-Latin text through and weakening restrictions.

1 open issue
What changed in this PR

This PR addresses #74777 by updating label-policy enforcement in gh-aw’s safe-output handler and expanding run-step sanitizer regression coverage.

Changes:

  • Normalize candidate labels and blocked patterns in replace_label, with tests for case and Unicode variants.
  • Add sanitizer coverage for expressions in comments and expanding heredocs, and clarify the existing quoted-heredoc test wording.
File Description
pkg/​workflow/​run_step_sanitizer_test.go Covers comment and expanding-heredoc expressions; clarifies quoted-heredoc handling.
actions/​setup/​js/​replace_label.test.cjs Adds blocked-label case and Unicode regression tests.
actions/​setup/​js/​replace_label.cjs Normalizes labels and patterns before blocklist matching.

Review effort: Max (auto)

Comment thread actions/setup/js/replace_label.cjs Outdated
const normalizedLabelName = hardenUnicodeText(labelName);
if (blockedPatterns.length > 0) {
const isBlocked = blockedPatterns.some(pattern => matchesSimpleGlob(labelName, pattern));
const isBlocked = blockedPatterns.some(pattern => matchesSimpleGlob(normalizedLabelName, hardenUnicodeText(pattern)));

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.

Added original-pattern matching before the normalized comparison, with Greek case-pair and wildcard regression coverage in 8ecbdff.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/run_step_sanitizer_test.go:240): Lean: The comment expression is already covered by expression in bash comment extracted above; remove this duplicate line and its matching expectations so this new case tests only expanding-heredoc extraction. - Normalize blocked labels and cover run-step sanitization #75793 (comment)
  3. Review (actions/setup/js/replace_label.cjs:63): hardenUnicodeText applies NFKC/entity decoding to the glob pattern itself, so compatibility characters that were previously literal can become glob syntax. For example, a configured blocked pattern containing a full-width * (or *) is converted to * and begins matching every label, broadening an existing policy unexpectedly. Please preserve glob metacharacter semantics while normalizing pattern text (or document/test this intentional behavior). - Normalize blocked labels and cover run-step sanitization #75793 (comment)
  4. Fix failing check JS Tests (shard 8/8) (FAILURE): https://github.com/github/gh-aw/actions/runs/42437112507/job/128598303732.
  5. Fix failing check safe_outputs (FAILURE): https://github.com/github/gh-aw/actions/runs/42441807759/job/128613971161.

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: 3d5ebad
Sous-chef requested-work: 27ac911a80a91d6b02a3e07caef39b800cb632677606247471a58f9a93975854 626402ac1b73eaacf13da032dc4a84ca49235bd50dcd87f5041873a082dbe1d8 78c2e11a03c288225740a4263ac393c262fa68a907acd3f2f7691567f0713cf9 c7cf93e497befdd5e698d00101b0703e4101fe4133d86d433f7c170d07402b7e
Sous-chef requested-state: 749b30f034b4b16d7bccc324b6240dfde4d248c075d88a0ecdb47a8148432bdd

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~6 AIC · ⌖ ~13 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Remove duplicate comment-expression coverage from the expanding-heredoc test.
  3. Preserve glob metacharacter semantics when normalizing blocked-label patterns.
  4. Investigate and fix the failing JS Tests (shard 8/8) check.
  5. Investigate and fix the failing safe_outputs check.

Sous-chef requested-head: 3d5ebad
Sous-chef requested-work: 27ac911a80a91d6b02a3e07caef39b800cb632677606247471a58f9a93975854 626402ac1b73eaacf13da032dc4a84ca49235bd50dcd87f5041873a082dbe1d8 78c2e11a03c288225740a4263ac393c262fa68a907acd3f2f7691567f0713cf9 c7cf93e497befdd5e698d00101b0703e4101fe4133d86d433f7c170d07402b7e
Sous-chef requested-state: 749b30f034b4b16d7bccc324b6240dfde4d248c075d88a0ecdb47a8148432bdd

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Triage

  • Category: bug
  • Risk: low
  • Priority score: 42/100 (impact 20 + urgency 8 + quality 14)
  • Action: auto_merge
  • Reason: targeted validation fix with green CI and low attack surface; good candidate for quick merge.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~7 AIC · ⌖ ~2 AIC · ⊞ 16K · ◷

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check JS Tests (shard 3/8) (FAILURE): https://github.com/github/gh-aw/actions/runs/42446121173/job/128625358589.

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: 8ecbdff
Sous-chef requested-work: 4abda31131600b8ff4d73bd7f3bf534a014465b854fafd42d5113bf9f4d854ee
Sous-chef requested-state: d8c5296b4d69b169edf3d566a3b40d14eabeb01f8ca8c369974a831fe7aba6c7

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~7 AIC · ⌖ ~11 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

Investigating the requested branch updates, review feedback, and failing checks.

Sous-chef requested-head: 8ecbdff
Sous-chef requested-work: 4abda31131600b8ff4d73bd7f3bf534a014465b854fafd42d5113bf9f4d854ee
Sous-chef requested-state: d8c5296b4d69b169edf3d566a3b40d14eabeb01f8ca8c369974a831fe7aba6c7

@pelikhan

pelikhan commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

Investigating the requested branch sync and CI failure.

Sous-chef requested-head: 8ecbdff
Sous-chef requested-work: 4abda31131600b8ff4d73bd7f3bf534a014465b854fafd42d5113bf9f4d854ee
Sous-chef requested-state: d8c5296b4d69b169edf3d566a3b40d14eabeb01f8ca8c369974a831fe7aba6c7

Copilot AI requested a review from pelikhan November 8, 2026 16:46
@pelikhan

pelikhan commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

…ormalize-labels

# Conflicts:
#	actions/setup/js/replace_label.test.cjs

Co-authored-by: pelikhan <[email protected]>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/42503397095/job/128800862459.

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: c23e97d
Sous-chef requested-work: 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac
Sous-chef requested-state: 7ac325cf3c0a03d310e074a6c34fc405b17355b6b9d4123b9496ad839a630ff3

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~4 AIC · ⌖ ~11 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

I’m investigating the requested merge and failing check.

Sous-chef requested-head: c23e97d
Sous-chef requested-work: 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac
Sous-chef requested-state: 7ac325cf3c0a03d310e074a6c34fc405b17355b6

@pelikhan
pelikhan merged commit d66aae2 into main Nov 8, 2026
65 of 67 checks passed
@pelikhan
pelikhan deleted the copilot/aw-top10-09-normalize-labels branch November 8, 2026 17:36
Copilot stopped work on behalf of gh-aw-bot due to an error November 8, 2026 17:37
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

PR triage: category=bug | risk=low | total=42 | breakdown=impact 20, urgency 8, quality 14 | action=auto_merge | batch=pr-batch:quality-copilot

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~3 AIC · ⌖ ~2 AIC · ⊞ 15.1K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.2

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AW Top 10] 09 Normalize labels before security filtering

4 participants