npm-supply-chain-audit

作者:agent673 次安装尚无点赞更新于 2026年10月29日分类: 其他

它能做什么

Audit npm projects for Shai-Hulud-class supply-chain exposure: lifecycle scripts, Git dependency prepare hooks, release-age gaps, publish-token exposure, trusted publishing, signed releases, and verifier docs.

安装会在你的 AgentsRoom 桌面端打开这个条目。如果还没有安装应用,你会被带到下载页面。

SKILL.md

---
name: npm-supply-chain-audit
description: Audit npm projects for Shai-Hulud-class supply-chain exposure: lifecycle scripts, Git dependency prepare hooks, release-age gaps, publish-token exposure, trusted publishing, signed releases, and verifier docs.
---

# npm-supply-chain-audit

Use this skill when reviewing a JavaScript or TypeScript repository for
install-time malware exposure, compromised npm maintainer risk, or CI
publish-path abuse.

## Triggers

- "npm supply chain audit"
- "Shai-Hulud"
- "malicious npm package"
- "trusted publishing review"
- "publish token exposure"
- "Git dependency prepare script"
- "router_init.js" / "tanstack_runner.js"

## Audit sequence

### 1. Dependency source scan

Search manifests and lockfiles for exotic sources:

```bash
rg -n '"(git\\+|git://|github:|file:|link:)|https?://[^"]+\\.(tgz|tar\\.gz)' package.json package-lock.json
```

Findings to escalate:

- `github:` or `git+` dependencies, especially in
  `optionalDependencies`.
- Direct tarballs from non-registry hosts.
- `file:` or `link:` sources outside deliberate local workspace
  development.

Run the known-affected package feed scan as a separate hard gate:

```bash
npm run lint:affected-packages
AIWG_AFFECTED_PACKAGES_CSV=/mnt/ops/users/roctinam/Downloads/22-packages.csv npm run lint:affected-packages
AIWG_AFFECTED_PACKAGES_CSV=https://gist.githubusercontent.com/<user>/<gist-id>/raw/22-packages.csv npm run lint:affected-packages
```

Treat exact package/version hits as incident evidence. Preserve the
package name, version, published timestamp, detected timestamp range,
and feed source URL/path in the finding.

### 2. Lifecycle-script review

Inspect root package scripts and nested package manifests:

```bash
rg -n '"(preinstall|install|postinstall|prepare)"' package.json package-lock.json .
```

Treat install-time scripts as code execution on every developer machine
and CI runner. Remove them unless the package cannot function without
them. If one must remain, document the exact reason and what it can
access.

### 3. Release-age gate

Check for `.npmrc`:

```ini
min-release-age=7
```

Confirm contributors and lockfile-changing CI jobs use npm 11.5+. Use
10 days or higher for release-prep dependency churn and security-
sensitive branches.

### 4. Publish-path hardening

Review release workflows for:

- npm trusted publishing or another OIDC publish path.
- No long-lived npmjs.org publish token once trusted publishing is
  active.
- `permissions: id-token: write` scoped only to the job that publishes.
- Signed tag verification before build, pack, publish, or asset upload.
- SHA-pinned actions and digest-pinned containers in release jobs.
- No publish step on fork pull requests or untrusted PR triggers.

### 5. Evidence and user verification

For packages users install from a registry, require:

- npm provenance attestation where supported,
- signed git tag,
- signed release tarball or equivalent artifact signature,
- SBOM,
- user-facing verification docs.

The verifier docs should avoid commands that run lifecycle scripts while
checking an artifact. Prefer `npm install --package-lock-only
--ignore-scripts <pkg>@<version>` followed by `npm audit signatures`.

## Incident-response trigger

If a known malicious version was installed or a suspicious lifecycle
script ran, assume secrets reachable from that environment are exposed.
Rotate npm tokens, GitHub/Gitea tokens, cloud credentials, Kubernetes
service account tokens, Vault tokens, and deployment secrets. Then audit
recent publishes and workflow runs. If the affected-package feed hit a
CI runner or workstation cache, quarantine that cache before reuse.

## Output format

Lead with findings, ordered by severity:

```markdown
## Findings

- CRITICAL: <file:line> <risk> <fix>
- HIGH: <file:line> <risk> <fix>

## Clean Checks

- No Git dependency sources found.
- No install lifecycle scripts found.

## Follow-up Issues

- <title>, <acceptance criteria>
```

## References

- npm trusted publishing: <https://docs.npmjs.com/trusted-publishers>
- npm audit signatures: <https://docs.npmjs.com/cli/v11/commands/npm-audit#audit-signatures>
- npm `min-release-age`: <https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age>

延伸阅读

DevOps 工程师撰稿人前端开发者销售代表后端开发者教练与培训师软件架构师法律顾问QA 工程师财务与行政全栈开发者创意设计师移动开发者研究员安全工程师人事与招聘
项目经理翻译Git 专家数据分析师SEO 专家会计本地化专员公关与传播头脑风暴者运营与物流营销专员客户服务项目助理采购专员社群运营私人助理

下载 AgentsRoom

在一个窗口中运行你所有项目的所有 AI 代理。

下载 AgentsRoom免费

配套应用:随时随地监控你的 Agent

使用 Claude、Codex、Antigravity CLI 或其他 AI 提供商。

获取扩展程序
Chrome Web Store

把 Bug 和需求直接发送到您的公开待办清单。

像读聊天记录一样读代理

每个代理都有角色、头像和一条对话线程,读起来就像聊天应用。

对话视图

AgentsRoom 对话视图:AI 编程代理的工作以聊天线程呈现
多项目管理
多供应商
多代理运行
实时状态
文件差异与提交
移动应用
实时预览
代理团队
浏览器自动化
Backlog 驱动开发
提示词库
技能库
查看所有功能