Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

Harden skill version check workflow against code injection (#738)

Priyanshu Agrawalc252be520483
diff --git a/.github/workflows/ensure-skill-version-check.yml b/.github/workflows/ensure-skill-version-check.yml
index da1f28341..d41123fd4 100644
--- a/.github/workflows/ensure-skill-version-check.yml
+++ b/.github/workflows/ensure-skill-version-check.yml
@@ -8,51 +8,23 @@ on:
- "plugins/power-pages/skills/**"
permissions:
- contents: write
+ contents: read
jobs:
validate-skill-version-check:
name: validate-skill-version-check
runs-on: ubuntu-latest
steps:
- - name: generate app token
- if: ${{ github.event.pull_request.head.repo.fork == false }}
- id: app-token
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
- with:
- app-id: 3189942
- private-key: ${{ secrets.POWER_PLATFORM_SKILLS_APP_PRIVATE_KEY }}
-
- - name: checkout (non-fork)
- if: ${{ github.event.pull_request.head.repo.fork == false }}
+ - name: checkout pull request
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
- ref: ${{ github.head_ref }}
- token: ${{ steps.app-token.outputs.token }}
-
- - name: checkout (fork)
- if: ${{ github.event.pull_request.head.repo.fork == true }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ ref: ${{ github.event.pull_request.head.sha }}
+ persist-credentials: false
- name: setup-node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 20
- - name: check-only (fork)
- if: ${{ github.event.pull_request.head.repo.fork == true }}
+ - name: check version checks
run: node scripts/ensure-skill-version-check.js --check
-
- - name: add missing version checks (non-fork)
- if: ${{ github.event.pull_request.head.repo.fork == false }}
- run: node scripts/ensure-skill-version-check.js
-
- - name: commit and push if changed (non-fork)
- if: ${{ github.event.pull_request.head.repo.fork == false }}
- run: |
- git diff --quiet && exit 0
- git config user.name "github-actions[bot]"
- git config user.email "github-actions[bot]@users.noreply.github.com"
- git add "plugins/power-pages/skills/*/SKILL.md"
- git commit -m "Auto-add plugin version check to SKILL.md files"
- git push