T08 · Insecure Dependencies
- Location
src/index.js:122- Finding
Unpinned Third-Party Package Execution in Generated CI Workflow
- Content
View full analysis
Vulnerability Details
File Location:
src/index.js, lines 122-138
Vulnerability Type: Supply-chain risk caused by unpinned package execution
Risk Level: MediumThe generated GitHub Actions workflow contains the following code:
javascript function buildCiWorkflow() { return `name: security-scan on: pull_request: push: branches: [ main ] jobs: clawshield: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - run: npx clawshield scan . --format table --fail-on caution `; }Technical Analysis
The generated workflow invokes
clawshieldthroughnpxwithout declaring and locking an exact package version. If the package is not already available locally,npxcan resolve and download it from the configured npm registry when the CI job runs.Consequently, the code executed by the generated workflow is not fully determined by the audited project. A future package release, registry compromise, package-maintainer compromise, or package ownership change could alter the executable content after the generated workflow has been reviewed and committed.
The workflow also references GitHub Actions by mutable major-version tags (
actions/checkout@v4andactions/setup-node@v4) rather than immutable commit hashes. This is a secondary supply-chain hardening concern, although the primary vulnerability is the unpinnednpx clawshieldexecution.Attack Path
- A user runs the generator with
--cior selects thestrict-securitytemplate, which automatically enables the CI workflow. - The generated
.github/workflows/security-scan.ymlis committed to a GitHub repository. - A pull request or push to
mainstarts the workflow. - The runner executes
npx clawshield scan .without an exact, lockfile-controlled package version. npxre ...[truncated 1396 chars]
- A user runs the generator with
- Remediation
View remediation
Remediation Suggestions
-
Declare
clawshieldin the generated project'sdevDependenciesusing an exact reviewed version rather than invoking an undeclared package:json { "devDependencies": { "clawshield": "X.Y.Z" } } -
Generate and commit a package lockfile so
npm ciinstalls the reviewed dependency graph with integrity metadata. -
Invoke the lockfile-installed binary without allowing runtime installation:
yaml - run: npm ci --ignore-scripts - run: npm exec --offline -- clawshield scan . --format table --fail-on cautionBefore adding
--ignore-scripts, verify that the pinned scanner and its required dependencies do not legitimately depend on installation scripts. -
If runtime installation remains necessary, specify an exact version and enforce registry and integrity controls. This is less robust than committing a reviewed lockfile.
-
Pin
actions/checkoutandactions/setup-nodeto reviewed immutable commit SHAs, optionally retaining comments that identify their corresponding release versions. -
Add an explicit least-privilege
permissionsblock to the generated workflow, such as read-only repository access where sufficient:yaml permissions: contents: read -
Review dependency updates through a controlled update process with lockfile diffs, provenance checks, and automated dependency scanning.
-
