configproof 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +217 -0
- package/dist/adapters/dotenv.d.ts +3 -0
- package/dist/adapters/dotenv.js +277 -0
- package/dist/adapters/dotenv.js.map +1 -0
- package/dist/adapters/native-env.d.ts +7 -0
- package/dist/adapters/native-env.js +196 -0
- package/dist/adapters/native-env.js.map +1 -0
- package/dist/adapters/registry.d.ts +7 -0
- package/dist/adapters/registry.js +30 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/agent/server.d.ts +15 -0
- package/dist/agent/server.js +254 -0
- package/dist/agent/server.js.map +1 -0
- package/dist/analysis/diagnose.d.ts +64 -0
- package/dist/analysis/diagnose.js +142 -0
- package/dist/analysis/diagnose.js.map +1 -0
- package/dist/analysis/history.d.ts +52 -0
- package/dist/analysis/history.js +119 -0
- package/dist/analysis/history.js.map +1 -0
- package/dist/analysis/policy.d.ts +161 -0
- package/dist/analysis/policy.js +192 -0
- package/dist/analysis/policy.js.map +1 -0
- package/dist/analysis/provenance.d.ts +45 -0
- package/dist/analysis/provenance.js +144 -0
- package/dist/analysis/provenance.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +286 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/analyze.d.ts +46 -0
- package/dist/core/analyze.js +168 -0
- package/dist/core/analyze.js.map +1 -0
- package/dist/core/collect.d.ts +5 -0
- package/dist/core/collect.js +147 -0
- package/dist/core/collect.js.map +1 -0
- package/dist/core/export.d.ts +53 -0
- package/dist/core/export.js +155 -0
- package/dist/core/export.js.map +1 -0
- package/dist/core/io.d.ts +13 -0
- package/dist/core/io.js +100 -0
- package/dist/core/io.js.map +1 -0
- package/dist/core/privacy.d.ts +25 -0
- package/dist/core/privacy.js +113 -0
- package/dist/core/privacy.js.map +1 -0
- package/dist/core/schema.d.ts +2149 -0
- package/dist/core/schema.js +181 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/demo.d.ts +1 -0
- package/dist/demo.js +45 -0
- package/dist/demo.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/launcher.d.ts +27 -0
- package/dist/launcher.js +122 -0
- package/dist/launcher.js.map +1 -0
- package/dist/report/html.d.ts +5 -0
- package/dist/report/html.js +109 -0
- package/dist/report/html.js.map +1 -0
- package/dist/runtime/api.d.ts +44 -0
- package/dist/runtime/api.js +29 -0
- package/dist/runtime/api.js.map +1 -0
- package/dist/runtime/callsite.d.ts +3 -0
- package/dist/runtime/callsite.js +61 -0
- package/dist/runtime/callsite.js.map +1 -0
- package/dist/runtime/children.d.ts +8 -0
- package/dist/runtime/children.js +69 -0
- package/dist/runtime/children.js.map +1 -0
- package/dist/runtime/environment.d.ts +3 -0
- package/dist/runtime/environment.js +53 -0
- package/dist/runtime/environment.js.map +1 -0
- package/dist/runtime/preload.d.ts +1 -0
- package/dist/runtime/preload.js +117 -0
- package/dist/runtime/preload.js.map +1 -0
- package/dist/runtime/recorder.d.ts +59 -0
- package/dist/runtime/recorder.js +254 -0
- package/dist/runtime/recorder.js.map +1 -0
- package/dist/runtime/workers.d.ts +12 -0
- package/dist/runtime/workers.js +127 -0
- package/dist/runtime/workers.js.map +1 -0
- package/docs/ARCHITECTURE.md +54 -0
- package/docs/COMPATIBILITY.md +24 -0
- package/docs/PRIVACY.md +17 -0
- package/docs/VALIDATION.md +42 -0
- package/fixtures/bypass/app.cjs +6 -0
- package/fixtures/bypass/early.cjs +2 -0
- package/fixtures/child-process/child.cjs +2 -0
- package/fixtures/child-process/parent.cjs +5 -0
- package/fixtures/custom-target/app.cjs +4 -0
- package/fixtures/custom-target/sample.env +1 -0
- package/fixtures/esm/app.mjs +5 -0
- package/fixtures/exit-code/app.cjs +4 -0
- package/fixtures/failure-boundary/app.cjs +7 -0
- package/fixtures/load-order/app.cjs +9 -0
- package/fixtures/load-order/first.env +1 -0
- package/fixtures/load-order/second.env +1 -0
- package/fixtures/manifest.json +16 -0
- package/fixtures/native-env/app.cjs +6 -0
- package/fixtures/native-env/failure.cjs +4 -0
- package/fixtures/native-env/sample.env +1 -0
- package/fixtures/native-env/startup.cjs +2 -0
- package/fixtures/runtime-mutation/app.cjs +12 -0
- package/fixtures/source-map/input.ts +5 -0
- package/fixtures/source-map/tsconfig.json +7 -0
- package/fixtures/stale-inheritance/app.cjs +4 -0
- package/fixtures/stale-inheritance/sample.env +1 -0
- package/fixtures/v03-manifest.json +32 -0
- package/fixtures/worker/parent.cjs +3 -0
- package/fixtures/worker/worker.cjs +2 -0
- package/fixtures/worker-modes/parent.cjs +17 -0
- package/fixtures/worker-modes/worker.cjs +4 -0
- package/package.json +64 -0
- package/policies/configtrace-policy.yaml +23 -0
- package/policies/issue-share.yaml +12 -0
- package/policies/minimal.yaml +8 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const { spawn, fork } = require('node:child_process');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const child = path.join(__dirname, 'child.cjs');
|
|
4
|
+
spawn(process.execPath, [child], { env: { ...process.env, CONFIGTRACE_FIXTURE: 'synthetic-spawn' }, stdio: 'inherit' });
|
|
5
|
+
fork(child, [], { env: { ...process.env, CONFIGTRACE_FIXTURE: 'synthetic-fork' }, stdio: 'inherit' });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const target = {};
|
|
2
|
+
require('dotenv').config({ path: require('node:path').join(__dirname, 'sample.env'), processEnv: target, quiet: true });
|
|
3
|
+
void process.env.DATABASE_URL;
|
|
4
|
+
console.log(Object.hasOwn(target, 'DATABASE_URL') ? 'Custom object loaded.' : 'Custom object not loaded.');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DATABASE_URL=postgres://fixture:synthetic-only@localhost/intended
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const { markFailureBoundary } = require('../../dist/runtime/api.js');
|
|
2
|
+
process.env.CONFIGTRACE_FIXTURE = 'synthetic-before-boundary';
|
|
3
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
4
|
+
markFailureBoundary();
|
|
5
|
+
process.env.CONFIGTRACE_FIXTURE = 'synthetic-after-boundary';
|
|
6
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
7
|
+
process.exitCode = 17;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const dotenv = require('dotenv');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const first = path.join(__dirname, 'first.env');
|
|
4
|
+
const second = path.join(__dirname, 'second.env');
|
|
5
|
+
dotenv.config({ path: [first, second], quiet: true });
|
|
6
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
7
|
+
dotenv.config({ path: second, override: true, quiet: true });
|
|
8
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
9
|
+
console.log('Two loader phases completed.');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CONFIGTRACE_FIXTURE=synthetic-first
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CONFIGTRACE_FIXTURE=synthetic-second
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "configtrace-fixtures/1",
|
|
3
|
+
"validationStatus": "not-run-in-this-delivery",
|
|
4
|
+
"fixtures": [
|
|
5
|
+
{ "id": "stale-inheritance", "entry": "stale-inheritance/app.cjs", "watch": ["DATABASE_URL"], "expectation": "Existing preload value; dotenv candidate not applied; read links to startup with inferred confidence" },
|
|
6
|
+
{ "id": "runtime-mutation", "entry": "runtime-mutation/app.cjs", "watch": ["CONFIGTRACE_FIXTURE"], "expectation": "Read, write, delete, missing, empty and defineProperty observations" },
|
|
7
|
+
{ "id": "load-order", "entry": "load-order/app.cjs", "watch": ["CONFIGTRACE_FIXTURE"], "expectation": "Two file reads, first-wins merge, then override; merge provenance is inferred" },
|
|
8
|
+
{ "id": "custom-target", "entry": "custom-target/app.cjs", "watch": ["DATABASE_URL"], "expectation": "Custom target warning; no fictitious process.env assignment" },
|
|
9
|
+
{ "id": "child-process", "entry": "child-process/parent.cjs", "watch": ["CONFIGTRACE_FIXTURE"], "expectation": "With --children, root plus direct spawn and fork; no automatic cross-run process matching" },
|
|
10
|
+
{ "id": "worker", "entry": "worker/parent.cjs", "watch": ["CONFIGTRACE_FIXTURE"], "expectation": "One root stream; worker coverage explicitly unsupported" },
|
|
11
|
+
{ "id": "bypass", "entry": "bypass/app.cjs", "watch": ["CONFIGTRACE_FIXTURE"], "expectation": "Load early.cjs before ConfigTrace; original-object write is invisible; mismatched observed read remains unknown" },
|
|
12
|
+
{ "id": "exit-code", "entry": "exit-code/app.cjs", "watch": ["CONFIGTRACE_FIXTURE"], "expectation": "Application stdout, stderr and exit 17 preserved" },
|
|
13
|
+
{ "id": "esm", "entry": "esm/app.mjs", "watch": ["DATABASE_URL"], "expectation": "ESM default import of the cwd-resolved dotenv export receives the adapter" },
|
|
14
|
+
{ "id": "source-map", "entry": "source-map/input.ts", "watch": ["DATABASE_URL"], "expectation": "After separately compiling this fixture, --source-maps maps the read to input.ts line 3" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
2
|
+
const before = process.env.CONFIGTRACE_FIXTURE;
|
|
3
|
+
process.loadEnvFile(path.join(__dirname, 'sample.env'));
|
|
4
|
+
const after = process.env.CONFIGTRACE_FIXTURE;
|
|
5
|
+
// No raw values in fixture output.
|
|
6
|
+
console.log(JSON.stringify({ beforePresent: before !== undefined, afterPresent: after !== undefined }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CONFIGTRACE_FIXTURE=synthetic-native-env-value
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
2
|
+
process.env.CONFIGTRACE_FIXTURE = 'synthetic-replacement';
|
|
3
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
4
|
+
delete process.env.CONFIGTRACE_FIXTURE;
|
|
5
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
6
|
+
process.env.CONFIGTRACE_FIXTURE = '';
|
|
7
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
8
|
+
Object.defineProperty(process.env, 'CONFIGTRACE_FIXTURE', {
|
|
9
|
+
value: 'synthetic-definition', writable: true, configurable: true, enumerable: true,
|
|
10
|
+
});
|
|
11
|
+
void process.env.CONFIGTRACE_FIXTURE;
|
|
12
|
+
console.log('Mutation fixture completed.');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DATABASE_URL=postgres://fixture:synthetic-only@localhost/intended
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.3.0",
|
|
3
|
+
"validation": "not-run",
|
|
4
|
+
"fixtures": [
|
|
5
|
+
{
|
|
6
|
+
"name": "native-env",
|
|
7
|
+
"cases": [
|
|
8
|
+
"runtime apply",
|
|
9
|
+
"startup option declaration",
|
|
10
|
+
"existing-key skip inference",
|
|
11
|
+
"preserved native exception"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "worker-modes",
|
|
16
|
+
"cases": [
|
|
17
|
+
"copied",
|
|
18
|
+
"explicit",
|
|
19
|
+
"SHARE_ENV",
|
|
20
|
+
"execArgv override"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "failure-boundary",
|
|
25
|
+
"cases": [
|
|
26
|
+
"manual marker",
|
|
27
|
+
"post-marker reads",
|
|
28
|
+
"preserved exit 17"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { Worker, SHARE_ENV } = require('node:worker_threads');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
function once(mode, env) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const worker = new Worker(path.join(__dirname, 'worker.cjs'), { env, workerData: { mode }, execArgv: [] });
|
|
6
|
+
worker.once('error', reject);
|
|
7
|
+
worker.once('exit', code => code === 0 ? resolve() : reject(new Error('Fixture worker failed')));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
(async () => {
|
|
11
|
+
process.env.CONFIGTRACE_FIXTURE = 'synthetic-parent-value';
|
|
12
|
+
await once('copied', undefined);
|
|
13
|
+
await once('explicit', { CONFIGTRACE_FIXTURE: 'synthetic-explicit-value' });
|
|
14
|
+
await once('shared', SHARE_ENV);
|
|
15
|
+
const sharedWriteVisible = process.env.CONFIGTRACE_FIXTURE === 'synthetic-shared-value';
|
|
16
|
+
console.log(JSON.stringify({ sharedWriteVisible }));
|
|
17
|
+
})().catch(() => { process.exitCode = 1; });
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "configproof",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Local-first configuration provenance, runtime contracts, deterministic diagnosis, and read-only agent evidence for Node.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sonusharma26/configtrace.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/sonusharma26/configtrace#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/sonusharma26/configtrace/issues"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"type": "commonjs",
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
|
+
"bin": {
|
|
21
|
+
"configtrace": "dist/cli.js"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./preload": "./dist/runtime/preload.js",
|
|
29
|
+
"./adapter-api": {
|
|
30
|
+
"types": "./dist/runtime/api.d.ts",
|
|
31
|
+
"default": "./dist/runtime/api.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"fixtures",
|
|
37
|
+
"policies",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"docs/ARCHITECTURE.md",
|
|
41
|
+
"docs/COMPATIBILITY.md",
|
|
42
|
+
"docs/PRIVACY.md",
|
|
43
|
+
"docs/VALIDATION.md"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22.14.0 <23 || >=24 <25"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc -p tsconfig.json",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
51
|
+
"test": "node --test tests/*.test.cjs",
|
|
52
|
+
"demo": "node dist/cli.js demo stale-env",
|
|
53
|
+
"clean": "node scripts/clean.cjs"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"zod": "^3.25.76",
|
|
57
|
+
"yaml": "^2.8.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^22.18.0",
|
|
61
|
+
"dotenv": "17.2.3",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Configuration verification contract, not an export policy.
|
|
2
|
+
version: 1
|
|
3
|
+
coverage:
|
|
4
|
+
requireComplete: true
|
|
5
|
+
maxDroppedEvents: 0
|
|
6
|
+
requireFeatures:
|
|
7
|
+
- environment
|
|
8
|
+
rules:
|
|
9
|
+
DATABASE_URL:
|
|
10
|
+
required: true
|
|
11
|
+
read: required
|
|
12
|
+
immutableAfterFirstRead: true
|
|
13
|
+
minimumConfidence: inferred
|
|
14
|
+
allowedOrigins:
|
|
15
|
+
- startup
|
|
16
|
+
- "dotenv:.env.production"
|
|
17
|
+
- "native-env:.env.production"
|
|
18
|
+
NODE_ENV:
|
|
19
|
+
required: true
|
|
20
|
+
"TEMP_*":
|
|
21
|
+
read: forbidden
|
|
22
|
+
# Replace these example keys/origins with your application's captured identities.
|
|
23
|
+
# A wildcard with no captured matches is inconclusive, not a passing absence check.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Less restrictive than the built-in default, which pseudonymizes ALL key names.
|
|
2
|
+
# Review project filenames and the remaining key names before sharing.
|
|
3
|
+
paths: basename
|
|
4
|
+
keys:
|
|
5
|
+
redact:
|
|
6
|
+
- "CUSTOMER_*"
|
|
7
|
+
- "INTERNAL_*"
|
|
8
|
+
include:
|
|
9
|
+
callSites: true
|
|
10
|
+
loaders: true
|
|
11
|
+
comparisons: true
|
|
12
|
+
metadata: minimal
|