Beispiel
proxy-from-env 1.1.0
Verifiziertes Beispiel für npm proxy-from-env 1.1.0. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: assert getProxyForUrl returns…
sha256:20fca09b299083a2fa9781654699a2604afd649c73b5824b987fb97f8fe91d7e
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify pkg:npm/proxy-from-env@1.1.0
- Pakete
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-20T20:32:58Z
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
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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({}), '');
Ursprungs-Seeder
anonym