Anti-AIClone

Log date · Tue

Does Zod npm provenance prove a package is safe?

Published on · Updated

No. Provenance connects a package to source and build information; review its behavior and assess clone resistance separately.

The answer: provenance is not a safety verdict

No. npm provenance helps verify a connection between a package, its source and its build; it does not guarantee safe code. [3] In our Node.js sample, both files are 25 bytes: an identical copy matches the reference digest, while changing one digit does not. A match only says the bytes agree with the chosen reference.

Three separate questions
QuestionEvidence
Are the bytes the same?Compare with a trusted reference digest.
From the intended build?Verify the attestation, identity and build relationship.
Is behavior acceptable or cloning harder?Review behavior and run a separate comparison.

This is an illustration using our own files, not a test of Zod 4.6.7 or a comprehensive security audit. We did not cryptographically validate the signature and provenance association.

Separate release, registry and earlier incident

The official GitHub release records v4.6.7 at 16:30:32 UTC on October 12, 2026, or 00:30:32 on October 13 in Beijing, at commit b500a2e. [1] npm recorded package publication at 16:29:37.778 UTC, a different timestamp.

GitHub’s September 21 advisory says the malicious Zod repository changes did not reach npm publishing. [2] At 17:17:12 UTC on October 12, or 01:17:12 Beijing on October 13, the maintainer explained that generated notes listed reverted commits, then described history cleanup, the 4.6.7 release and the effect on 4.6.6 provenance. This was not a new October 13 attack.

Registry records list attestation links for both versions. [4] A link is not a verification receipt. Examine repository history, package bytes and their attested relationship separately; neither current-package malware nor a safety certification follows from those links.

Experiment: equal length does not mean equal bytes

We computed SHA-256 for our own code and compared a copy and an edited version with the original digest. [5] The edit changes limit from 10 to 20 while leaving the length at 25 bytes. This is the recorded output.

Three comparison lines selected verbatim from our run.
approved: 25 bytes; matches expected: true
same bytes: 25 bytes; matches expected: true
changed: 25 bytes; matches expected: false

The digest detects this byte change. If both the reference and file come from the same untrusted source, however, both can be replaced. When verifying signatures and attestations, also check that the issuer identity, expected repository, commit, build workflow and artifact digest satisfy your policy. A successful verification still leaves code review as a separate step. Retain the verification output alongside the release record so another reviewer can identify exactly which file and policy were checked. A hash computed after an unreviewed download is useful for tracking, but it does not independently establish origin.

Run this self-contained sample to compare digests.
node --version
node <<'NODE'
const { createHash } = require('node:crypto');
const approved = Buffer.from('export const limit = 10;\n');
const changed = Buffer.from('export const limit = 20;\n');
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
const expected = hash(approved);
for (const [name, bytes] of [['approved', approved], ['same bytes', Buffer.from(approved)], ['changed', changed]]) {
  console.log(`${name}: ${bytes.length} bytes; matches expected: ${hash(bytes) === expected}`);
  console.log(`sha256: ${hash(bytes)}`);
}
console.log('expected digest source: local sample, not an authenticated statement');
NODE

Recommendations for dependencies and AI builds

These are engineering recommendations, not protection effects measured by our sample. Give delivery acceptance, behavior review and clone-resistance assessment their own evidence and owners.

Recommendations by finding
FindingRecommendation
Digest mismatchStop using the artifact; check the trusted reference and build record.
Missing or failed attestationKeep the error, investigate and apply your dependency policy.
Valid attestation, unfamiliar install hookReview scripts and network permissions in isolation before execution.
Need an AI clone-resistance assessmentCompare functionally equivalent builds with the same model, tools, time and budget.

Have an agent first inventory versions, changes, files and install hooks read-only; an explicit dependency policy should decide what may execute. Keep production secrets and customer content out of the build environment and separate review, build and release authority. Disabling install scripts can break legitimate dependencies, so test in a disposable copy and approve necessary scripts individually.

A delivery record should include input and output digests, authorized transformations, tool version and local signing steps. A clone-resistance comparison uses the same budget and withheld behavioral tests for equivalent unprotected and protected builds, then measures reconstruction. Unreadable control flow is not the result. Use the [AI cloning threat model](/blog/ai-cloning-threat-model) to define the assessment boundary.

Check your own project

In a project with installed dependencies and network access, npm documents a command to verify registry signatures and available attestations. [3][6] Record the tool version, exit status and complete result. Investigate missing attestations or errors instead of treating them as passes. The command contacts the registry, so run it in an environment consistent with your team’s network and dependency policy.

Project check; run in your own environment.
npm --version
npm audit signatures

For your release artifact, obtain the expected digest through a trusted channel, calculate the actual digest and record the comparison. Then check the actual build’s functions, permissions, install scripts and test results. AI-assisted inventory can save time, but an agent’s completion message is not a verification receipt.

Your checklist

  • Check the version, release event and delivered artifact.
  • Compare the artifact with a digest from a trusted channel.
  • Verify attestation signatures, identity and expected build association.
  • Review install hooks in isolation and restrict build permissions.
  • Assess clone resistance separately with a fixed budget and withheld tests.

Primary sources

All sources and reproduction status ↗