Harden Storybook PR preview workflow and patch vulnerable artifact download action - #22
Draft
fabio-silva with Copilot wants to merge 4 commits into
Draft
Harden Storybook PR preview workflow and patch vulnerable artifact download action#22fabio-silva with Copilot wants to merge 4 commits into
fabio-silva with Copilot wants to merge 4 commits into
Conversation
Agent-Logs-Url: https://github.com/percona/percona-ui/sessions/acdbb664-ae32-4e50-b38b-724a92985a0b Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Agent-Logs-Url: https://github.com/percona/percona-ui/sessions/acdbb664-ae32-4e50-b38b-724a92985a0b Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Agent-Logs-Url: https://github.com/percona/percona-ui/sessions/acdbb664-ae32-4e50-b38b-724a92985a0b Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix code based on review comment
Harden Storybook PR preview workflow and patch vulnerable artifact download action
May 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Storybook PR preview pipeline by splitting untrusted PR build execution from privileged deploy/cleanup operations, and updates the deploy path to use a patched actions/download-artifact version.
Changes:
- Added a
pull_requestworkflow to build Storybook and uploadstorybook-staticas an artifact with read-only token scope. - Added a trusted deploy/cleanup workflow triggered by
workflow_run(deploy) andpull_request_target(close cleanup) with scoped write permissions. - Patched the deploy workflow to use
actions/download-artifact@v4.1.3.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| .github/workflows/storybook-preview.yml | New PR build workflow that uploads the Storybook static output as an artifact. |
| .github/workflows/storybook-preview-deploy.yml | New trusted deploy/cleanup workflow that downloads artifacts from the build run and publishes/removes PR previews. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+22
| - name: Checkout PR head | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false |
Comment on lines
+30
to
+34
| - name: Upload Storybook artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: storybook-static | ||
| path: storybook-static |
Comment on lines
+18
to
+20
| permissions: | ||
| contents: write | ||
| pull-requests: write |
Comment on lines
+10
to
+12
| concurrency: | ||
| group: pr-preview-${{ github.event.pull_request.number || github.event.workflow_run.id }} | ||
| cancel-in-progress: true |
Comment on lines
+41
to
+47
| - name: Deploy PR preview | ||
| if: steps.pr.outputs.skip != 'true' | ||
| uses: rossjrw/pr-preview-action@v1 | ||
| with: | ||
| action: deploy | ||
| source-dir: ./storybook-static | ||
| pr-number: ${{ steps.pr.outputs.number }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the workflow security review feedback by separating untrusted PR build execution from privileged deployment, and patches the vulnerable
actions/download-artifactversion used in the deploy path.Workflow trust boundary split
pull_requestwith read-only token scope.workflow_run(deploy) andpull_request_target(close cleanup).Permission minimization
contents: write/pull-requests: writeonly where required.Safe artifact-based deploy flow
storybook-staticas an artifact.workflow_runevents with no associated PR payload.Vulnerability remediation
actions/download-artifactfrom@v4to@v4.1.3in deploy workflow to avoid the arbitrary file write vulnerability affecting<4.1.3.