Exemple
picomatch 4.0.5: Show that picomatch's extglob negation does not match like Bash greedily.
Échantillon vérifié pour npm picomatch 4.0.5: Show that picomatch's extglob negation does not match like Bash greedily. Le contrat s'est exécuté sur node 22…
sha256:b8544e8b7e053ceac9aaa4fb328c5d5268fded6d853cc97e082db7f576963962
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 3
- Clés de signature qui l’ont compilé
- 3
Environnement déclaré
node linux x64 node node npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-17 |
| node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-18 |
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-09-07 |
Cas
HOW- Objectif
- Show that picomatch's extglob negation does not match like Bash greedily.
- Paquets
- Symboles
-
- picomatch.isMatch
- Environnement
- node
- Créé
- 2026-08-17T03:51:49Z
Contrat
- assert picomatch.isMatch('foo', '!(foo)*') is false
- assert picomatch.isMatch('foobar', '!(foo)*') is false
- assert picomatch.isMatch('bar', '!(foo)*') is true
Fichiers
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
Code source
Search-known solution returned a HIT for `pkg:npm/picomatch` at `sampleId: sha256:1f237974ca30ebdf73f738e63ce5542765b1b010d22af4bc14c3fa2534d65503`, which proves the array-pattern negation trap (`!` entries in arrays do not exclude). This sample uses a different trap.
The trap here is that extglob negation is interpreted non-greedily in picomatch: expecting Bash-like behavior, one might think `!(foo)*` matches `"foo"` and `"foobar"`, but both return `false` (a silent mismatch, no thrown error).
{"case":{"believed":"A competent caller expects `!(foo)*` to match `foo` and `foobar` the way a Bash-style extglob does.","caseId":"case:sha256:a35a8bb316f82e0b3d35816380d8c2c860a474546f9ebbc501662441170f1ce6","contract":["assert picomatch.isMatch('foo', '!(foo)*') is false","assert picomatch.isMatch('foobar', '!(foo)*') is false","assert picomatch.isMatch('bar', '!(foo)*') is true"],"goal":"Show that picomatch's extglob negation does not match like Bash greedily.","kind":"HOW","packages":["pkg:npm/picomatch@4.0.5"],"schemaVersion":1,"symbols":["picomatch.isMatch"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","executionContext":"node","language":"node","os":"linux","packageManager":"npm","runtime":"node","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/picomatch@4.0.5"],"schemaVersion":1,"symbols":["picomatch.isMatch"],"verifierAdapter":"node-typescript@1"}
{
"name": "npm-picomatch-api",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "npm-picomatch-api",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"picomatch": "4.0.5"
}
},
"node_modules/picomatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
}
}
}
{
"name": "npm-picomatch-api",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"picomatch": "4.0.5"
}
}
import assert from 'node:assert/strict';
import picomatch from 'picomatch';
const checks = [
['foo', '!(foo)*', false],
['foobar', '!(foo)*', false],
['bar', '!(foo)*', true],
];
for (const [input, pattern, expected] of checks) {
const actual = picomatch.isMatch(input, pattern);
assert.equal(actual, expected, `${JSON.stringify(input)} with pattern ${JSON.stringify(pattern)} expected ${expected}`);
}
console.log('picomatch.contract.pass');