Ejemplo
proxy-from-env 1.1.0
Muestra verificada para npm proxy-from-env 1.1.0. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: assert getProxyForUrl returns proxy…
sha256:20fca09b299083a2fa9781654699a2604afd649c73b5824b987fb97f8fe91d7e
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify pkg:npm/proxy-from-env@1.1.0
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-20T20:32:58Z
Contrato
- 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
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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 de origen
anónimo