Skip to content

Pin infra reusable workflows to immutable SHA and add pull_request_target fork guards#5953

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-workflow-references-and-add-fork-guards
Draft

Pin infra reusable workflows to immutable SHA and add pull_request_target fork guards#5953
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-workflow-references-and-add-fork-guards

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📌 Fixes

Issue linking is handled automatically by the system.


📝 Summary of Changes

This PR replaces mutable kubestellar/infra reusable workflow refs with an immutable commit SHA and hardens pull_request_target execution paths against fork-originated PRs.
Scope is limited to workflow security and reference integrity in .github/workflows.

  • Workflow pinning
    • Pinned all specified reusable workflow uses: references from @main to:
      • @a160acca0bdce1ac6c649e006d680d5f6d53024e # main
  • Fork execution guards
    • Added a strict same-repo guard to copilot-automation job.
    • Added an event-aware guard to ai-fix job so pull_request_target only runs for same-repo PRs.
  • Permission hardening
    • Added explicit permissions in copilot-dco.yml to satisfy workflow security policy (contents: read, pull-requests: write).
jobs:
  ai-fix:
    if: github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository
    uses: kubestellar/infra/.github/workflows/reusable-ai-fix.yml@a160acca0bdce1ac6c649e006d680d5f6d53024e  # main

Changes Made

  • Updated all targeted kubestellar/infra reusable workflow refs to immutable SHA pins.
  • Refactored workflow job guards for secure pull_request_target handling in copilot-automation.yml and ai-fix.yml.
  • Fixed missing explicit permissions in copilot-dco.yml to align with workflow security scanning.
  • Added tests for workflow behavior (not applicable for reusable workflow reference/guard-only changes).

Checklist

Please ensure the following before submitting your PR:

  • I have reviewed the project's contribution guidelines.
  • I have performed a self-review of my changes.
  • I have written unit tests for the changes (if applicable).
  • I have updated the documentation (if applicable).
  • I have tested the changes locally and ensured they work as expected.
  • All CI checks are passing.

Security Considerations

If this PR modifies any security-sensitive files, confirm:

  • Dockerfiles — verified base images, avoided running as root
  • Kubernetes manifests — checked RBAC permissions and secrets handling
  • CI/CD workflows — inspected for command injection or credential exposure
  • Dependencies — validated new packages, checked for known vulnerabilities
  • Security configs — changes align with project security policies

Leave unchecked if not applicable. See CONTRIBUTING.md for details.


Screenshots or Logs (if applicable)

N/A (workflow YAML-only changes).


👀 Reviewer Notes

  • This PR intentionally updates only the workflows listed in the issue scope.
  • SHA annotations keep # main for traceability while enforcing immutable refs.
Original prompt

Pin all kubestellar/infra reusable workflow references from mutable @main to immutable commit SHA a160acca0bdce1ac6c649e006d680d5f6d53024e, and add fork guards to workflows using pull_request_target.

Fixes #5940 - Pin kubestellar/infra workflows to SHA
Fixes #5941 - Add fork guard to copilot-automation.yml
Fixes #5949 - Add fork guard to ai-fix.yml

Required Changes:

1. Pin all workflow files to SHA a160acca0bdce1ac6c649e006d680d5f6d53024e:

Replace @main with @a160acca0bdce1ac6c649e006d680d5f6d53024e # main in these files:

  • .github/workflows/stale.yml (line with kubestellar/infra/.github/workflows/reusable-stale.yml@main)
  • .github/workflows/feedback.yml (line with kubestellar/infra/.github/workflows/reusable-feedback.yml@main)
  • .github/workflows/label-helper.yml (line with kubestellar/infra/.github/workflows/reusable-label-helper.yml@main)
  • .github/workflows/add-help-wanted.yml (line with kubestellar/infra/.github/workflows/reusable-add-help-wanted.yml@main)
  • .github/workflows/greetings.yml (line with kubestellar/infra/.github/workflows/reusable-greetings.yml@main)
  • .github/workflows/copilot-dco.yml (line with kubestellar/infra/.github/workflows/reusable-copilot-dco.yml@main)
  • .github/workflows/scorecard.yml (line with kubestellar/infra/.github/workflows/reusable-scorecard.yml@main)
  • .github/workflows/assignment-helper.yml (line with kubestellar/infra/.github/workflows/reusable-assignment-helper.yml@main)
  • .github/workflows/pr-verifier.yml (line with kubestellar/infra/.github/workflows/reusable-pr-verifier.yml@main)
  • .github/workflows/copilot-automation.yml (line with kubestellar/infra/.github/workflows/reusable-copilot-automation.yml@main)
  • .github/workflows/ai-fix.yml (line with kubestellar/infra/.github/workflows/reusable-ai-fix.yml@main)

2. Add fork guard to copilot-automation.yml:

In the copilot-automation job, add this line immediately after copilot-automation::

    if: github.event.pull_request.head.repo.full_name == github.repository

3. Add fork guard to ai-fix.yml:

In the ai-fix job, add this line immediately after ai-fix::

    if: github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository

Example of expected result for copilot-automation.yml:

jobs:
  copilot-automation:
    if: github.event.pull_request.head.repo.full_name == github.repository
    uses: kubestellar/infra/.github/workflows/reusable-copilot-automation.yml@a160acca0bdce1ac6c649e006d680d5f6d53024e  # main

Example of expected result for ai-fix.yml:

jobs:
  ai-fix:
    if: github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository
    uses: kubestellar/infra/.github/workflows/reusable-ai-fix.yml@a160acca0bdce1ac6c649e006d680d5f6d53024e  # main

Create all changes on branch scanner/fix-5940.

@kubestellar-prow kubestellar-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: no Indicates the PR's author has not signed the DCO. labels Jun 18, 2026
@netlify

netlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellar-docs failed. Why did it fail? →

Name Link
🔨 Latest commit ba77042
🔍 Latest deploy log https://app.netlify.com/projects/kubestellar-docs/deploys/6a33a506ec78c20008147e27

@kubestellar-prow

Copy link
Copy Markdown

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.

📝 Please follow instructions in the contributing guide to update your commits with the DCO

Full details of the Developer Certificate of Origin can be found at developercertificate.org.

The list of commits missing DCO signoff:

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 18, 2026
@kubestellar-prow

Copy link
Copy Markdown

Hi @Copilot. Thanks for your PR.

I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copilot AI changed the title [WIP] Pin all kubestellar/infra workflows to SHA and add fork guards Pin infra reusable workflows to immutable SHA and add pull_request_target fork guards Jun 18, 2026
Copilot AI requested a review from clubanderson June 18, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: no Indicates the PR's author has not signed the DCO. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

2 participants