Exemple
proxy-from-env 1.1.0
Échantillon vérifié pour npm proxy-from-env 1.1.0. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:20fca09b299083a2fa9781654699a2604afd649c73b5824b987fb97f8fe91d7e
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
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
Cas
HOW- Objectif
- verify pkg:npm/proxy-from-env@1.1.0
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-08-20T20:32:58Z
Contrat
- assert getProxyForUrl returns proxy url matching protocol from environment variables
- assert getProxyForUrl prepends protocol scheme if proxy address lacks scheme
- assert getProxyForUrl returns empty string when no proxy environment variables are set
- assert getProxyForUrl respects NO_PROXY exact domain and wildcard matching
- assert getProxyForUrl respects NO_PROXY domain suffix matching with leading dot or asterisk
- assert getProxyForUrl respects NO_PROXY specific port filtering
- assert getProxyForUrl returns empty string for invalid or missing URL inputs
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
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 pkg:npm/proxy-from-env@1.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/proxy-from-env@1.1.0
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- 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:0579f60110fc32ffa2665fb76b05beb038a19261485af945219305402a079d9b","constraints":{"executionContext":"node"},"contract":["assert getProxyForUrl returns proxy url matching protocol from environment variables","assert getProxyForUrl prepends protocol scheme if proxy address lacks scheme","assert getProxyForUrl returns empty string when no proxy environment variables are set","assert getProxyForUrl respects NO_PROXY exact domain and wildcard matching","assert getProxyForUrl respects NO_PROXY domain suffix matching with leading dot or asterisk","assert getProxyForUrl respects NO_PROXY specific port filtering","assert getProxyForUrl returns empty string for invalid or missing URL inputs"],"goal":"verify pkg:npm/proxy-from-env@1.1.0","kind":"HOW","packages":["pkg:npm/proxy-from-env@1.1.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/proxy-from-env@1.1.0"],"schemaVersion":1,"subject":"pkg:npm/proxy-from-env@1.1.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-proxy-from-env",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-proxy-from-env",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"proxy-from-env": "1.1.0"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
}
}
}
{
"name": "sample-proxy-from-env",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"proxy-from-env": "1.1.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/proxy-from-env@1.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/proxy-from-env@1.1.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { getProxyForUrl } = require('proxy-from-env');
function withEnv(env, fn) {
const originalEnv = { ...process.env };
const proxyKeys = [
'http_proxy', 'HTTP_PROXY',
'https_proxy', 'HTTPS_PROXY',
'all_proxy', 'ALL_PROXY',
'no_proxy', 'NO_PROXY',
'npm_config_http_proxy', 'npm_config_https_proxy',
'npm_config_proxy', 'npm_config_no_proxy'
];
for (const k of proxyKeys) {
delete process.env[k];
}
Object.assign(process.env, env);
try {
fn();
} finally {
for (const k of proxyKeys) {
delete process.env[k];
}
Object.assign(process.env, originalEnv);
}
}
// 1. Returns proxy url matching protocol from environment variables
withEnv({
HTTP_PROXY: 'http://proxy.example.com:8080',
HTTPS_PROXY: 'https://secure.example.com:8443',
ALL_PROXY: 'socks://all.example.com:1080'
}, () => {
assert.equal(getProxyForUrl('http://example.com/api'), 'http://proxy.example.com:8080');
assert.equal(getProxyForUrl('https://example.com/api'), 'https://secure.example.com:8443');
assert.equal(getProxyForUrl('ws://example.com/socket'), 'socks://all.example.com:1080');
});
// 2. Prepends protocol scheme if proxy address lacks scheme
withEnv({
HTTP_PROXY: 'proxy.example.com:8080',
HTTPS_PROXY: 'secure.example.com:8443'
}, () => {
assert.equal(getProxyForUrl('http://example.com'), 'http://proxy.example.com:8080');
assert.equal(getProxyForUrl('https://example.com'), 'https://secure.example.com:8443');
});
// 3. Returns empty string when no proxy environment variables are set
withEnv({}, () => {
assert.equal(getProxyForUrl('http://example.com'), '');
assert.equal(getProxyForUrl('https://example.com'), '');
assert.equal(getProxyForUrl('ftp://example.com'), '');
});
// 4. Respects NO_PROXY exact domain and wildcard matching
withEnv({
HTTP_PROXY: 'http://proxy.example.com:8080',
NO_PROXY: 'example.com, example.org'
}, () => {
assert.equal(getProxyForUrl('http://example.com/page'), '');
assert.equal(getProxyForUrl('http://example.org/data'), '');
assert.equal(getProxyForUrl('http://example.net/page'), 'http://proxy.example.com:8080');
});
withEnv({
HTTP_PROXY: 'http://proxy.example.com:8080',
NO_PROXY: '*'
}, () => {
assert.equal(getProxyForUrl('http://example.com'), '');
assert.equal(getProxyForUrl('http://example.net'), '');
});
// 5. Respects NO_PROXY domain suffix matching with leading dot or asterisk
withEnv({
HTTP_PROXY: 'http://proxy.example.com:8080',
NO_PROXY: '.example.com, *.example.org'
}, () => {
assert.equal(getProxyForUrl('http://api.example.com'), '');
assert.equal(getProxyForUrl('http://service.example.org'), '');
assert.equal(getProxyForUrl('http://example.com'), 'http://proxy.example.com:8080');
});
// 6. Respects NO_PROXY specific port filtering
withEnv({
HTTP_PROXY: 'http://proxy.example.com:8080',
NO_PROXY: 'example.com:8080'
}, () => {
assert.equal(getProxyForUrl('http://example.com:8080/test'), '');
assert.equal(getProxyForUrl('http://example.com:3000/test'), 'http://proxy.example.com:8080');
});
// 7. Returns empty string for invalid or missing URL inputs
assert.equal(getProxyForUrl(''), '');
assert.equal(getProxyForUrl(null), '');
assert.equal(getProxyForUrl(undefined), '');
assert.equal(getProxyForUrl('no-protocol-host'), '');
assert.equal(getProxyForUrl({}), '');
Seeder d'origine
anonyme