Skip to content

Fix TYPE-008 conformance checker permission expectations - #49324

Merged
pelikhan merged 4 commits into
mainfrom
copilot/type-008-fix-stale-permission-names
Jul 31, 2026
Merged

Fix TYPE-008 conformance checker permission expectations#49324
pelikhan merged 4 commits into
mainfrom
copilot/type-008-fix-stale-permission-names

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The TYPE-008 conformance check was flagging create_check_run as missing required permissions because it searched for stale helper names that included contents: read. The handler already uses the least-privilege profile required by the spec: checks: write, plus pull-requests: read only when target is set.

  • Conformance checker

    • Updated TYPE-008 to look for the active permission builders:
      NewPermissionsChecksWrite
      NewPermissionsChecksWritePRRead
  • Permission factory cleanup

    • Removed unused contents: read + checks: write factory helpers that no production code referenced.
  • Generated reference docs

    • Removed stale README entries for the deleted helpers.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 16.7 AIC · ⊞ 8.1K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix conformance checker references to permission function names Fix TYPE-008 conformance checker permission expectations Jul 31, 2026
Copilot AI requested a review from pelikhan July 31, 2026 12:00
@pelikhan
pelikhan marked this pull request as ready for review July 31, 2026 12:18
Copilot AI review requested due to automatic review settings July 31, 2026 12:18

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.

Pull request overview

Fixes TYPE-008 to recognize the least-privilege permission builders used by create_check_run.

Changes:

  • Updates TYPE-008 permission checks.
  • Removes unused permission factories.
  • Removes their generated documentation entries.
Show a summary per file
File Description
scripts/check-safe-outputs-conformance.sh Updates expected permission builders.
pkg/workflow/permissions_factory.go Removes obsolete factories.
pkg/workflow/README.md Removes stale factory references.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

# adds pull-requests:read when target is configured.
if [ -f "$handler_registry" ]; then
if ! grep -q "NewPermissionsContentsReadChecksWrite" "$handler_registry"; then
if ! grep -q "NewPermissionsChecksWrite" "$handler_registry"; then

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.

Fixed in commit f2e80d3. The grep pattern now uses NewPermissionsChecksWrite() (with parentheses), which cannot match NewPermissionsChecksWritePRRead(), so the two profile checks are now independently verified.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #49324 does not have the implementation label and has 0 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

No test files were added or modified in this PR. This is a production code fix (permissions_factory.go) and documentation update. Test Quality Sentinel analysis not applicable.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

@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.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Review: Fix TYPE-008 conformance checker permission expectations

The changes are correct — the two deleted factory helpers (NewPermissionsContentsReadChecksWrite / NewPermissionsContentsReadChecksWritePRRead) were unused, the handler already uses the leaner NewPermissionsChecksWrite / NewPermissionsChecksWritePRRead profiles, and the conformance script and README are updated accordingly.

One pre-existing comment (line 1625) already flags that grep -q "NewPermissionsChecksWrite" is a substring match that would also match NewPermissionsChecksWritePRRead, so the base-profile assertion could pass even if the no-target branch were removed. That concern is worth addressing but is not a blocker for this fix. No new issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 14.6 AIC · ⊞ 5.3K

@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.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Skills-Based Review 🧠

Applied /diagnosing-bugs — requesting changes on one correctness issue.

📋 Key Themes & Highlights

Key Issue

  • Substring-match ambiguity (line 1625): grep -q "NewPermissionsChecksWrite" matches both NewPermissionsChecksWrite (base profile) and NewPermissionsChecksWritePRRead (extended profile), so the base-profile check can silently pass even when the no-target branch no longer calls the correct helper.

Positive Highlights

  • ✅ Dead-code removal is clean and well-scoped — the two ContentsRead* helpers were truly unused.
  • ✅ README regeneration is consistent with the code change.
  • ✅ PR description is clear and maps directly to the spec section.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 13.9 AIC · ⊞ 7K
Comment /matt 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.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Verdict: Approve — no new blocking issues

Small, correct cleanup: conformance script now greps for the actual active permission builders (NewPermissionsChecksWrite, NewPermissionsChecksWritePRRead), and the deleted factory functions/doc entries were confirmed unused (no callers anywhere in the repo).

