nulladrift 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -88,6 +88,77 @@ configs (`~/.claude.json`, `~/.cursor/mcp.json`, `claude_desktop_config.json`, W
88
88
  is the project's and is committed. `init` says when it left them out. `nulladrift logout <server>` deletes what `login`
89
89
  stored.
90
90
 
91
+ ## In GitHub Actions
92
+
93
+ Commit this as `.github/workflows/mcp.yml` next to your `mcp.lock`:
94
+
95
+ ```yaml
96
+ name: mcp
97
+ on: [push, pull_request]
98
+ permissions:
99
+ contents: read
100
+ jobs:
101
+ nulladrift:
102
+ runs-on: ubuntu-latest
103
+ steps:
104
+ - uses: actions/checkout@v4
105
+ with:
106
+ persist-credentials: false
107
+ - uses: Nulladrift/nulladrift@v0.13.0
108
+ ```
109
+
110
+ That runs `check` against the committed lock, with the nulladrift release the action came with,
111
+ and the step fails the way the CLI exits: 1 on drift, 2 when the audit could not be completed. It
112
+ uses the runner's Node when that is 22 or later and sets up 22 when it is not, so a job that
113
+ already chose a newer Node keeps it. The action is released with the CLI, from 0.13.0; pin a
114
+ commit SHA in place of the tag if your policy asks for one. The rule above holds here too: run it
115
+ on `pull_request`, never on `pull_request_target`.
116
+
117
+ To post the findings on the pull request, give the job `pull-requests: write` and the step the
118
+ token:
119
+
120
+ ```yaml
121
+ - uses: Nulladrift/nulladrift@v0.13.0
122
+ with:
123
+ args: --comment
124
+ env:
125
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126
+ ```
127
+
128
+ To send each reading to a control plane instead, which decides the verdict and keeps the record,
129
+ add `id-token: write` to the permissions so the reading is signed by the build that sent it:
130
+
131
+ ```yaml
132
+ - uses: Nulladrift/nulladrift@v0.13.0
133
+ with:
134
+ command: push
135
+ api-url: ${{ vars.NULLADRIFT_API_URL }}
136
+ token: ${{ secrets.NULLADRIFT_TOKEN }}
137
+ ```
138
+
139
+ | Input | Default | What it does |
140
+ | --- | --- | --- |
141
+ | `command` | `check` | `check` or `push`. |
142
+ | `args` | none | More arguments for the command, split on spaces: `--comment`, `--sarif nulladrift.sarif`, `--allow-unreachable`. |
143
+ | `working-directory` | `.` | Where `mcp.lock` and the MCP configs are. |
144
+ | `version` | the action's release | The nulladrift version to run from npm. |
145
+ | `node-version` | the runner's, or 22 | Node.js to run it on. Setting it always sets that version up. |
146
+ | `token` | none | For `push`: the collector token. Same as `NULLADRIFT_TOKEN`, which the job can set instead. |
147
+ | `api-url` | none | For `push`: the control plane's address. Same as `NULLADRIFT_API_URL`. |
148
+
149
+ ### Show that a repository is pinned
150
+
151
+ [![MCP pinned by nulladrift][pinned]](https://nulladrift.com)
152
+
153
+ ```markdown
154
+ [![MCP pinned by nulladrift](https://img.shields.io/badge/MCP-pinned%20by%20nulladrift-a3e635?labelColor=0d1117&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iI2EzZTYzNSI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYTNlNjM1IiBzdHJva2Utd2lkdGg9IjIuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj48cGF0aCBkPSJNMy42IDE3LjRoNi4zIi8+PHBhdGggZD0iTTE0LjEgMTcuNGg2LjMiLz48L2c+PGNpcmNsZSBjeD0iMTIiIGN5PSI1LjgiIHI9IjMuMyIvPjxwYXRoIGQ9Ik0xMC43NSA4LjQgMTIgMjEuNiAxMy4yNSA4LjRaIi8+PC9zdmc+)](https://nulladrift.com)
155
+ ```
156
+
157
+ It says the repository pins its MCP servers with nulladrift. It is not a status badge: it does not
158
+ turn red when `check` fails, which is the job's own status to show.
159
+
160
+ [pinned]: https://img.shields.io/badge/MCP-pinned%20by%20nulladrift-a3e635?labelColor=0d1117&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iI2EzZTYzNSI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYTNlNjM1IiBzdHJva2Utd2lkdGg9IjIuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj48cGF0aCBkPSJNMy42IDE3LjRoNi4zIi8+PHBhdGggZD0iTTE0LjEgMTcuNGg2LjMiLz48L2c+PGNpcmNsZSBjeD0iMTIiIGN5PSI1LjgiIHI9IjMuMyIvPjxwYXRoIGQ9Ik0xMC43NSA4LjQgMTIgMjEuNiAxMy4yNSA4LjRaIi8+PC9zdmc+
161
+
91
162
  ## What lands in the lock
92
163
 
93
164
  For every server: its identity (`serverInfo`), its declared capabilities, and the
@@ -149,7 +220,8 @@ artifact and fails `check` with nothing in the project changed. `init`, `check`
149
220
  which servers are written that way and give the spec for what runs now, such as
150
221
  `@modelcontextprotocol/server-memory@2.2.1`, `mcp-server-fetch==2026.11.18` or an image by digest.
151
222
  Written that way, an upgrade is a pull request that changes the version, and the drift it brings
152
- is reviewed there. Changing the command is itself reported once, as `server.transport.changed`;
223
+ is reviewed there. Editing the version in the command is reported as `server.transport.changed`
224
+ at low severity, for the pin and for every upgrade after it, since it names the same package;
153
225
  accept it with `nulladrift review`. An image with a version tag is left alone, and the warning
154
226
  never changes the exit code.
155
227
 
package/dist/index.js CHANGED
@@ -100,11 +100,19 @@ function serversThatShippedNothing(changes) {
100
100
  const versioned = /* @__PURE__ */ new Set();
101
101
  for (const change2 of changes) {
102
102
  const uncaptured = change2.kind === "server.removed" || change2.kind === "server.added" && change2.after === void 0;
103
- if (!uncaptured) moved.add(change2.server);
104
- if (change2.kind === "server.identity.changed") versioned.add(change2.server);
103
+ const relaunch = change2.kind === "server.transport.changed" && change2.severity === "low";
104
+ if (!uncaptured && !relaunch) moved.add(change2.server);
105
+ if (change2.kind === "server.identity.changed" || releaseMoved(change2)) versioned.add(change2.server);
105
106
  }
106
107
  return [...moved].filter((server2) => !versioned.has(server2)).sort();
107
108
  }
109
+ function releaseMoved(change2) {
110
+ if (change2.kind !== "server.artifact.changed") return false;
111
+ const version = (side) => typeof side === "object" && side !== null && "version" in side && typeof side.version === "string" ? side.version : void 0;
112
+ const was = version(change2.before);
113
+ const now = version(change2.after);
114
+ return was !== void 0 && now !== void 0 && was !== now;
115
+ }
108
116
 
109
117
  // ../core/src/lock/types.ts
110
118
  var LOCKFILE_VERSION = 2;
@@ -1486,12 +1494,66 @@ function orderless(entry) {
1486
1494
  prompts: digests(prompts)
1487
1495
  });
1488
1496
  }
