Ejemplo
proxy-from-env 2.1.0
Muestra verificada para npm proxy-from-env 2.1.0. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: getProxyForUrl returns an empty…
sha256:b1cf59cdb08c2c224a026b14beff33b1cbb7ee65c6941206ba6fba4fe5059ba3
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 10
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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Caso
HOW- Objetivo
- verify pkg:npm/proxy-from-env@2.1.0
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-27T13:03:18Z
Contrato
- getProxyForUrl returns an empty string when no proxy environment variables are set
- getProxyForUrl returns the HTTP_PROXY URL for an HTTP request URL
- getProxyForUrl returns the HTTPS_PROXY URL for an HTTPS request URL
- getProxyForUrl returns ALL_PROXY URL when specific protocol proxy is not set
- getProxyForUrl returns an empty string when NO_PROXY wildcard is set or host matches NO_PROXY
- getProxyForUrl respects port-specific NO_PROXY filtering
- getProxyForUrl prepends the request protocol scheme when the proxy environment variable lacks a URL scheme
- getProxyForUrl returns an empty string when given an invalid URL or string without a valid hostname
- getProxyForUrl accepts URL instance as input
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@2.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/proxy-from-env@2.1.0
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:c360ff2e679af3025192a0035f6979c07df81298c6e5b51e64e005aba36af941","constraints":{"executionContext":"node"},"contract":["getProxyForUrl returns an empty string when no proxy environment variables are set","getProxyForUrl returns the HTTP_PROXY URL for an HTTP request URL","getProxyForUrl returns the HTTPS_PROXY URL for an HTTPS request URL","getProxyForUrl returns ALL_PROXY URL when specific protocol proxy is not set","getProxyForUrl returns an empty string when NO_PROXY wildcard is set or host matches NO_PROXY","getProxyForUrl respects port-specific NO_PROXY filtering","getProxyForUrl prepends the request protocol scheme when the proxy environment variable lacks a URL scheme","getProxyForUrl returns an empty string when given an invalid URL or string without a valid hostname","getProxyForUrl accepts URL instance as input"],"goal":"verify pkg:npm/proxy-from-env@2.1.0","kind":"HOW","packages":["pkg:npm/proxy-from-env@2.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","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/proxy-from-env@2.1.0"],"schemaVersion":1,"subject":"pkg:npm/proxy-from-env@2.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",
"dependencies": {
"proxy-from-env": "2.1.0"
}
},
"node_modules/proxy-from-env": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz",
"integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==",
"license": "MIT",
"engines": {
"node": ">=10"
}
}
}
}
{
"name": "sample-proxy-from-env",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"proxy-from-env": "2.1.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/proxy-from-env@2.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/proxy-from-env@2.1.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import process from 'node:process';
import { getProxyForUrl } from 'proxy-from-env';
function clearProxyEnv() {
delete process.env.http_proxy;
delete process.env.HTTP_PROXY;
delete process.env.https_proxy;
delete process.env.HTTPS_PROXY;
delete process.env.all_proxy;
delete process.env.ALL_PROXY;
delete process.env.no_proxy;
delete process.env.NO_PROXY;
}
// 1. getProxyForUrl returns an empty string when no proxy environment variables are set
{
clearProxyEnv();
const proxy = getProxyForUrl('http://example.com/test');
assert.equal(proxy, '');
}
// 2. getProxyForUrl returns the HTTP_PROXY URL for an HTTP request URL
{
clearProxyEnv();
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
const proxy = getProxyForUrl('http://example.com/api');
assert.equal(proxy, 'http://proxy.example.com:8080');
}
// 3. getProxyForUrl returns the HTTPS_PROXY URL for an HTTPS request URL
{
clearProxyEnv();
process.env.HTTPS_PROXY = 'http://secure-proxy.example.com:8443';
const proxy = getProxyForUrl('https://example.com/secure');
assert.equal(proxy, 'http://secure-proxy.example.com:8443');
}
// 4. getProxyForUrl returns ALL_PROXY URL when specific protocol proxy is not set
{
clearProxyEnv();
process.env.ALL_PROXY = 'socks5://proxy.example.com:1080';
const proxy = getProxyForUrl('http://example.com/other');
assert.equal(proxy, 'socks5://proxy.example.com:1080');
}
// 5. getProxyForUrl returns an empty string when NO_PROXY wildcard is set or host matches NO_PROXY
{
clearProxyEnv();
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
process.env.NO_PROXY = 'example.org,.example.net';
assert.equal(getProxyForUrl('http://example.org/index'), '');
assert.equal(getProxyForUrl('http://sub.example.net/'), '');
assert.equal(getProxyForUrl('http://other.example.com/'), 'http://proxy.example.com:8080');
process.env.NO_PROXY = '*';
assert.equal(getProxyForUrl('http://other.example.com/'), '');
}
// 6. getProxyForUrl respects port-specific NO_PROXY filtering
{
clearProxyEnv();
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
process.env.NO_PROXY = 'example.com:8080';
assert.equal(getProxyForUrl('http://example.com:8080/path'), '');
assert.equal(getProxyForUrl('http://example.com:80/path'), 'http://proxy.example.com:8080');
}
// 7. getProxyForUrl prepends the request protocol scheme when the proxy environment variable lacks a URL scheme
{
clearProxyEnv();
process.env.HTTP_PROXY = '127.0.0.1:8080';
const proxy = getProxyForUrl('http://example.com/data');
assert.equal(proxy, 'http://127.0.0.1:8080');
}
// 8. getProxyForUrl returns an empty string when given an invalid URL or string without a valid hostname
{
clearProxyEnv();
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
assert.equal(getProxyForUrl('not-a-valid-url'), '');
assert.equal(getProxyForUrl(''), '');
}
// 9. getProxyForUrl accepts URL instance as input
{
clearProxyEnv();
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
const urlObj = new URL('http://example.com/url-instance');
assert.equal(getProxyForUrl(urlObj), 'http://proxy.example.com:8080');
}
Seeder de origen
anónimo