Review notes
  • Verified NewPermissionsContentsReadChecksWrite/...PRRead have zero remaining references after removal.
  • Verified safe_output_handlers.go create-check-run branch already calls the two functions the script now checks for.
  • A pre-existing review comment already flags the substring-match weakness in the new grep check (NewPermissionsChecksWrite is a substring of NewPermissionsChecksWritePRRead), so I am not duplicating that finding.
  • No new correctness, security, or maintainability issues found in this diff by either my independent pass or the sub-agent first-pass.

🔎 Code quality review by PR Code Quality Reviewer · auto · 34.1 AIC · ⊞ 7.8K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: chore (conformance checker fix)
Risk: low
Priority: 42/100 (impact 15, urgency 12, quality 15)
Recommended action: defer

Rationale: Small, targeted 3-file diff to align a conformance checker regex with active permission-builder names. CI is green across all checks, but PR is currently blocked (mergeable_state) with an outstanding CHANGES_REQUESTED review plus 3 more human comments to address before it can proceed. Needs the author/agent to respond to review feedback before it's mergeable.

Labels applied: pr-type:chore, pr-risk:low, pr-priority:medium, pr-action:defer, pr-agent:copilot.

Generated by 🔧 PR Triage Agent · auto · 38.1 AIC · ⌖ 7.66 AIC · ⊞ 7.9K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

@copilot please run the pr-finisher skill on this PR.

Please address any remaining review feedback, resolve any now-addressed review threads if possible, and rerun the relevant checks once ready.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 16.7 AIC · ⊞ 8.1K ·
Comment /souschef to run again

…rens

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

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Fixed in the latest commit. The grep pattern now uses NewPermissionsChecksWrite() (with parentheses) so it only matches the checks-only builder and can't be satisfied by NewPermissionsChecksWritePRRead(). The two profile checks are now independently verified.

Copilot AI requested a review from gh-aw-bot July 31, 2026 13:26
@pelikhan
pelikhan merged commit b51f1e6 into main Jul 31, 2026
30 checks passed
@pelikhan
pelikhan deleted the copilot/type-008-fix-stale-permission-names branch July 31, 2026 13:27
@github-actions

Copy link
Copy Markdown
Contributor

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Hey 👋 — thanks for this conformance checker fix! The PR correctly addresses the root cause of issue #49287 by updating TYPE-008 to grep for the right permission function names and cleaning up the unused dead-code functions. Here are a couple of things that would strengthen this:

  • Add a test case — The conformance checker fix updates critical logic in scripts/check-safe-outputs-conformance.sh. Consider adding a test case or documented verification that:

    • NewPermissionsChecksWrite() and NewPermissionsChecksWritePRRead() are correctly detected by the updated TYPE-008 check
    • The check passes (no false CRITICAL/HIGH) after this PR is merged
    • This could be a shell script test or a documented manual verification step in the PR body.
  • Confirm no orphaned references — The removed functions (NewPermissionsContentsReadChecksWrite and NewPermissionsContentsReadChecksWritePRRead) are already validated as dead code by issue [Safe Outputs Conformance] TYPE-008: Conformance checker references stale permission function names (false CRITICAL/HIGH) #49287, but a quick grep -rn confirmation in the PR description would be reassuring.

If you would like to add a simple validation, here is a prompt you can assign to your coding agent:

Add a test to verify that the TYPE-008 conformance checker in scripts/check-safe-outputs-conformance.sh correctly identifies NewPermissionsChecksWrite() and NewPermissionsChecksWritePRRead() when checking create_check_run handler registration.

The test should:
1. Mock or stub the safe_output_handlers.go registry to include both function names
2. Run the check_create_check_run_handler() function
3. Assert it reports [PASS] with no CRITICAL/HIGH findings

Generated by ✅ Contribution Check · auto · 56.6 AIC · ⊞ 8.7K ·

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.1

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.

[Safe Outputs Conformance] TYPE-008: Conformance checker references stale permission function names (false CRITICAL/HIGH)

4 participants