1497
+ function unversioned(arg, ecosystem) {
1498
+ switch (ecosystem) {
1499
+ case "npm": {
1500
+ const at = arg.lastIndexOf("@");
1501
+ if (at <= 0) return { base: arg, name: arg, exact: false };
1502
+ const qualifier = arg.slice(at + 1);
1503
+ if (!/^[\w.^~<>=| *+-]+$/.test(qualifier)) return void 0;
1504
+ return { base: arg.slice(0, at), name: arg.slice(0, at), exact: /^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(qualifier) };
1505
+ }
1506
+ case "pypi": {
1507
+ const match = /^([A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)(\[[^\]]*\])?(?:\s*(===?|>=|<=|~=|!=|>|<|@)\s*([^\s:/]+))?$/.exec(arg.trim());
1508
+ if (!match) return void 0;
1509
+ const [, name, extras, operator, value] = match;
1510
+ return {
1511
+ // PEP 503: case, `-`, `_` and `.` do not tell two packages apart. Extras stay in the base: they install more.
1512
+ base: `${name}${extras ?? ""}`,
1513
+ name: name.replace(/[-_.]+/g, "-").toLowerCase(),
1514
+ // `==` and uv's `@` name one release; every other operator names a set of them.
1515
+ exact: (operator === "==" || operator === "===" || operator === "@") && /^\d[\w.!+-]*$/.test(value ?? "")
1516
+ };
1517
+ }
1518
+ case "oci": {
1519
+ const match = /^([^@\s]+?)(?::[\w][\w.-]{0,127})?(@sha256:[a-f0-9]{64})?$/.exec(arg);
1520
+ if (!match || match[1].includes("@")) return void 0;
1521
+ return { base: match[1], name: match[1], exact: match[2] !== void 0 };
1522
+ }
1523
+ case "file":
1524
+ return void 0;
1525
+ }
1526
+ }
1527
+ function versionOnlyRelaunch(before, after) {
1528
+ const was = before.provenance;
1529
+ const now = after.provenance;
1530
+ if (!was || !now || was.ecosystem !== now.ecosystem || was.name !== now.name) return void 0;
1531
+ if (before.transport.type !== "stdio" || after.transport.type !== "stdio") return void 0;
1532
+ const wasArgs = before.transport.args ?? [];
1533
+ const nowArgs = after.transport.args ?? [];
1534
+ if (wasArgs.length !== nowArgs.length) return void 0;
1535
+ const differ = wasArgs.flatMap((arg, i) => arg === nowArgs[i] ? [] : [i]);
1536
+ if (differ.length !== 1) return void 0;
1537
+ const at = differ[0];
1538
+ const placeholder = (args) => args.map((arg, i) => i === at ? "" : arg);
1539
+ if (!same({ ...before.transport, args: placeholder(wasArgs) }, { ...after.transport, args: placeholder(nowArgs) })) return void 0;
1540
+ const wasSpec = unversioned(wasArgs[at], was.ecosystem);
1541
+ const nowSpec = unversioned(nowArgs[at], now.ecosystem);
1542
+ if (!wasSpec || !nowSpec || !nowSpec.exact || wasSpec.base !== nowSpec.base || nowSpec.name !== now.name) return void 0;
1543
+ return { was: wasArgs[at], now: nowArgs[at] };
1544
+ }
1489
1545
  function compareServer(name, before, after) {
1490
1546
  const provenance2 = compareProvenance(name, before, after);
1491
1547
  if (before.digest === after.digest) return provenance2;
1492
1548
  const changes = [...provenance2];
1493
1549
  if (!same(before.transport, after.transport)) {
1494
- changes.push(change("server.transport.changed", name, "the server is reached differently than when it was pinned", { before: before.transport, after: after.transport }));
1550
+ const relaunch = versionOnlyRelaunch(before, after);
1551
+ if (relaunch === void 0) {
1552
+ changes.push(change("server.transport.changed", name, "the server is reached differently than when it was pinned", { before: before.transport, after: after.transport }));
1553
+ } else {
1554
+ const summary = provenance2.length === 0 ? `the command now asks for ${relaunch.now} instead of ${relaunch.was}: the release that was already running, named exactly, so the next one published will not replace it` : `the command now asks for ${relaunch.now} instead of ${relaunch.was}: the same package, and what the release changed is reported beside this`;
1555
+ changes.push(change("server.transport.changed", name, summary, { severity: "low", before: before.transport, after: after.transport }));
1556
+ }
1495
1557
  }
1496
1558
  if (!same(before.serverInfo, after.serverInfo)) {
1497
1559
  const from = before.serverInfo?.version ?? "unknown";
@@ -2441,7 +2503,7 @@ import { readFile as readFile3 } from "fs/promises";
2441
2503
  import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
2442
2504
 
2443
2505
  // src/lib/version.ts
2444
- var VERSION = "0.11.0";
2506
+ var VERSION = "0.13.0";
2445
2507
  var USER_AGENT = `nulladrift/${VERSION} (+https://github.com/Nulladrift/nulladrift)`;
2446
2508
 
2447
2509
  // src/lock/provenance.ts
@@ -4686,7 +4748,7 @@ var RULE_HELP = {
4686
4748
  "tool.behavior.escalated": "The tool now claims a power it did not claim when it was pinned. Annotation defaults are not neutral: removing readOnlyHint is an escalation.",
4687
4749
  "tool.input_schema.widened": "The tool accepts input it previously rejected, enlarging what the agent can be induced to send.",
4688
4750
  "tool.header_params.changed": "x-mcp-header mirrors an argument's value into an HTTP header, where proxies and other intermediaries can read it.",
4689
- "server.transport.changed": "The configured name now points at a different command or URL. This is a different server, not a changed one.",
4751
+ "server.transport.changed": "The configured name now points at a different command or URL. This is a different server, not a changed one. When the only difference is that the command now names an exact release of the same package, the result is a note, and what that release changed is reported beside it.",
4690
4752
  "server.identity.changed": "The server reports a different identity or version than the one that was reviewed.",
4691
4753
  "server.artifact.changed": "The package, image or file behind this server is a different release than the one pinned. When the declared surface did not change, nothing else in the report describes what the new code does; read the release, not just this diff.",
4692
4754
  "server.artifact.substituted": "The same published version now has different contents. Registries treat a version as immutable, so this means a mirror, proxy or registry served different bytes, or an image tag was repointed. Treat it as a supply-chain incident until shown otherwise."