Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

# Publishes @phantom/react-native-fast-image to public npm. The @phantom scope is
# public on npmjs.org (the wallet's Artifactory registry proxies it), so this mirrors
# the publish setup used by phantom/react-native-webview, just triggered by a release
# rather than changesets since this fork is bumped infrequently.
#
# To cut a release: bump "version" in package.json on main, then publish a GitHub
# Release tagged v<version> (e.g. v8.6.6). This workflow publishes that version.

on:
release:
types: [published]
workflow_dispatch: {}

permissions:
contents: read

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
Comment on lines +24 to +26

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/release.yml | head -40

Repository: phantom/react-native-fast-image

Length of output: 1426


Harden action references and checkout credential handling.

Lines 24 and 26 use floating action tags (@v4), and line 24 keeps credentials persisted. In a release pipeline, pin actions to immutable commit SHAs and disable persisted checkout credentials to prevent supply chain attacks and limit GITHUB_TOKEN exposure.

Suggested patch
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@<FULL_LENGTH_COMMIT_SHA>
+        with:
+          persist-credentials: false

-      - uses: actions/setup-node@v4
+      - uses: actions/setup-node@<FULL_LENGTH_COMMIT_SHA>
         with:
           node-version: 20.x
           registry-url: "https://registry.npmjs.org"
           scope: "`@phantom`"
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 24-24: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 24-24: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 26-26: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 26-26: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 24 - 26, The workflow uses
floating action version tags (`@v4`) which are vulnerable to supply chain attacks,
and the checkout action persists credentials by default which unnecessarily
exposes the GITHUB_TOKEN. Replace the floating tags in both the
actions/checkout@v4 and actions/setup-node@v4 references with immutable commit
SHA versions (e.g., using the full commit hash instead of `@v4`), and add a
persist-credentials: false parameter to the checkout action to disable
credential persistence in the release pipeline.

Source: Linters/SAST tools

with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"
scope: "@phantom"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN_PHANTOM_SECURITY_BOT }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@phantom/react-native-fast-image",
"version": "8.6.5",
"version": "8.6.6",
"description": "🚩 FastImage, performant React Native image component.",
"keywords": [
"cache",
Expand Down
Loading