ci(workflows): add explicit roles restriction to screenshot preview workflow#160
ci(workflows): add explicit roles restriction to screenshot preview workflow#160
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the screenshot preview workflow’s access control self-documenting by explicitly declaring the allowed triggering roles in the source frontmatter, and regenerates the compiled lock workflow accordingly.
Changes:
- Add explicit
roles: [admin, maintainer, write]to the workflow source frontmatter. - Regenerate the compiled
.lock.ymlwith a newergh aw compileversion (including quoting/version pinning/mechanical updates). - Update the agentic-workflows actions lock JSON by removing the old setup action entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
.github/workflows/preview-screenshot-gallery.md |
Adds explicit role restriction in frontmatter to make access policy auditable from source. |
.github/workflows/preview-screenshot-gallery.lock.yml |
Regenerated compiled workflow reflecting the role gating and updated compiler output. |
.github/aw/actions-lock.json |
Removes the previous github/gh-aw-actions/setup@v0.67.1 lock entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
github/gh-aw-actions/setup is now referenced by a mutable tag (@v0.67.4) instead of a commit SHA. Since this workflow otherwise pins third-party actions to SHAs, this weakens supply-chain integrity and makes audits harder. Pin this action to an immutable commit SHA (and keep the version comment if desired).
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Done in 58b1cc8. All 7 uses: github/gh-aw-actions/setup@v0.67.4 references in the lock file are now pinned to the immutable commit SHA 2b3c275b3652caa01c2ebe31cbab50ec2df0f927 (with the tag retained as a comment). The manifest header and actions-lock.json are also updated to record the correct commit SHA.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
github/gh-aw-actions/setup is referenced by tag (@v0.67.4) here rather than a commit SHA, which reduces action immutability compared to the other SHA-pinned actions in this lock file. Prefer pinning to the commit SHA for the setup action as well.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
github/gh-aw-actions/setup is referenced by tag (@v0.67.4) rather than a commit SHA. For consistency with the rest of the lock file and stronger supply-chain guarantees, pin to an immutable commit SHA.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Already addressed in 58b1cc8 — line 861 and all other uses: references are pinned to 2b3c275b3652caa01c2ebe31cbab50ec2df0f927 # v0.67.4.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
This uses: github/gh-aw-actions/setup@v0.67.4 reference is tag-based, unlike the SHA-pinned action references elsewhere in this lock file. Pinning to a commit SHA would prevent unexpected changes if the tag is ever moved.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Already addressed in 58b1cc8 — line 966 and all other uses: references are pinned to 2b3c275b3652caa01c2ebe31cbab50ec2df0f927 # v0.67.4.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
github/gh-aw-actions/setup is invoked via tag (@v0.67.4) instead of a commit SHA. If the intent of the generated lock file is to provide immutable action references, this should be pinned to the commit SHA.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Already addressed in 58b1cc8 — line 1111 and all other uses: references are pinned to 2b3c275b3652caa01c2ebe31cbab50ec2df0f927 # v0.67.4.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
This setup step uses github/gh-aw-actions/setup@v0.67.4 (tag) rather than a commit SHA. Consider pinning to the action’s commit SHA to preserve the immutability guarantees typically expected from a lock file.
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@addd8a8bc8bad66050cec907c7bf182cca4d2e69 # v0.67.1 | ||
| uses: github/gh-aw-actions/setup@v0.67.4 | ||
| with: |
There was a problem hiding this comment.
github/gh-aw-actions/setup is referenced via tag here. To avoid supply-chain drift and align with the SHA-pinned style used for other actions in this file, pin this to a specific commit SHA.
| set -eo pipefail | ||
| mkdir -p /tmp/gh-aw/mcp-config | ||
| mkdir -p /tmp/gh-aw/mcp-logs/playwright | ||
| chmod 777 /tmp/gh-aw/mcp-logs/playwright |
There was a problem hiding this comment.
chmod 777 makes /tmp/gh-aw/mcp-logs/playwright world-writable. Even on ephemeral runners, it’s safer to grant only the minimum permissions needed (e.g., use a more restrictive mode, or chmod 1777 if multiple UIDs must write while preventing deletion of others’ files).
| chmod 777 /tmp/gh-aw/mcp-logs/playwright | |
| chmod 1777 /tmp/gh-aw/mcp-logs/playwright |
| "actions/github-script@v8": { | ||
| "repo": "actions/github-script", | ||
| "version": "v8", | ||
| "sha": "ed597411d8f924073f98dfc5c65a23a2325f34cd" |
There was a problem hiding this comment.
Removing the github/gh-aw-actions/setup entry from actions-lock.json means there is no longer a SHA recorded for that action in the repo’s lock data. If preview-screenshot-gallery.lock.yml is intended to be fully immutable, consider locking github/gh-aw-actions/setup@v0.67.4 to its commit SHA here (or ensure it’s pinned elsewhere).
| "sha": "ed597411d8f924073f98dfc5c65a23a2325f34cd" | |
| "sha": "ed597411d8f924073f98dfc5c65a23a2325f34cd" | |
| }, | |
| "github/gh-aw-actions/setup@v0.67.4": { | |
| "repo": "github/gh-aw-actions/setup", | |
| "version": "v0.67.4", | |
| "sha": "<REPLACE_WITH_THE_40_CHARACTER_COMMIT_SHA_FOR_v0.67.4>" |
There was a problem hiding this comment.
@copilot implement this review feedback
There was a problem hiding this comment.
Already addressed in 58b1cc8 — actions-lock.json now has a github/gh-aw-actions/setup@v0.67.4 entry with SHA 2b3c275b3652caa01c2ebe31cbab50ec2df0f927.
|
Preview Links
|
|
@copilot rebase on main to pick up the dependency updates |
|
@copilot rebase on main to minimize the changes |
The previous rebase attempts left duplicate main commits in the branch history, making the merge base To clean it up: git fetch origin main
git checkout emurphy/restrict-screenshot-preview-workflow-to-write-access-only
git reset --hard origin/main
git cherry-pick cc4e246 # "add explicit roles restriction"
git cherry-pick 58b1cc8 # "pin gh-aw-actions/setup to commit SHA"
git push --force-with-lease origin emurphy/restrict-screenshot-preview-workflow-to-write-access-onlyAfter that the PR will show only 3 files changed. |
6125f0d to
4545a2e
Compare








Artifacts | Task
What problems was I solving
The screenshot preview workflow's access control was implicit — it relied on
gh aw compiledefaults rather than explicit configuration. This made it harder to audit security settings by reading the source file alone.What user-facing changes did I ship
How I implemented it
Workflow Source Changes
Added
roles: [admin, maintainer, write]to the frontmatter at.github/workflows/preview-screenshot-gallery.mdline 7, making the access control policy self-documenting:Lock File Regeneration
Ran
gh aw compileto regenerate.github/workflows/preview-screenshot-gallery.lock.yml. The compiler version bumped from v0.67.1 to v0.67.4, which introduced several mechanical improvements:${RUNNER_TEMP}references now properly quoted)latest→1.0.20for Copilot CLI)actions: readpermission to activation jobSupporting Changes
.github/aw/actions-lock.json— Removed stale v0.67.1 setup action entry (now referenced inline).gitignore— Added.humanlayer/tasks/to ignore cloud-synced artifactsDeviations from the plan
Implemented as planned
roles: [admin, maintainer, write]added to frontmatter at exactly the specified locationgh aw compileGH_AW_REQUIRED_ROLESand fork blocking conditions preserved in compiled outputDeviations/surprises
actions: readpermission added to activation job by the newer compilergh-aw-manifestheader line added to lock file (new format feature)Additions not in plan
latest→ specific versions).gitignoreupdate for.humanlayer/tasks/Items planned but not implemented
None — all planned changes were implemented.
How to verify it
Verify roles are explicit in source
Verify compiled output enforces roles
Verify fork blocking preserved
Description for the changelog
Add explicit
roles: [admin, maintainer, write]to screenshot preview workflow frontmatter for self-documenting access control