---
title: "Secure your supply chain"
description: "Keep the dependencies your app installs trustworthy: lockfiles, install cooldowns, install scripts by name, trust checks, reviewed agent and editor config, and a CI that cannot be turned against you."
canonical_url: "https://nuxt-backend.dev/docs/ship/security/supply-chain"
---
# Secure your supply chain

> Keep the dependencies your app installs trustworthy: lockfiles, install cooldowns, install scripts by name, trust checks, reviewed agent and editor config, and a CI that cannot be turned against you.

Version: nuxt-backend 0.6.x · Tab: Ship · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

Your app runs the code of every package it installs, at install time and in production. In 2025 and 2026, attackers took over popular npm packages again and again, and the poisoned versions reached thousands of apps within hours. Package managers now ship the defenses natively: this page turns them on, in an order that costs you little.

<table>
<thead>
  <tr>
    <th>
      Incident
    </th>
    
    <th>
      What happened
    </th>
    
    <th>
      What would have stopped it
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      chalk and debug, 2025-09-08
    </td>
    
    <td>
      A maintainer was phished into resetting 2FA, and malicious versions were published (<a href="https://www.theregister.com/2025/09/08/dev_falls_for_phishing_email" rel="nofollow">
        The Register
      </a>
      
      )
    </td>
    
    <td>
      A day's cooldown: they were pulled within hours
    </td>
  </tr>
  
  <tr>
    <td>
      Shai-Hulud, second wave, November 2025
    </td>
    
    <td>
      A worm ran at <code>
        preinstall
      </code>
      
      , stole tokens, spread, and wiped home directories (<a href="https://www.elastic.co/blog/shai-hulud-worm-2-0-updated-response" rel="nofollow">
        Elastic
      </a>
      
      )
    </td>
    
    <td>
      Install scripts allowed by name only
    </td>
  </tr>
  
  <tr>
    <td>
      TanStack, 2026-05-11
    </td>
    
    <td>
      A fork's pull request poisoned the Actions cache; 84 malicious versions shipped with valid provenance (<a href="https://tanstack.com/blog/npm-supply-chain-compromise-postmortem" rel="nofollow">
        postmortem
      </a>
      
      )
    </td>
    
    <td>
      A cooldown, and CI that never runs fork code with secrets
    </td>
  </tr>
  
  <tr>
    <td>
      ChainDrop, 2026-08-04
    </td>
    
    <td>
      A worm in <code>
        keyv
      </code>
      
       wrote a SessionStart hook to <code>
        .claude/settings.json
      </code>
      
       and a task to <code>
        .vscode/tasks.json
      </code>
      
      , so it ran again each time the folder opened (<a href="https://securitylabs.datadoghq.com/articles/npm-worm-compromises-popular-npm-packages/" rel="nofollow">
        Datadog
      </a>
      
      )
    </td>
    
    <td>
      Agent and editor config reviewed like code
    </td>
  </tr>
</tbody>
</table>

Provenance is evidence of where a package was built, not a verdict that it is safe: TanStack's malicious versions carried valid provenance.

## Lock what you install

Commit the lockfile, and install from it unchanged in CI and on your host:

```bash [CI]
npm ci                              # npm: fails when package-lock.json and package.json disagree
pnpm install --frozen-lockfile      # pnpm
```

A frozen install never resolves a new version, so a release published after your last update cannot reach production through a build. Update on purpose, in a pull request you read.

## Wait before you install new releases

Most compromised versions are found and pulled within hours. A cooldown keeps every release out of your installs until it is a day old.

<code-group>

```yaml [pnpm-workspace.yaml]
# pnpm's default since 11: a release waits 1,440 minutes, one day.
minimumReleaseAge: 1440
# Fail the install, rather than fall back to an older version that clears it.
minimumReleaseAgeStrict: true
```

```ini [.npmrc]
# npm 11.10 or later: a release waits this many days.
min-release-age=1
```

</code-group>

Let a fix in your own framework through the same day with `minimumReleaseAgeExclude` (pnpm), and give Dependabot the same wait, so it never proposes a version your install refuses:

```yaml [.github/dependabot.yml]
version: 2
updates:
  - package-ecosystem: npm
    directory: /
    schedule:
      interval: weekly
    cooldown:
      default-days: 1
```

A cooldown applies to version updates. Dependabot's security updates still arrive at once ([Dependabot options](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference)).

