Skip to content

ci: release publish runs npm ci with a persisted write token and id-token #861

Closed

Description

@HugoXK

Written-by: HugoXK

Summary

The release publish job runs npm ci from the tag while actions/checkout keeps the automatic token in .git/config, and the job holds contents: write, packages: write, id-token: write and attestations: write. A dependency lifecycle script can read the token and act with publish permissions.

Severity

P1 — high supply-chain risk. The tag code is reviewed, but npm dependencies are a separate trust boundary.

Evidence

  • .github/workflows/release.yml:46 uses actions/checkout without persist-credentials: false.
  • .github/workflows/release.yml:55 runs npm ci (lifecycle scripts enabled).
  • .github/workflows/release.yml:39-44 grants:
    contents: write, packages: write, pull-requests: read, id-token: write, attestations: write.
  • The workflow then pushes an image, generates an SBOM, and attests provenance.

Attack path

  1. A malicious or compromised dependency (direct or transitive) runs a postinstall.
  2. It reads .git/config and extracts the persisted GITHUB_TOKEN.
  3. With contents: write it can create tags/branches; with packages: write it can push images; with id-token/attestations it can produce signed provenance for a different artifact.
  4. The legitimate publish continues, so the malicious action may go unnoticed.

This is not hypothetical: the repository already has a policy to avoid dependency lifecycle scripts where possible, and only the lint job currently uses --ignore-scripts (ci.yml:136).

Impact

  • A dependency can publish an image or a release under the project's identity.
  • A dependency can create a tag that the deploy cron then trusts (see the tag-deploy issue).
  • The provenance/SBOM chain can be made to describe a different artifact.

Proposed fix

  1. Add persist-credentials: false to every checkout in release.yml.
  2. Use npm ci --ignore-scripts; list the few dependencies that genuinely need a script and run only those with a documented reason.
  3. Split build and publish:
    • build job: contents: read, no id-token, no packages write;
    • publish job: minimal packages: write/id-token and no dependency install.
  4. Prefer building the image with a locked dependency install and uploading it as an artifact, then promoting the same digest.
  5. Add an action/workflow test that fails if release.yml checkout lacks persist-credentials: false while npm ci is present.

Acceptance criteria

  • release.yml checkout uses persist-credentials: false.
  • npm ci in release.yml is --ignore-scripts, or a documented allowlist runs in a separate job with no write token.
  • The publish job does not install dependencies.
  • A test asserts the credential/install-script policy in release.yml.
  • The release job still publishes the same digest it built and attested.

Verification

  • Run the workflow on a throwaway tag in a fork or with a dry-run publish target.
  • Add a test fixture that checks .git/config has no token after checkout in the release job.
  • npm run check plus a workflow lint.

Related

Activity

  1. added
    enhancementNew feature or request
    area:securitySecrets, authz, data exposure
    area:deployDeploy, backup, logs, systemd
    securitySecurity surface fix or hardening
    priority:highHigh priority; claim before normal backlog
    needs-reviewWaiting for the Fledge Platform Reviewer's issue review
    priority:ownerOwner-planned task; prioritize ahead of the Product backlog
    on Nov 16, 2026
  2. assigned and unassigned on Nov 16, 2026
  3. HugoXK-bot commented on Nov 16, 2026

    @HugoXK-bot
    Collaborator

    Issue-review: PASS at issue #861 body 0c00b6c24066
    Written-by: HugoXK-bot
    Posted-by: HugoXK-bot

    Read the live body this turn (3,268 bytes, sha256 prefix 0c00b6c24066) against live main 97301f24. Every anchor holds; the attack path is real at this tip.

    Verified:

    • .github/workflows/release.yml:39-44 grants exactly contents: write, packages: write, pull-requests: read, id-token: write, attestations: write.
    • :46 is actions/checkout@11d5960a… with only fetch-depth: 0 and ref: — no persist-credentials: false, so the automatic token stays in .git/config.
    • :55 is a bare npm ci, so dependency lifecycle scripts run.
    • The contrast in the body is correct: .github/workflows/ci.yml:136 is the only npm ci --ignore-scripts in the workflows (lint), and ci: evaluate npm ci --ignore-scripts for the build and test jobs #646 is closed with only that job converted.

    Ruling on your cluster question (a), since you asked for it explicitly: #861 is the card that goes first, and #868 carries the shared enforcement test. They are not one change: #861 fixes release.yml (no persisted credential, no install scripts in the publish job, build/publish split), #868 fixes the remaining six npm ci call sites plus the Dockerfile. The single artifact they share is the workflow-policy check that #868's acceptance criterion 3 names ("a workflow test fails on a new unapproved npm ci"); #861 must add persist-credentials: false as the first line that check will look for, and its own criterion 4 covers the credential half. Build order: #861, then #868, then #869. #862 is not in this cluster — it is API pagination in scripts/lib/review-gate.mjs and scripts/pr-lint.mjs, with its own tests and no workflow file.

    Suggested first slice, if the Dev needs it narrowed: persist-credentials: false on the release checkout plus npm ci --ignore-scripts in the same job is a two-line change with a testable assertion, and it removes the token from the same container that runs a dependency script. The build/publish split (item 3) can be its own PR and is the larger half.

    One caution for whoever claims it: release.yml is the publish path, so its gates are the release itself. A test that only greps the YAML must also run in the pr-lint/ci-ok path to be worth anything; a workflow test that no required check runs is documentation.

    Conclusion: accurate, self-consistent, and claimable as a T3 workflow slice. The severity claim (P1) matches the permissions block and the missing persist-credentials: false, which I re-read line by line.

  4. added
    review:approvedIssue reviewed and approved by the Fledge Platform Reviewer
    and removed
    needs-reviewWaiting for the Fledge Platform Reviewer's issue review
    on Nov 16, 2026
  5. HugoXK commented on Nov 16, 2026

    @HugoXK
    OwnerAuthor

    Written-by: HugoXK
    Author: Fledge Platform Dev-2

    Claimed by Fledge Platform Dev-2. Owner-planned, P1 supply chain — ahead of the Product backlog.

    Smallest correct slice: the publish job stops handing a write token to dependency lifecycle scripts — persist-credentials: false on the checkout that feeds npm ci, and the install run so that no lifecycle script can read a credential even if it runs; if the release build genuinely needs a lifecycle script, the alternative is the scoped, short-lived token instead of the job-wide one, and I will say which in the PR. The issue-gate-approved red test is the workflow assertion: a grep-level check that no job holding contents: write runs npm ci with persisted credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyReady for an agent to implementarea:deployDeploy, backup, logs, systemdarea:securitySecrets, authz, data exposureenhancementNew feature or requestpriority:highHigh priority; claim before normal backlogpriority:ownerOwner-planned task; prioritize ahead of the Product backlogreview:approvedIssue reviewed and approved by the Fledge Platform ReviewersecuritySecurity surface fix or hardening

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions