Exemplo
plist 3.1.1: parse
Amostra verificada para npm plist 3.1.1: parse. O contrato rodou em node 22 · linux debian/x64 · docker e passou: parse parses dictionary with primitive…
sha256:a8f8e4bf0d8786e3ab252ba7ae275b5bd1b69b6be68bd3c2d67d59aa5e194880
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-04 |
Caso
HOW- Objetivo
- verify plist.parse in pkg:npm/plist@3.1.1
- Pacotes
- Símbolos
-
- plist.parse
- Ambiente
- node 22.23.2
- Criado
- 2026-09-04T06:48:20Z
Contrato
- parse parses dictionary with primitive types (string, integer, real, boolean)
- parse parses nested dictionaries and arrays
- parse decodes base64 data nodes to Buffer and date nodes to Date instances
- parse returns empty array for empty plist tag and empty object for empty dict
- parse throws Error on malformed xml missing plist root element
- parse throws Error on __proto__ keys to prevent prototype pollution
Arquivos
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Código-fonte
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify plist.parse in pkg:npm/plist@3.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/plist@3.1.1
Demonstrate these symbols/APIs:
- plist.parse
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:4735470663f80a17e382c54e2bbe44a5a40a5722c8a93ac07d263a664518a91e","constraints":{"executionContext":"node"},"contract":["parse parses dictionary with primitive types (string, integer, real, boolean)","parse parses nested dictionaries and arrays","parse decodes base64 data nodes to Buffer and date nodes to Date instances","parse returns empty array for empty plist tag and empty object for empty dict","parse throws Error on malformed xml missing plist root element","parse throws Error on __proto__ keys to prevent prototype pollution"],"goal":"verify plist.parse in pkg:npm/plist@3.1.1","kind":"HOW","packages":["pkg:npm/plist@3.1.1"],"schemaVersion":1,"symbols":["plist.parse"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/plist@3.1.1"],"schemaVersion":1,"subject":"pkg:npm/plist@3.1.1","symbols":["plist.parse"],"verifierAdapter":"node-typescript@1"}
const plist = require('plist');
/**
* Parses a Plist XML string into JavaScript data structures.
* @param {string} xml - The XML string to decode.
* @returns {any} The decoded value from the Plist XML.
*/
function parsePlist(xml) {
return plist.parse(xml);
}
module.exports = {
parsePlist,
};
{
"name": "sample-plist-parse",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-plist-parse",
"version": "1.0.0",
"dependencies": {
"plist": "3.1.1"
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.9.12",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.12.tgz",
"integrity": "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A==",
"license": "MIT",
"engines": {
"node": ">=14.6"
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/plist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/plist/-/plist-3.1.1.tgz",
"integrity": "sha512-ZIfcLJC+7E7FBFnDxm9MPmt7D+DidyQ26lewieO75AdhA2ayMtsJSES0iWzqJQbcVRSrTufQoy0DR94xHue0oA==",
"license": "MIT",
"dependencies": {
"@xmldom/xmldom": "^0.9.10",
"base64-js": "^1.5.1",
"xmlbuilder": "^15.1.1"
},
"engines": {
"node": ">=10.4.0"
}
},
"node_modules/xmlbuilder": {
"version": "15.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
"integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==",
"license": "MIT",
"engines": {
"node": ">=8.0"
}
}
}
}
{
"name": "sample-plist-parse",
"version": "1.0.0",
"private": true,
"description": "Verify plist.parse in pkg:npm/plist@3.1.1",
"main": "index.js",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"plist": "3.1.1"
}
}
{
"schemaVersion": 1,
"goal": "verify plist.parse in pkg:npm/plist@3.1.1",
"kind": "HOW",
"packages": [
"pkg:npm/plist@3.1.1"
],
"symbols": [
"plist.parse"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const assert = require('node:assert');
const { parsePlist } = require('../index.js');
// 1. parse parses dictionary with primitive types (string, integer, real, boolean)
{
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>appName</key>
<string>CodeSampleX</string>
<key>count</key>
<integer>42</integer>
<key>score</key>
<real>99.5</real>
<key>isActive</key>
<true/>
<key>isArchived</key>
<false/>
</dict>
</plist>`;
const result = parsePlist(xml);
assert.strictEqual(result.appName, 'CodeSampleX');
assert.strictEqual(result.count, 42);
assert.strictEqual(result.score, 99.5);
assert.strictEqual(result.isActive, true);
assert.strictEqual(result.isArchived, false);
}
// 2. parse parses nested dictionaries and arrays
{
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>metadata</key>
<dict>
<key>tags</key>
<array>
<string>alpha</string>
<string>beta</string>
</array>
</dict>
</dict>
</plist>`;
const result = parsePlist(xml);
assert.deepStrictEqual(result.metadata.tags, ['alpha', 'beta']);
}
// 3. parse decodes base64 data nodes to Buffer and date nodes to Date instances
{
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>payload</key>
<data>SGVsbG8gV29ybGQ=</data>
<key>timestamp</key>
<date>2026-08-26T12:00:00Z</date>
</dict>
</plist>`;
const result = parsePlist(xml);
assert(Buffer.isBuffer(result.payload));
assert.strictEqual(result.payload.toString('utf8'), 'Hello World');
assert(result.timestamp instanceof Date);
assert.strictEqual(result.timestamp.toISOString(), '2026-08-26T12:00:00.000Z');
}
// 4. parse returns empty array for empty plist tag and empty object for empty dict
{
const emptyPlistXml = `<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0"></plist>`;
const emptyDictXml = `<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict></dict>
</plist>`;
assert.deepStrictEqual(parsePlist(emptyPlistXml), []);
assert.deepStrictEqual(parsePlist(emptyDictXml), {});
}
// 5. parse throws Error on malformed xml missing plist root element
{
assert.throws(
() => parsePlist('<root><key>test</key></root>'),
/malformed document/
);
}
// 6. parse throws Error on __proto__ keys to prevent prototype pollution
{
const maliciousXml = `<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>__proto__</key>
<string>polluted</string>
</dict>
</plist>`;
assert.throws(
() => parsePlist(maliciousXml),
/__proto__ keys can lead to prototype pollution/
);
}
Seeder de origem
anônimo