## Allow install scripts by name

A `preinstall` or `postinstall` script runs with your user's rights before you run anything yourself. pnpm 11 and later, and npm 12, run none by default, and you allow the few that need one:

<code-group>

```yaml [pnpm-workspace.yaml]
# pnpm's default since 11: fail the install when a dependency wants a script that is not listed.
strictDepBuilds: true
allowBuilds:
  '@parcel/watcher': true
  esbuild: true
  sharp: true
```

```bash [npm 12]
npm approve-scripts   # writes the allowlist to package.json
```

</code-group>

A Nuxt app with nuxt-backend usually needs `esbuild` and `@parcel/watcher`, and `sharp` once it optimizes images. nuxt-backend itself has no install script. With npm, an `ignore-scripts=true` left in `.npmrc` silently overrides the allowlist ([npm 12](https://www.infoq.com/news/2026/08/npm-12-released/)).

## Refuse downgrades and exotic sources

Two more checks catch a takeover that a cooldown misses:

```yaml [pnpm-workspace.yaml]
# Refuse a version that carries weaker trust evidence than an earlier one,
# such as a release with no provenance after releases that had it.
trustPolicy: no-downgrade
# pnpm's default since 11: no transitive dependency from a git repository or a tarball URL.
blockExoticSubdeps: true
```

`trustPolicy` is off by default. When it refuses a version, pin the last one it accepts and wait for the maintainer: nuxt-backend's own site pinned `@vercel/firewall` to 1.2.2 this way, when 1.2.3 to 1.2.6 shipped without provenance. On npm 12, git and remote dependencies are refused unless `--allow-git` or `--allow-remote` says otherwise ([pnpm supply chain security](https://pnpm.io/supply-chain-security)).

## Check signatures after an install

```bash
npm audit signatures
```

It checks the registry's signature on every installed package, and the provenance attestation of each that has one. Run it in CI after the install. A missing signature is worth a look; a valid one tells you where a package was built, not that its code is safe.

## Review agent and editor config like code

Worms now persist where your tools run code without asking: an agent's hooks, an editor's tasks. Treat changes to these as code changes:

- `.claude/` (hooks in `settings.json`, commands, skills), `.cursor/` and `AGENTS.md`;
- `.vscode/tasks.json` and `.vscode/settings.json`;
- `.mcp.json`, which names the servers your agent starts;
- `.githooks/` and `.husky/`.

Add them to `CODEOWNERS` so a change needs your review, and read the diff after every dependency update. `npx nuxt-backend init` writes `AGENTS.md`, `.mcp.json` and the agent skills: a change to them you did not make deserves the same look ([Agent files](https://nuxt-backend.dev/docs/develop/agents/agent-files)).

## Harden CI

Your CI holds the keys to production. Keep it from running code you did not review:

- **Pin every action by its full commit SHA**, not a tag, which its owner can move ([Secure use](https://docs.github.com/en/actions/reference/security/secure-use)).
- **Never check out a fork's code in pull_request_target**: that trigger runs with your secrets and write access. Use `pull_request` for untrusted code.
- **Keep caches apart.** A job that deploys or publishes restores no cache a pull request could have written.
- **Give each job the least permissions** it needs, and production's deploy key only to the job that deploys, behind a protected environment.

[Check every change in CI](https://nuxt-backend.dev/docs/develop/testing/ci) has a workflow that follows these rules.

## How nuxt-backend ships

nuxt-backend applies the same rules to itself. Its repository runs the pnpm settings above, pins its actions by SHA, and publishes from CI with npm's trusted publishing and provenance. Each release is staged, and a maintainer approves it with 2FA before anyone can install it. [Verify a release](https://nuxt-backend.dev/docs/ship/releases/verify) checks the tarball you installed against that record.

## Related

- [Security model](https://nuxt-backend.dev/docs/ship/security): what the package guards at run time.
- [Verify a release](https://nuxt-backend.dev/docs/ship/releases/verify): provenance, the tarball and the SBOM.
- [Check every change in CI](https://nuxt-backend.dev/docs/develop/testing/ci): a workflow that installs from the lockfile.
- [Agent files](https://nuxt-backend.dev/docs/develop/agents/agent-files): what `init` writes for coding agents.
- [Rotate secrets](https://nuxt-backend.dev/docs/ship/security/secrets): what to do after a leak.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
