clinkx 1.3.0 → 1.4.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/CHANGELOG.md +28 -0
- package/README.md +13 -6
- package/clinkx-workflows/dist/child-env.d.ts +3 -0
- package/clinkx-workflows/dist/child-env.js +11 -0
- package/clinkx-workflows/dist/child-env.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/api-routes.d.ts +21 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js +27 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +13 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +27 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js +262 -23
- package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/auth/settings-step-up.d.ts +62 -0
- package/clinkx-workflows/dist/dashboard/auth/settings-step-up.js +70 -0
- package/clinkx-workflows/dist/dashboard/auth/settings-step-up.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/request-admission.d.ts +6 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js +9 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/server-factory.js +15 -1
- package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/settings-contract.d.ts +1806 -0
- package/clinkx-workflows/dist/dashboard/settings-contract.js +630 -0
- package/clinkx-workflows/dist/dashboard/settings-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/settings-process-reader.d.ts +48 -0
- package/clinkx-workflows/dist/dashboard/settings-process-reader.js +195 -0
- package/clinkx-workflows/dist/dashboard/settings-process-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/settings-routes.d.ts +87 -0
- package/clinkx-workflows/dist/dashboard/settings-routes.js +690 -0
- package/clinkx-workflows/dist/dashboard/settings-routes.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DSOtuS0p.js +122 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-C5guUjwN.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/durable-file-core.d.ts +76 -0
- package/clinkx-workflows/dist/durable-file-core.js +146 -0
- package/clinkx-workflows/dist/durable-file-core.js.map +1 -0
- package/clinkx-workflows/dist/durable-file.d.ts +8 -64
- package/clinkx-workflows/dist/durable-file.js +14 -137
- package/clinkx-workflows/dist/durable-file.js.map +1 -1
- package/clinkx-workflows/dist/index.js +68 -2
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/settings/audit.d.ts +101 -0
- package/clinkx-workflows/dist/settings/audit.js +318 -0
- package/clinkx-workflows/dist/settings/audit.js.map +1 -0
- package/clinkx-workflows/dist/settings/bootstrap.d.ts +35 -0
- package/clinkx-workflows/dist/settings/bootstrap.js +52 -0
- package/clinkx-workflows/dist/settings/bootstrap.js.map +1 -0
- package/clinkx-workflows/dist/settings/codec.d.ts +51 -0
- package/clinkx-workflows/dist/settings/codec.js +410 -0
- package/clinkx-workflows/dist/settings/codec.js.map +1 -0
- package/clinkx-workflows/dist/settings/durable-write.d.ts +48 -0
- package/clinkx-workflows/dist/settings/durable-write.js +31 -0
- package/clinkx-workflows/dist/settings/durable-write.js.map +1 -0
- package/clinkx-workflows/dist/settings/index.d.ts +20 -0
- package/clinkx-workflows/dist/settings/index.js +23 -0
- package/clinkx-workflows/dist/settings/index.js.map +1 -0
- package/clinkx-workflows/dist/settings/loader.d.ts +80 -0
- package/clinkx-workflows/dist/settings/loader.js +577 -0
- package/clinkx-workflows/dist/settings/loader.js.map +1 -0
- package/clinkx-workflows/dist/settings/lock.d.ts +108 -0
- package/clinkx-workflows/dist/settings/lock.js +344 -0
- package/clinkx-workflows/dist/settings/lock.js.map +1 -0
- package/clinkx-workflows/dist/settings/paths.d.ts +65 -0
- package/clinkx-workflows/dist/settings/paths.js +173 -0
- package/clinkx-workflows/dist/settings/paths.js.map +1 -0
- package/clinkx-workflows/dist/settings/process-heartbeat.d.ts +47 -0
- package/clinkx-workflows/dist/settings/process-heartbeat.js +305 -0
- package/clinkx-workflows/dist/settings/process-heartbeat.js.map +1 -0
- package/clinkx-workflows/dist/settings/registry.d.ts +178 -0
- package/clinkx-workflows/dist/settings/registry.js +1285 -0
- package/clinkx-workflows/dist/settings/registry.js.map +1 -0
- package/clinkx-workflows/dist/settings/schema.d.ts +404 -0
- package/clinkx-workflows/dist/settings/schema.js +415 -0
- package/clinkx-workflows/dist/settings/schema.js.map +1 -0
- package/clinkx-workflows/dist/settings/store.d.ts +157 -0
- package/clinkx-workflows/dist/settings/store.js +842 -0
- package/clinkx-workflows/dist/settings/store.js.map +1 -0
- package/clinkx-workflows/dist/stdio-entry.d.ts +2 -0
- package/clinkx-workflows/dist/stdio-entry.js +52 -0
- package/clinkx-workflows/dist/stdio-entry.js.map +1 -0
- package/dist/dashboard-cli.js +50 -1
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-companion/protocol.js +17 -0
- package/dist/dashboard-companion/protocol.js.map +1 -1
- package/dist/dashboard-gateway/control-plane/contracts.d.ts +38 -38
- package/dist/dashboard-gateway/tunnel-http.js +20 -0
- package/dist/dashboard-gateway/tunnel-http.js.map +1 -1
- package/dist/elaris/config.d.ts +10 -0
- package/dist/elaris/config.js +27 -1
- package/dist/elaris/config.js.map +1 -1
- package/dist/elaris/tools.js +4 -1
- package/dist/elaris/tools.js.map +1 -1
- package/dist/index.d.ts +0 -31
- package/dist/index.js +41 -404
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +17 -0
- package/dist/lib.js +17 -0
- package/dist/lib.js.map +1 -0
- package/dist/progress-report/lock.d.ts +17 -59
- package/dist/progress-report/lock.js +25 -329
- package/dist/progress-report/lock.js.map +1 -1
- package/dist/server.js +75 -4
- package/dist/server.js.map +1 -1
- package/dist/settings-cli/clients.d.ts +137 -0
- package/dist/settings-cli/clients.js +1124 -0
- package/dist/settings-cli/clients.js.map +1 -0
- package/dist/settings-cli/commands.d.ts +67 -0
- package/dist/settings-cli/commands.js +726 -0
- package/dist/settings-cli/commands.js.map +1 -0
- package/dist/settings-cli/format.d.ts +34 -0
- package/dist/settings-cli/format.js +40 -0
- package/dist/settings-cli/format.js.map +1 -0
- package/dist/settings-cli/main.d.ts +18 -0
- package/dist/settings-cli/main.js +256 -0
- package/dist/settings-cli/main.js.map +1 -0
- package/dist/stdio-main.d.ts +73 -0
- package/dist/stdio-main.js +455 -0
- package/dist/stdio-main.js.map +1 -0
- package/docs/configuration.md +340 -39
- package/docs/security.md +150 -6
- package/package.json +2 -2
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DRId2DVA.js +0 -119
- package/clinkx-workflows/dist/dashboard-ui/assets/style-CHAw57y5.css +0 -1
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup settings loader — A1-1.
|
|
3
|
+
*
|
|
4
|
+
* Applies the dashboard settings documents to an environment record BEFORE
|
|
5
|
+
* any consumer module reads it:
|
|
6
|
+
*
|
|
7
|
+
* 1. `CLINKX_SETTINGS=off` short-circuits with ZERO filesystem reads.
|
|
8
|
+
* 2. Resolve the settings directory (paths.ts; an invalid override behaves
|
|
9
|
+
* as "absent" with a warning — the server always starts).
|
|
10
|
+
* 3. Read `settings.json` and `secrets.json` with a hardened reader:
|
|
11
|
+
* no-follow, regular-file-only, hard 256 KiB cap (contained-file.ts is
|
|
12
|
+
* deliberately NOT used — it imports child_process, far too heavy for the
|
|
13
|
+
* pre-logger bootstrap).
|
|
14
|
+
* 4. Per registry key: explicit env wins (an empty value and legacy-alias
|
|
15
|
+
* presence count as env-present, OQ-3); a VALID file value is filled with
|
|
16
|
+
* the consumer's exact legacy encoding (amendment 1 — never a registry
|
|
17
|
+
* default); an INVALID file value follows the registry `onInvalid` policy
|
|
18
|
+
* (tuning → no fill + warning; policy → the restrictive value via
|
|
19
|
+
* encodeInvalidFillValue; ALLOWED_ROOTS → never filled, OQ-8).
|
|
20
|
+
* Document classification goes through the one shared classifier
|
|
21
|
+
* (`classifySettingsDocument`, DECISIONS-R R4): per-key tolerance, secret
|
|
22
|
+
* class keys reported by name only, and prototype-shaped names kept as
|
|
23
|
+
* unknown raw entries on null-prototype records (S1).
|
|
24
|
+
* 5. Cross-key `requires` (amendment 2): an enable flag turned on BY THE FILE
|
|
25
|
+
* whose required companion is neither env-present nor carrying a usable
|
|
26
|
+
* valid file value (an encoding that trims to "" is NOT usable) is forced
|
|
27
|
+
* to its restrictive value with a warning.
|
|
28
|
+
* 6. Whole-document unreadable/unsupported ⇒ behaves as absent + warning
|
|
29
|
+
* (OQ-2) — NO fills at all, restrictive or otherwise.
|
|
30
|
+
* 7. File/secrets fills are staged in a local null-prototype overlay and
|
|
31
|
+
* assigned to `env` in ONE step after every loop completes, so a throw
|
|
32
|
+
* anywhere above can never leave a partially applied overlay (S1).
|
|
33
|
+
*
|
|
34
|
+
* `secrets.json` is read only when its mode has no group/other bits; secret
|
|
35
|
+
* values fill the environment exactly like any other file value but are
|
|
36
|
+
* NEVER recorded in the returned application (no `effective`, no equality
|
|
37
|
+
* flag) and never echoed in warnings.
|
|
38
|
+
*
|
|
39
|
+
* `CLINKX_ELARIS_API_KEY_ENV` may name a NON-secret registry key; that key's
|
|
40
|
+
* value is then the Elaris credential, so its provenance is likewise reduced
|
|
41
|
+
* to the bare source plus `withheld: true` (L7). The indirection itself is
|
|
42
|
+
* env-only — the registry's exclusion list keeps it out of the settings file,
|
|
43
|
+
* which therefore can never designate a target. Runtime env, the overlay and
|
|
44
|
+
* precedence are untouched — only the reported application is reduced.
|
|
45
|
+
*
|
|
46
|
+
* This module never logs and never throws; every diagnostic lands in the
|
|
47
|
+
* returned `warnings` (bounded to the heartbeat schema limits). Import
|
|
48
|
+
* closure: registry/schema/codec/paths + node built-ins only — no logger,
|
|
49
|
+
* no config, no pino (the bootstrap import-graph test walks it).
|
|
50
|
+
*/
|
|
51
|
+
import { createHash } from "node:crypto";
|
|
52
|
+
import { constants as fsConstants } from "node:fs";
|
|
53
|
+
import { closeSync, fstatSync, lstatSync, openSync, readSync } from "node:fs";
|
|
54
|
+
import { SETTINGS_KEYS, SETTINGS_OFF_ENV, classifySettingsEnvName, getSettingDescriptor, isSecretSettingKey, } from "./registry.js";
|
|
55
|
+
import { encodeInvalidFillValue, encodeSettingValue, legacyParseSetting, validateSettingValue, } from "./codec.js";
|
|
56
|
+
import { MAX_PROCESS_HEARTBEAT_UNKNOWN_ENV_KEYS, MAX_PROCESS_HEARTBEAT_WARNING_CHARS, MAX_PROCESS_HEARTBEAT_WARNINGS, SETTINGS_DOCUMENT_SCHEMA_VERSION, classifySettingsDocument, parseSecretsDocument, } from "./schema.js";
|
|
57
|
+
import { resolveSettingsDir, secretsFilePath, settingsFilePath } from "./paths.js";
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Hardened file reader (no contained-file.ts — it imports child_process)
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
/** Hard per-file cap, applied before any byte is read. */
|
|
62
|
+
export const MAX_SETTINGS_FILE_BYTES = 256 * 1024;
|
|
63
|
+
function errnoToCode(error) {
|
|
64
|
+
const code = typeof error === "object" && error !== null && "code" in error
|
|
65
|
+
? String(error.code)
|
|
66
|
+
: "";
|
|
67
|
+
return code === "ENOENT" ? "MISSING" : "UNREADABLE";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* lstat (no follow) → open O_NOFOLLOW|O_NONBLOCK → fstat regular-file check
|
|
71
|
+
* → capped read. O_NONBLOCK makes an open of a swapped-in FIFO harmless
|
|
72
|
+
* (open-for-read returns immediately instead of blocking); regular files
|
|
73
|
+
* ignore it. A symlink is refused by the lstat gate and again by O_NOFOLLOW.
|
|
74
|
+
*/
|
|
75
|
+
export function createNodeSettingsFileReader() {
|
|
76
|
+
const flags = fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK;
|
|
77
|
+
return (path) => {
|
|
78
|
+
let stats;
|
|
79
|
+
try {
|
|
80
|
+
stats = lstatSync(path);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
return { ok: false, code: errnoToCode(error) };
|
|
84
|
+
}
|
|
85
|
+
if (stats.isSymbolicLink())
|
|
86
|
+
return { ok: false, code: "SYMLINK" };
|
|
87
|
+
if (!stats.isFile())
|
|
88
|
+
return { ok: false, code: "NOT_REGULAR" };
|
|
89
|
+
if (stats.size > MAX_SETTINGS_FILE_BYTES)
|
|
90
|
+
return { ok: false, code: "TOO_LARGE" };
|
|
91
|
+
let fd;
|
|
92
|
+
try {
|
|
93
|
+
fd = openSync(path, flags);
|
|
94
|
+
const openStats = fstatSync(fd);
|
|
95
|
+
if (!openStats.isFile())
|
|
96
|
+
return { ok: false, code: "NOT_REGULAR" };
|
|
97
|
+
if (openStats.size > MAX_SETTINGS_FILE_BYTES)
|
|
98
|
+
return { ok: false, code: "TOO_LARGE" };
|
|
99
|
+
const buffer = Buffer.alloc(openStats.size);
|
|
100
|
+
let offset = 0;
|
|
101
|
+
while (offset < buffer.length) {
|
|
102
|
+
const read = readSync(fd, buffer, offset, buffer.length - offset, null);
|
|
103
|
+
if (read === 0)
|
|
104
|
+
break;
|
|
105
|
+
offset += read;
|
|
106
|
+
}
|
|
107
|
+
const bytes = offset === buffer.length ? buffer : buffer.subarray(0, offset);
|
|
108
|
+
return { ok: true, bytes: new Uint8Array(bytes), mode: openStats.mode };
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return { ok: false, code: errnoToCode(error) };
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
if (fd !== undefined) {
|
|
115
|
+
try {
|
|
116
|
+
closeSync(fd);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// The read already failed or succeeded; a close failure adds nothing.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Bounding helpers (match the clinkx-settings-process-v1 heartbeat limits)
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
function truncateWarning(message) {
|
|
129
|
+
if (message.length <= MAX_PROCESS_HEARTBEAT_WARNING_CHARS)
|
|
130
|
+
return message;
|
|
131
|
+
return `${message.slice(0, MAX_PROCESS_HEARTBEAT_WARNING_CHARS - 3)}...`;
|
|
132
|
+
}
|
|
133
|
+
function boundWarnings(raw) {
|
|
134
|
+
const warnings = raw.map(truncateWarning);
|
|
135
|
+
if (warnings.length <= MAX_PROCESS_HEARTBEAT_WARNINGS)
|
|
136
|
+
return warnings;
|
|
137
|
+
const dropped = warnings.length - (MAX_PROCESS_HEARTBEAT_WARNINGS - 1);
|
|
138
|
+
return [
|
|
139
|
+
...warnings.slice(0, MAX_PROCESS_HEARTBEAT_WARNINGS - 1),
|
|
140
|
+
`(+${dropped} more settings warnings)`,
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// Small utilities
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
function readOwn(record, key) {
|
|
147
|
+
return Object.prototype.hasOwnProperty.call(record, key) ? record[key] : undefined;
|
|
148
|
+
}
|
|
149
|
+
function sha256Hex(bytes) {
|
|
150
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
151
|
+
}
|
|
152
|
+
function decodeUtf8(bytes) {
|
|
153
|
+
return Buffer.from(bytes).toString("utf8");
|
|
154
|
+
}
|
|
155
|
+
function valuesEqual(a, b) {
|
|
156
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
157
|
+
return a.length === b.length && a.every((entry, index) => entry === b[index]);
|
|
158
|
+
}
|
|
159
|
+
return a === b;
|
|
160
|
+
}
|
|
161
|
+
/** Registry-key → raw env value (canonical name, else first present alias). */
|
|
162
|
+
function computeEnvPresence(snapshot) {
|
|
163
|
+
const presence = new Map();
|
|
164
|
+
for (const key of SETTINGS_KEYS) {
|
|
165
|
+
const descriptor = getSettingDescriptor(key);
|
|
166
|
+
if (descriptor == null)
|
|
167
|
+
continue;
|
|
168
|
+
const own = readOwn(snapshot, key);
|
|
169
|
+
if (own !== undefined) {
|
|
170
|
+
presence.set(key, own);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
for (const alias of descriptor.legacyAliases ?? []) {
|
|
174
|
+
const aliasValue = readOwn(snapshot, alias);
|
|
175
|
+
if (aliasValue !== undefined) {
|
|
176
|
+
presence.set(key, aliasValue);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return presence;
|
|
182
|
+
}
|
|
183
|
+
function collectUnknownEnvKeys(snapshot, warnings) {
|
|
184
|
+
const unknown = [];
|
|
185
|
+
for (const name of Object.keys(snapshot)) {
|
|
186
|
+
if (!name.startsWith("CLINKX") || !/^[A-Z0-9_]+$/.test(name))
|
|
187
|
+
continue;
|
|
188
|
+
if (classifySettingsEnvName(name) === undefined)
|
|
189
|
+
unknown.push(name);
|
|
190
|
+
}
|
|
191
|
+
unknown.sort();
|
|
192
|
+
if (unknown.length > MAX_PROCESS_HEARTBEAT_UNKNOWN_ENV_KEYS) {
|
|
193
|
+
const dropped = unknown.length - MAX_PROCESS_HEARTBEAT_UNKNOWN_ENV_KEYS;
|
|
194
|
+
unknown.length = MAX_PROCESS_HEARTBEAT_UNKNOWN_ENV_KEYS;
|
|
195
|
+
warnings.push(`(+${dropped} more unknown CLINKX_* environment names not listed)`);
|
|
196
|
+
}
|
|
197
|
+
return unknown;
|
|
198
|
+
}
|
|
199
|
+
function readSettingsDocument(reader, dir) {
|
|
200
|
+
const read = reader(settingsFilePath(dir));
|
|
201
|
+
if (!read.ok) {
|
|
202
|
+
if (read.code === "MISSING") {
|
|
203
|
+
return { state: "absent", values: {}, invalidKeys: new Map(), warnings: [] };
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
state: "unreadable",
|
|
207
|
+
values: {},
|
|
208
|
+
invalidKeys: new Map(),
|
|
209
|
+
warnings: [
|
|
210
|
+
`settings document could not be read (${read.code}); treating settings as absent`,
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const digest = sha256Hex(read.bytes);
|
|
215
|
+
let parsedJson;
|
|
216
|
+
try {
|
|
217
|
+
parsedJson = JSON.parse(decodeUtf8(read.bytes));
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return {
|
|
221
|
+
state: "unreadable",
|
|
222
|
+
values: {},
|
|
223
|
+
invalidKeys: new Map(),
|
|
224
|
+
digest,
|
|
225
|
+
warnings: ["settings document is not valid JSON; treating settings as absent"],
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// The one shared classifier (DECISIONS-R R4). It reads `values` from the
|
|
229
|
+
// ORIGINAL JSON.parse result — a zod-rebuilt record would re-parent an own
|
|
230
|
+
// `"__proto__"` entry — and returns null-prototype records, so prototype-
|
|
231
|
+
// shaped names stay unknown raw entries and are never dereferenced (S1).
|
|
232
|
+
const classified = classifySettingsDocument(parsedJson);
|
|
233
|
+
if (classified.status === "unsupported") {
|
|
234
|
+
// Scalars survive the zod rebuild; read the found version for the warning.
|
|
235
|
+
const found = typeof parsedJson === "object" && parsedJson !== null
|
|
236
|
+
? parsedJson.schema_version
|
|
237
|
+
: undefined;
|
|
238
|
+
return {
|
|
239
|
+
state: "absent",
|
|
240
|
+
values: {},
|
|
241
|
+
invalidKeys: new Map(),
|
|
242
|
+
digest,
|
|
243
|
+
warnings: [
|
|
244
|
+
`settings document schema_version ${JSON.stringify(found)} is not supported (expected ${SETTINGS_DOCUMENT_SCHEMA_VERSION}); treating settings as absent`,
|
|
245
|
+
],
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (classified.status === "shape_invalid") {
|
|
249
|
+
return {
|
|
250
|
+
state: "unreadable",
|
|
251
|
+
values: {},
|
|
252
|
+
invalidKeys: new Map(),
|
|
253
|
+
digest,
|
|
254
|
+
warnings: ["settings document has an invalid shape; treating settings as absent"],
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
// Per-key tolerance (owner decision 7): unknown keys and secret-class keys
|
|
258
|
+
// warn by NAME only; invalid known keys surface in `invalid` and are handed
|
|
259
|
+
// to the per-key onInvalid policy in the main resolution loop below.
|
|
260
|
+
const warnings = [];
|
|
261
|
+
for (const key of Object.keys(classified.unknownRaw)) {
|
|
262
|
+
warnings.push(`settings file: unknown settings key ${key} ignored (written by a newer ClinkX?)`);
|
|
263
|
+
}
|
|
264
|
+
for (const key of classified.secretClassKeys) {
|
|
265
|
+
warnings.push(`settings file: ${key} is a secret-class key; secrets belong in secrets.json; ignored`);
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
state: "loaded",
|
|
269
|
+
values: classified.valid,
|
|
270
|
+
invalidKeys: classified.invalid,
|
|
271
|
+
revision: classified.revision,
|
|
272
|
+
digest,
|
|
273
|
+
warnings,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function secretsUnreadable(warnings) {
|
|
277
|
+
return { state: "unreadable", revision: null, values: {}, warnings };
|
|
278
|
+
}
|
|
279
|
+
function readSecretsDocument(reader, dir) {
|
|
280
|
+
const read = reader(secretsFilePath(dir));
|
|
281
|
+
if (!read.ok) {
|
|
282
|
+
if (read.code === "MISSING") {
|
|
283
|
+
return { state: "absent", revision: null, values: {}, warnings: [] };
|
|
284
|
+
}
|
|
285
|
+
return secretsUnreadable([
|
|
286
|
+
`secrets document could not be read (${read.code}); secrets not applied`,
|
|
287
|
+
]);
|
|
288
|
+
}
|
|
289
|
+
if ((read.mode & 0o077) !== 0) {
|
|
290
|
+
return secretsUnreadable([
|
|
291
|
+
`secrets.json permissions are too open (mode ${(read.mode & 0o777).toString(8).padStart(3, "0")}); refusing to read it — expected no group/other bits (0600); secrets not applied`,
|
|
292
|
+
]);
|
|
293
|
+
}
|
|
294
|
+
let parsedJson;
|
|
295
|
+
try {
|
|
296
|
+
parsedJson = JSON.parse(decodeUtf8(read.bytes));
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
return secretsUnreadable(["secrets document is not valid JSON; secrets not applied"]);
|
|
300
|
+
}
|
|
301
|
+
const parse = parseSecretsDocument(parsedJson);
|
|
302
|
+
if (parse.status === "unsupported") {
|
|
303
|
+
return secretsUnreadable([
|
|
304
|
+
`secrets document schema_version ${JSON.stringify(parse.found)} is not supported; secrets not applied`,
|
|
305
|
+
]);
|
|
306
|
+
}
|
|
307
|
+
if (parse.status === "invalid") {
|
|
308
|
+
return secretsUnreadable([
|
|
309
|
+
`secrets document is invalid (${parse.issues.map((issue) => issue.key).join(", ")}); secrets not applied`,
|
|
310
|
+
]);
|
|
311
|
+
}
|
|
312
|
+
const values = {};
|
|
313
|
+
const warnings = [];
|
|
314
|
+
for (const [key, entry] of Object.entries(parse.document.entries)) {
|
|
315
|
+
const descriptor = getSettingDescriptor(key);
|
|
316
|
+
if (descriptor == null)
|
|
317
|
+
continue;
|
|
318
|
+
const error = validateSettingValue(descriptor, entry.value);
|
|
319
|
+
if (error == null)
|
|
320
|
+
values[key] = entry.value;
|
|
321
|
+
else
|
|
322
|
+
warnings.push(`secrets file: ${key} has an invalid value; not applied`);
|
|
323
|
+
}
|
|
324
|
+
return { state: "loaded", revision: parse.document.revision, values, warnings };
|
|
325
|
+
}
|
|
326
|
+
function defaultValueSpelling(descriptor) {
|
|
327
|
+
return encodeSettingValue(descriptor, descriptor.default);
|
|
328
|
+
}
|
|
329
|
+
// ---------------------------------------------------------------------------
|
|
330
|
+
// Credential-indirection withholding (L7)
|
|
331
|
+
// ---------------------------------------------------------------------------
|
|
332
|
+
/**
|
|
333
|
+
* `CLINKX_ELARIS_API_KEY_ENV` names the env var holding the Elaris credential.
|
|
334
|
+
* The indirection is env-only: the registry's ENV_ONLY exclusion list keeps
|
|
335
|
+
* the name out of the settings file (a file entry for it is ignored as an
|
|
336
|
+
* unknown key), so only the env snapshot can designate a target. When it
|
|
337
|
+
* names an ordinary NON-secret registry key, that key's value IS the
|
|
338
|
+
* credential for this process, so its provenance must never carry the value
|
|
339
|
+
* or an env/file equality hint — the rule secret-class keys already follow.
|
|
340
|
+
* Resolution mirrors `src/elaris/config.ts` (trimmed; empty/unset ignored).
|
|
341
|
+
* A secret-class, unknown or excluded target changes nothing.
|
|
342
|
+
*/
|
|
343
|
+
const ELARIS_API_KEY_INDIRECTION_ENV = "CLINKX_ELARIS_API_KEY_ENV";
|
|
344
|
+
function credentialIndirectionKey(snapshot) {
|
|
345
|
+
const raw = readOwn(snapshot, ELARIS_API_KEY_INDIRECTION_ENV);
|
|
346
|
+
if (raw === undefined)
|
|
347
|
+
return undefined;
|
|
348
|
+
const trimmed = raw.trim();
|
|
349
|
+
if (trimmed === "")
|
|
350
|
+
return undefined;
|
|
351
|
+
const classification = classifySettingsEnvName(trimmed);
|
|
352
|
+
if (classification == null || classification.kind === "excluded")
|
|
353
|
+
return undefined;
|
|
354
|
+
const key = classification.kind === "alias" ? classification.of : classification.key;
|
|
355
|
+
return isSecretSettingKey(key) ? undefined : key;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* L7: reduce the credential-indirection target's provenance to its bare
|
|
359
|
+
* source plus `withheld: true` — one post-processing step over `perKey`,
|
|
360
|
+
* after every branch has written its entry. Env, the overlay and precedence
|
|
361
|
+
* are untouched.
|
|
362
|
+
*/
|
|
363
|
+
function applyCredentialIndirectionWithholding(perKey, target) {
|
|
364
|
+
if (target === undefined)
|
|
365
|
+
return;
|
|
366
|
+
const entry = perKey[target];
|
|
367
|
+
if (entry == null)
|
|
368
|
+
return;
|
|
369
|
+
perKey[target] = { source: entry.source, withheld: true };
|
|
370
|
+
}
|
|
371
|
+
/** Provenance when NO file value can apply (off / absent / unreadable). */
|
|
372
|
+
function buildEnvOnlyProvenance(presence, withheldKey) {
|
|
373
|
+
const perKey = {};
|
|
374
|
+
for (const key of SETTINGS_KEYS) {
|
|
375
|
+
const descriptor = getSettingDescriptor(key);
|
|
376
|
+
if (descriptor == null)
|
|
377
|
+
continue;
|
|
378
|
+
const envRaw = presence.get(key);
|
|
379
|
+
if (envRaw !== undefined) {
|
|
380
|
+
perKey[key] = isSecretSettingKey(key)
|
|
381
|
+
? { source: "env" }
|
|
382
|
+
: { source: "env", effective: envRaw };
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
perKey[key] = isSecretSettingKey(key)
|
|
386
|
+
? { source: "default" }
|
|
387
|
+
: { source: "default", effective: defaultValueSpelling(descriptor) };
|
|
388
|
+
}
|
|
389
|
+
applyCredentialIndirectionWithholding(perKey, withheldKey);
|
|
390
|
+
return perKey;
|
|
391
|
+
}
|
|
392
|
+
function stripKeyPrefix(key, error) {
|
|
393
|
+
const prefix = `${key}: `;
|
|
394
|
+
return error.startsWith(prefix) ? error.slice(prefix.length) : error;
|
|
395
|
+
}
|
|
396
|
+
// ---------------------------------------------------------------------------
|
|
397
|
+
// Main entry
|
|
398
|
+
// ---------------------------------------------------------------------------
|
|
399
|
+
/**
|
|
400
|
+
* Load the settings documents and overlay them onto `env` (mutated). Fills
|
|
401
|
+
* only VALID file values for keys absent from the pre-start env snapshot —
|
|
402
|
+
* never registry defaults (amendment 1). Never throws.
|
|
403
|
+
*/
|
|
404
|
+
export function runStartupSettingsLoad(env, options = {}) {
|
|
405
|
+
const snapshot = options.envSnapshot ?? env;
|
|
406
|
+
const reader = options.reader ?? createNodeSettingsFileReader();
|
|
407
|
+
const warnings = [];
|
|
408
|
+
const unknownEnvKeys = collectUnknownEnvKeys(snapshot, warnings);
|
|
409
|
+
const presence = computeEnvPresence(snapshot);
|
|
410
|
+
// L7: the indirection is env-only (the settings file can never set it), so
|
|
411
|
+
// this one snapshot lookup is authoritative for every branch below.
|
|
412
|
+
const withheldKey = credentialIndirectionKey(snapshot);
|
|
413
|
+
// Fast path: no filesystem read of any kind.
|
|
414
|
+
if (readOwn(snapshot, SETTINGS_OFF_ENV) === "off") {
|
|
415
|
+
return {
|
|
416
|
+
state: "off",
|
|
417
|
+
settingsDir: "",
|
|
418
|
+
perKey: buildEnvOnlyProvenance(presence, withheldKey),
|
|
419
|
+
unknownEnvKeys,
|
|
420
|
+
warnings: boundWarnings(warnings),
|
|
421
|
+
secretsRevision: null,
|
|
422
|
+
secretsState: "off",
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
try {
|
|
426
|
+
const dirResolution = resolveSettingsDir({ env: snapshot });
|
|
427
|
+
if (dirResolution.dir === "") {
|
|
428
|
+
warnings.push(dirResolution.warning ?? "settings directory is not usable; treating settings as absent");
|
|
429
|
+
return {
|
|
430
|
+
state: "absent",
|
|
431
|
+
settingsDir: "",
|
|
432
|
+
perKey: buildEnvOnlyProvenance(presence, withheldKey),
|
|
433
|
+
unknownEnvKeys,
|
|
434
|
+
warnings: boundWarnings(warnings),
|
|
435
|
+
secretsRevision: null,
|
|
436
|
+
secretsState: "absent",
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
const dir = dirResolution.dir;
|
|
440
|
+
const document = readSettingsDocument(reader, dir);
|
|
441
|
+
warnings.push(...document.warnings);
|
|
442
|
+
const secrets = readSecretsDocument(reader, dir);
|
|
443
|
+
warnings.push(...secrets.warnings);
|
|
444
|
+
const perKey = {};
|
|
445
|
+
const fileFilledKeys = new Map();
|
|
446
|
+
// Staged overlay (S1): every file/secrets fill lands in this local
|
|
447
|
+
// null-prototype record first; env is mutated in ONE assignment after all
|
|
448
|
+
// loops complete, so a throw anywhere above leaves env untouched instead
|
|
449
|
+
// of partially overlaid.
|
|
450
|
+
const overlay = Object.create(null);
|
|
451
|
+
for (const key of SETTINGS_KEYS) {
|
|
452
|
+
const descriptor = getSettingDescriptor(key);
|
|
453
|
+
if (descriptor == null)
|
|
454
|
+
continue;
|
|
455
|
+
const secret = isSecretSettingKey(key);
|
|
456
|
+
const envRaw = presence.get(key);
|
|
457
|
+
if (envRaw !== undefined) {
|
|
458
|
+
// Explicit env wins — including an empty value (OQ-3).
|
|
459
|
+
const entry = { source: "env" };
|
|
460
|
+
if (!secret) {
|
|
461
|
+
entry.effective = envRaw;
|
|
462
|
+
const fileValue = document.values[key];
|
|
463
|
+
if (fileValue !== undefined) {
|
|
464
|
+
const parsedEnv = legacyParseSetting(descriptor, envRaw);
|
|
465
|
+
entry.envEqualsFile =
|
|
466
|
+
parsedEnv.ok && valuesEqual(parsedEnv.value, fileValue);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
perKey[key] = entry;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
const fileValue = document.values[key];
|
|
473
|
+
if (fileValue !== undefined) {
|
|
474
|
+
// Valid file value: fill with the exact legacy encoding.
|
|
475
|
+
const encoded = encodeSettingValue(descriptor, fileValue);
|
|
476
|
+
overlay[key] = encoded;
|
|
477
|
+
if (secret) {
|
|
478
|
+
perKey[key] = { source: "file" };
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
perKey[key] = { source: "file", effective: encoded };
|
|
482
|
+
fileFilledKeys.set(key, fileValue);
|
|
483
|
+
}
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
const invalidReason = document.invalidKeys.get(key);
|
|
487
|
+
if (invalidReason !== undefined) {
|
|
488
|
+
// Owner decision 7 / OQ-8: tuning (and ALLOWED_ROOTS) → no fill;
|
|
489
|
+
// policy → the registry restrictive value.
|
|
490
|
+
const reason = stripKeyPrefix(key, invalidReason);
|
|
491
|
+
const fill = encodeInvalidFillValue(descriptor);
|
|
492
|
+
const entry = { source: "invalid_fallback" };
|
|
493
|
+
if (fill !== undefined && !secret) {
|
|
494
|
+
overlay[key] = fill;
|
|
495
|
+
entry.effective = fill;
|
|
496
|
+
warnings.push(`settings file: ${key} has an invalid value (${reason}); filled the restrictive value "${fill}"`);
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
if (!secret)
|
|
500
|
+
entry.effective = defaultValueSpelling(descriptor);
|
|
501
|
+
warnings.push(`settings file: ${key} has an invalid value (${reason}); not filled (the consumer default applies)`);
|
|
502
|
+
}
|
|
503
|
+
perKey[key] = entry;
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
perKey[key] = secret
|
|
507
|
+
? { source: "default" }
|
|
508
|
+
: { source: "default", effective: defaultValueSpelling(descriptor) };
|
|
509
|
+
}
|
|
510
|
+
// Secret values fill env exactly like other file values (absent-from-env
|
|
511
|
+
// only) and are never recorded beyond the bare source.
|
|
512
|
+
for (const [key, value] of Object.entries(secrets.values)) {
|
|
513
|
+
if (presence.get(key) !== undefined)
|
|
514
|
+
continue;
|
|
515
|
+
overlay[key] = value;
|
|
516
|
+
perKey[key] = { source: "file" };
|
|
517
|
+
}
|
|
518
|
+
// Cross-key `requires` (amendment 2): an enable flag turned on by the
|
|
519
|
+
// file whose companion is unresolvable falls back to its restrictive
|
|
520
|
+
// value. Env-present (OQ-3: "" counts) or a usable valid file value
|
|
521
|
+
// resolves the companion; an encoding that trims to "" — the url "unset"
|
|
522
|
+
// grammar accepts whitespace-only spellings — does not.
|
|
523
|
+
for (const [key, value] of fileFilledKeys) {
|
|
524
|
+
const descriptor = getSettingDescriptor(key);
|
|
525
|
+
if (descriptor == null || descriptor.requires == null)
|
|
526
|
+
continue;
|
|
527
|
+
if (descriptor.type !== "bool" ||
|
|
528
|
+
value !== true ||
|
|
529
|
+
descriptor.onInvalid === "default" ||
|
|
530
|
+
descriptor.onInvalid.restrictive !== false) {
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
const missing = descriptor.requires.filter((required) => {
|
|
534
|
+
if (presence.get(required) !== undefined)
|
|
535
|
+
return false;
|
|
536
|
+
const requiredDescriptor = getSettingDescriptor(required);
|
|
537
|
+
const requiredValue = requiredDescriptor == null ? undefined : document.values[required];
|
|
538
|
+
if (requiredDescriptor == null || requiredValue === undefined)
|
|
539
|
+
return true;
|
|
540
|
+
return encodeSettingValue(requiredDescriptor, requiredValue).trim() === "";
|
|
541
|
+
});
|
|
542
|
+
if (missing.length === 0)
|
|
543
|
+
continue;
|
|
544
|
+
overlay[key] = "false";
|
|
545
|
+
perKey[key] = { source: "file", effective: "false" };
|
|
546
|
+
warnings.push(`${key}=true from the settings file requires ${missing.join(", ")} to be set in the environment or valid in the settings file; filled the restrictive value "false"`);
|
|
547
|
+
}
|
|
548
|
+
applyCredentialIndirectionWithholding(perKey, withheldKey);
|
|
549
|
+
Object.assign(env, overlay);
|
|
550
|
+
return {
|
|
551
|
+
state: document.state,
|
|
552
|
+
settingsDir: dir,
|
|
553
|
+
...(document.revision !== undefined ? { revision: document.revision } : {}),
|
|
554
|
+
...(document.digest !== undefined ? { digest: document.digest } : {}),
|
|
555
|
+
secretsRevision: secrets.revision,
|
|
556
|
+
secretsState: secrets.state,
|
|
557
|
+
perKey,
|
|
558
|
+
unknownEnvKeys,
|
|
559
|
+
warnings: boundWarnings(warnings),
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
catch (error) {
|
|
563
|
+
return {
|
|
564
|
+
state: "unreadable",
|
|
565
|
+
settingsDir: "",
|
|
566
|
+
perKey: buildEnvOnlyProvenance(presence, withheldKey),
|
|
567
|
+
unknownEnvKeys,
|
|
568
|
+
warnings: boundWarnings([
|
|
569
|
+
...warnings,
|
|
570
|
+
`settings load failed unexpectedly: ${error instanceof Error ? error.message : String(error)}; treating settings as absent`,
|
|
571
|
+
]),
|
|
572
|
+
secretsRevision: null,
|
|
573
|
+
secretsState: "unreadable",
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/settings/loader.ts"],"names":[],"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