@rcpooley/concord 0.5.6 → 0.6.1

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.
@@ -0,0 +1,395 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import { decryptsToNonEmpty, recipientOf } from './age.js';
6
+ import { summarize } from './plans.js';
7
+ import { newRecordId, RecordStore } from './records.js';
8
+ import { parseSecretsFile, renderSecretsFile, validSecretName } from './secrets-file.js';
9
+ /**
10
+ * The Secrets page's back end: add or rotate a secret in the config repo
11
+ * without its plaintext ever passing through a shell, a chat or this process's
12
+ * logs.
13
+ *
14
+ * 1. The CLIENT encrypts the value to the daemon's age recipient. Only
15
+ * ciphertext arrives here — the same thing anyone holding age.pub can
16
+ * already produce, so this endpoint grants nothing new.
17
+ * 2. The change is committed on its own branch (`secrets/<name>`, built on
18
+ * main) in this service's own clone, pushed, and planned like any branch.
19
+ * 3. Deploy pushes that commit to main — a fast-forward, never a force. If
20
+ * main has moved since, the change is rebuilt on the new main and planned
21
+ * again, because a plan is only ever of the exact commit that would land.
22
+ *
23
+ * Write-only, always: nothing here returns a value, and there is deliberately
24
+ * no code path that could. Reading a secret stays the reconciler's job alone.
25
+ *
26
+ * Like plans, this is never load-bearing. Its clone is its own (never the
27
+ * daemon's checkout), and if it breaks, `concord secret set` still works.
28
+ */
29
+ export class SecretError extends Error {
30
+ status;
31
+ constructor(message, status) {
32
+ super(message);
33
+ this.status = status;
34
+ }
35
+ }
36
+ const execFileAsync = promisify(execFile);
37
+ /** How long a fetch of main is reused by GET /api/secrets, which the UI polls. */
38
+ const FETCH_TTL_MS = 5_000;
39
+ /** A ciphertext this long is not a secret value someone typed in. */
40
+ const MAX_CIPHERTEXT = 48 * 1024;
41
+ export class SecretService {
42
+ #opts;
43
+ #store;
44
+ #queue = Promise.resolve();
45
+ #fetchedAt = 0;
46
+ #recipient;
47
+ constructor(opts) {
48
+ const key = opts.push?.sshKey;
49
+ if (key !== undefined && (key.includes("'") || !key.startsWith('/'))) {
50
+ throw new Error(`the push key must be an absolute path without quotes: ${key}`);
51
+ }
52
+ this.#opts = {
53
+ mainBranch: 'main',
54
+ author: { name: 'Concord secrets', email: 'concord@localhost' },
55
+ ...opts,
56
+ };
57
+ this.#store = new RecordStore(join(opts.root, 'records'), opts.keep ?? 100);
58
+ }
59
+ get #checkout() {
60
+ return join(this.#opts.root, 'config');
61
+ }
62
+ get #main() {
63
+ return `refs/remotes/origin/${this.#opts.mainBranch}`;
64
+ }
65
+ recipient() {
66
+ this.#recipient ??= recipientOf(this.#opts.identity);
67
+ return this.#recipient;
68
+ }
69
+ // ------------------------------------------------------------------ read ---
70
+ /** Names on main, where each is used, and recent changes. Never a value. */
71
+ list(limit = 20) {
72
+ return this.#serial(async () => {
73
+ const recipient = await this.recipient();
74
+ await this.#sync(false);
75
+ const mainSha = await this.#rev(this.#main);
76
+ const names = Object.keys(await this.#secretsAt(mainSha)).sort();
77
+ const used = await this.#references(mainSha, new Set(names));
78
+ const secrets = names.map((name) => ({ name, usedBy: used.get(name) ?? [] }));
79
+ const reason = await this.#unwritable(mainSha);
80
+ return {
81
+ recipient,
82
+ writable: !reason,
83
+ ...(reason ? { reason } : {}),
84
+ mainSha,
85
+ secrets,
86
+ changes: this.#store.list(limit).map((c) => this.#view(c)),
87
+ };
88
+ });
89
+ }
90
+ get(id) {
91
+ const c = this.#store.get(id);
92
+ return c && this.#view(c);
93
+ }
94
+ // ----------------------------------------------------------------- write ---
95
+ /** Commit `name` = `ciphertext` on its own branch, push it, and plan it. */
96
+ async stage(name, ciphertext) {
97
+ if (!validSecretName(name)) {
98
+ throw new SecretError('a secret name is lowercase letters, digits, ".", "_" and "-", starting with a letter or digit (at most 100)', 400);
99
+ }
100
+ if (typeof ciphertext !== 'string' || !/^[A-Za-z0-9+/]+={0,2}$/.test(ciphertext)) {
101
+ throw new SecretError('ciphertext must be base64 age ciphertext', 400);
102
+ }
103
+ if (ciphertext.length > MAX_CIPHERTEXT)
104
+ throw new SecretError('that value is too large for a secret', 413);
105
+ if (!(await decryptsToNonEmpty(this.#opts.identity, ciphertext))) {
106
+ throw new SecretError("that ciphertext does not decrypt with this daemon's key (or is empty) — encrypt to the recipient GET /api/secrets returns", 400);
107
+ }
108
+ return this.#serial(async () => {
109
+ await this.#sync(true);
110
+ const mainSha = await this.#rev(this.#main);
111
+ const reason = await this.#unwritable(mainSha);
112
+ if (reason)
113
+ throw new SecretError(reason, 409);
114
+ const { sha, action } = await this.#commit(mainSha, name, ciphertext);
115
+ const branch = `secrets/${name}`;
116
+ await this.#push(`+${sha}:refs/heads/${branch}`);
117
+ // The branch now holds the new commit, so an older staged change to the
118
+ // same secret has nothing left to deploy.
119
+ for (const old of this.#store.list()) {
120
+ if (old.status === 'staged' && old.name === name)
121
+ this.#finish(old, 'superseded');
122
+ }
123
+ const change = {
124
+ id: newRecordId('secret'),
125
+ name,
126
+ action,
127
+ status: 'staged',
128
+ branch,
129
+ sha,
130
+ mainSha,
131
+ requestedAt: new Date().toISOString(),
132
+ };
133
+ this.#plan(change);
134
+ this.#store.save(change);
135
+ this.#store.prune();
136
+ this.#log(`${action} ${name}: staged ${sha.slice(0, 12)} on ${branch}`);
137
+ return this.#view(change);
138
+ });
139
+ }
140
+ /** Plan a staged change again (after a refused or failed plan). */
141
+ replan(id) {
142
+ return this.#serial(async () => {
143
+ const change = this.#staged(id);
144
+ change.notice = undefined;
145
+ this.#plan(change);
146
+ this.#store.save(change);
147
+ return this.#view(change);
148
+ });
149
+ }
150
+ /**
151
+ * Put a staged change on main. Only the commit that was planned is ever
152
+ * pushed; if main has moved, the change is rebuilt and planned again, and
153
+ * the caller deploys once it has read the new plan.
154
+ */
155
+ deploy(id) {
156
+ return this.#serial(async () => {
157
+ const change = this.#staged(id);
158
+ const plan = change.planId ? this.#opts.plans.get(change.planId) : undefined;
159
+ if (!plan || plan.status !== 'planned' || plan.sha !== change.sha) {
160
+ const state = !plan ? 'not been planned' : plan.status === 'planned' ? 'a plan of another commit' : `a plan that is ${plan.status}`;
161
+ throw new SecretError(`this change has ${state} — deploy once its plan has finished cleanly`, 409);
162
+ }
163
+ await this.#sync(true);
164
+ const mainSha = await this.#rev(this.#main);
165
+ // Not forced: if main moved in the last second, the push is rejected and
166
+ // the change is rebuilt below rather than overwriting anything.
167
+ if (mainSha === change.mainSha && (await this.#push(`${change.sha}:refs/heads/${this.#opts.mainBranch}`, true))) {
168
+ change.deployedSha = change.sha;
169
+ change.notice = undefined;
170
+ this.#finish(change, 'deployed');
171
+ this.#log(`${change.action} ${change.name}: deployed ${change.sha.slice(0, 12)} to ${this.#opts.mainBranch}`);
172
+ await this.#dropBranch(change.branch);
173
+ this.#opts.reconcile?.('secrets');
174
+ return this.#view(change);
175
+ }
176
+ if (mainSha === change.mainSha)
177
+ await this.#sync(true);
178
+ // Already on main: an earlier deploy pushed it but was cut off before
179
+ // it could say so.
180
+ const now = await this.#rev(this.#main);
181
+ if (await this.#isAncestor(change.sha, now)) {
182
+ change.deployedSha = change.sha;
183
+ this.#finish(change, 'deployed');
184
+ await this.#dropBranch(change.branch);
185
+ return this.#view(change);
186
+ }
187
+ // Main moved: rebuild the same value on the new main, and plan that.
188
+ const value = (await this.#secretsAt(change.sha))[change.name];
189
+ if (!value)
190
+ throw new SecretError(`${change.sha.slice(0, 12)} no longer holds ${change.name}`, 500);
191
+ const rebuilt = await this.#commit(now, change.name, value);
192
+ await this.#push(`+${rebuilt.sha}:refs/heads/${change.branch}`);
193
+ change.sha = rebuilt.sha;
194
+ change.mainSha = now;
195
+ change.action = rebuilt.action;
196
+ this.#plan(change);
197
+ change.notice = `${this.#opts.mainBranch} moved since this was planned, so the change was rebuilt on ${now.slice(0, 12)} and planned again — review the new plan, then deploy`;
198
+ this.#store.save(change);
199
+ this.#log(`${change.name}: ${this.#opts.mainBranch} moved — rebuilt as ${rebuilt.sha.slice(0, 12)} and re-planned`);
200
+ return this.#view(change);
201
+ });
202
+ }
203
+ discard(id) {
204
+ return this.#serial(async () => {
205
+ const change = this.#staged(id);
206
+ await this.#dropBranch(change.branch);
207
+ this.#finish(change, 'discarded');
208
+ this.#log(`${change.name}: discarded ${change.sha.slice(0, 12)}`);
209
+ return this.#view(change);
210
+ });
211
+ }
212
+ // --------------------------------------------------------------- helpers ---
213
+ /** One git operation at a time: they share a working tree. */
214
+ #serial(fn) {
215
+ const next = this.#queue.then(fn, fn);
216
+ this.#queue = next.catch(() => undefined);
217
+ return next;
218
+ }
219
+ #staged(id) {
220
+ const change = this.#store.get(id);
221
+ if (!change)
222
+ throw new SecretError('no such change', 404);
223
+ if (change.status !== 'staged')
224
+ throw new SecretError(`this change is already ${change.status}`, 409);
225
+ return change;
226
+ }
227
+ #plan(change) {
228
+ try {
229
+ change.planId = this.#opts.plans.request(change.branch, change.sha).id;
230
+ change.error = undefined;
231
+ }
232
+ catch (err) {
233
+ change.planId = undefined;
234
+ change.error = `could not plan it: ${err instanceof Error ? err.message : String(err)} — plan it again shortly`;
235
+ }
236
+ }
237
+ #finish(change, status) {
238
+ change.status = status;
239
+ change.finishedAt = new Date().toISOString();
240
+ this.#store.save(change);
241
+ }
242
+ #view(change) {
243
+ const plan = change.planId ? this.#opts.plans.get(change.planId) : undefined;
244
+ if (!plan)
245
+ return change;
246
+ const planChanges = plan.result?.modules.flatMap((m) => m.ops.map((o) => `${m.scope}: ${o.summary}`));
247
+ return { ...change, plan: summarize(plan), ...(planChanges ? { planChanges: planChanges.slice(0, 50) } : {}) };
248
+ }
249
+ /** Why adding is impossible right now, or undefined when it is possible. */
250
+ async #unwritable(mainSha) {
251
+ if (!this.#opts.push) {
252
+ return 'adding secrets is off: the daemon has no push access to the config repo (set CONCORD_SECRETS_PUSH_KEY)';
253
+ }
254
+ const pub = (await this.#file(mainSha, 'age.pub'))?.trim();
255
+ if (pub !== (await this.recipient())) {
256
+ return pub
257
+ ? "the config repo's age.pub is not this daemon's key — a secret added here would not match the others"
258
+ : 'the config repo has no age.pub';
259
+ }
260
+ return undefined;
261
+ }
262
+ /** Clone if needed, and fetch main (reusing a recent fetch unless `force`). */
263
+ async #sync(force) {
264
+ const dir = this.#checkout;
265
+ try {
266
+ if (!existsSync(join(dir, '.git'))) {
267
+ rmSync(dir, { recursive: true, force: true });
268
+ mkdirSync(this.#opts.root, { recursive: true });
269
+ await this.#git(this.#opts.root, 'clone', '--quiet', '--no-checkout', '--', this.#opts.repoUrl, dir);
270
+ this.#fetchedAt = 0;
271
+ }
272
+ if (!force && Date.now() - this.#fetchedAt < FETCH_TTL_MS)
273
+ return;
274
+ const main = this.#opts.mainBranch;
275
+ await this.#git(dir, 'fetch', '--quiet', '--prune', 'origin', `+refs/heads/${main}:${this.#main}`);
276
+ this.#fetchedAt = Date.now();
277
+ }
278
+ catch (err) {
279
+ throw new SecretError(`cannot fetch the config repo: ${gitError(err)}`, 502);
280
+ }
281
+ }
282
+ /** A new commit on `base` that sets `name`. Leaves the clone detached at it. */
283
+ async #commit(base, name, ciphertext) {
284
+ const dir = this.#checkout;
285
+ const secrets = await this.#secretsAt(base);
286
+ const action = name in secrets ? 'rotate' : 'add';
287
+ secrets[name] = ciphertext;
288
+ await this.#git(dir, 'checkout', '--quiet', '--force', '--detach', base);
289
+ await this.#git(dir, 'clean', '-ffdxq');
290
+ writeFileSync(join(dir, 'secrets.ts'), renderSecretsFile(secrets));
291
+ await this.#git(dir, 'add', '--', 'secrets.ts');
292
+ const { name: who, email } = this.#opts.author;
293
+ await this.#git(dir, '-c', `user.name=${who}`, '-c', `user.email=${email}`, '-c', 'commit.gpgsign=false', '-c', 'core.hooksPath=/dev/null', 'commit', '--quiet', '-m', `secrets: ${action} ${name}`, '-m', 'Staged on the Concord Secrets page. The value was encrypted in the browser; only its ciphertext was ever sent.');
294
+ return { sha: await this.#rev('HEAD'), action };
295
+ }
296
+ async #secretsAt(sha) {
297
+ const text = await this.#file(sha, 'secrets.ts');
298
+ if (text === undefined)
299
+ return {};
300
+ try {
301
+ return parseSecretsFile(text);
302
+ }
303
+ catch (err) {
304
+ throw new SecretError(`cannot read secrets.ts at ${sha.slice(0, 12)}: ${err instanceof Error ? err.message : String(err)}`, 409);
305
+ }
306
+ }
307
+ async #file(sha, path) {
308
+ try {
309
+ return await this.#git(this.#checkout, 'show', `${sha}:${path}`);
310
+ }
311
+ catch {
312
+ return undefined;
313
+ }
314
+ }
315
+ /** For each name, the files at `sha` (other than secrets.ts) that quote it. */
316
+ async #references(sha, names) {
317
+ const found = new Map();
318
+ let out = '';
319
+ try {
320
+ out = await this.#git(this.#checkout, 'grep', '-I', '-z', '-o', '-E', `['"\`][a-z0-9][a-z0-9._-]*['"\`]`, sha, '--', '.', ':(exclude)secrets.ts');
321
+ }
322
+ catch {
323
+ return new Map(); // exit 1: no matches at all
324
+ }
325
+ for (const line of out.split('\n')) {
326
+ const nul = line.indexOf('\0');
327
+ if (nul < 0)
328
+ continue;
329
+ const file = line.slice(0, nul).replace(`${sha}:`, '');
330
+ const name = line.slice(nul + 1).slice(1, -1);
331
+ if (!names.has(name))
332
+ continue;
333
+ if (!found.has(name))
334
+ found.set(name, new Set());
335
+ found.get(name).add(file);
336
+ }
337
+ return new Map([...found].map(([n, files]) => [n, [...files].sort()]));
338
+ }
339
+ /**
340
+ * Push one refspec. With `rejectedOk`, a push refused for not being a
341
+ * fast-forward returns false; every other failure is an error to show.
342
+ */
343
+ async #push(refspec, rejectedOk = false) {
344
+ try {
345
+ await this.#git(this.#checkout, 'push', '--quiet', 'origin', refspec);
346
+ return true;
347
+ }
348
+ catch (err) {
349
+ const why = gitError(err);
350
+ if (rejectedOk && /rejected|non-fast-forward|fetch first/i.test(why))
351
+ return false;
352
+ throw new SecretError(`git push failed: ${why}`, 502);
353
+ }
354
+ }
355
+ async #dropBranch(branch) {
356
+ try {
357
+ await this.#git(this.#checkout, 'push', '--quiet', 'origin', '--delete', branch);
358
+ }
359
+ catch {
360
+ /* already gone, or never pushed: either way, not there */
361
+ }
362
+ }
363
+ async #isAncestor(sha, of) {
364
+ return this.#git(this.#checkout, 'merge-base', '--is-ancestor', sha, of).then(() => true, () => false);
365
+ }
366
+ async #rev(ref) {
367
+ return (await this.#git(this.#checkout, 'rev-parse', '--verify', `${ref}^{commit}`)).trim();
368
+ }
369
+ async #git(cwd, ...args) {
370
+ const key = this.#opts.push?.sshKey;
371
+ const { stdout } = await execFileAsync('git', args, {
372
+ cwd,
373
+ encoding: 'utf8',
374
+ timeout: 120_000,
375
+ maxBuffer: 16 * 1024 * 1024,
376
+ env: {
377
+ ...process.env,
378
+ // Never prompt: a prompt would hang every secrets request behind it.
379
+ GIT_TERMINAL_PROMPT: '0',
380
+ ...(key ? { GIT_SSH_COMMAND: `ssh -i '${key}' -o IdentitiesOnly=yes -o BatchMode=yes` } : {}),
381
+ },
382
+ });
383
+ return stdout;
384
+ }
385
+ #log(message) {
386
+ this.#opts.log?.('secrets', message);
387
+ }
388
+ }
389
+ /** The useful end of a failed git command's stderr. */
390
+ function gitError(err) {
391
+ const stderr = err.stderr;
392
+ const text = typeof stderr === 'string' && stderr.trim() ? stderr : err instanceof Error ? err.message : String(err);
393
+ return text.trim().split('\n').slice(-3).join(' ').slice(0, 500);
394
+ }
395
+ //# sourceMappingURL=secret-changes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-changes.js","sourceRoot":"","sources":["../src/secret-changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,SAAS,EAA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;AACvD,SAAS,QAAQ,CAAC,GAAY;IAC5B,MAAM,MAAM,GAAI,GAA4B,CAAC,MAAM,CAAA;IACnD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACpH,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAClE,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The config repo's `secrets.ts`: the one file both `concord secret set` and
3
+ * the daemon's Secrets page write.
4
+ *
5
+ * It is GENERATED, so its shape is exact: one `"name": "ciphertext" as Secret,`
6
+ * line per secret, sorted. That is what lets the daemon read it as TEXT rather
7
+ * than evaluating it — and the reader is strict for the same reason: a file it
8
+ * does not recognise is refused, never half-read and rewritten without the
9
+ * lines it skipped.
10
+ */
11
+ /** Secret names: lowercase, digits, `.`, `_`, `-`; they become branch names too. */
12
+ export declare function validSecretName(name: unknown): name is string;
13
+ export declare function renderSecretsFile(secrets: Record<string, string>): string;
14
+ /** Parse a generated `secrets.ts`. Throws on anything it does not recognise. */
15
+ export declare function parseSecretsFile(text: string): Record<string, string>;
16
+ //# sourceMappingURL=secrets-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-file.d.ts","sourceRoot":"","sources":["../src/secrets-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAE7D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAmBzE;AAID,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBrE"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The config repo's `secrets.ts`: the one file both `concord secret set` and
3
+ * the daemon's Secrets page write.
4
+ *
5
+ * It is GENERATED, so its shape is exact: one `"name": "ciphertext" as Secret,`
6
+ * line per secret, sorted. That is what lets the daemon read it as TEXT rather
7
+ * than evaluating it — and the reader is strict for the same reason: a file it
8
+ * does not recognise is refused, never half-read and rewritten without the
9
+ * lines it skipped.
10
+ */
11
+ /** Secret names: lowercase, digits, `.`, `_`, `-`; they become branch names too. */
12
+ export function validSecretName(name) {
13
+ return typeof name === 'string' && /^[a-z0-9][a-z0-9._-]{0,99}$/.test(name) && !name.includes('..');
14
+ }
15
+ export function renderSecretsFile(secrets) {
16
+ const body = Object.keys(secrets)
17
+ .sort()
18
+ .map((k) => ` ${JSON.stringify(k)}: ${JSON.stringify(secrets[k])} as Secret,`)
19
+ .join('\n');
20
+ return `// GENERATED by \`concord secret set\` — do not hand-edit.
21
+ //
22
+ // Values are age ciphertext (base64), encrypted to the public key in age.pub.
23
+ // Names are plaintext on purpose: you can see WHICH secrets exist and grep the
24
+ // config for where each is used, without being able to read any of them.
25
+ //
26
+ // The import is TYPE-ONLY and the branding is a cast, so both are erased at
27
+ // compile time — this file has no runtime dependency on @rcpooley/concord.
28
+ import type { Secret } from '@rcpooley/concord'
29
+
30
+ export const secrets = {
31
+ ${body}
32
+ }
33
+ `;
34
+ }
35
+ const ENTRY = /^\s*("(?:[^"\\]|\\.)*")\s*:\s*("[A-Za-z0-9+/=]*")\s+as\s+Secret\s*,?\s*$/;
36
+ /** Parse a generated `secrets.ts`. Throws on anything it does not recognise. */
37
+ export function parseSecretsFile(text) {
38
+ const lines = text.split('\n');
39
+ const start = lines.findIndex((l) => /^export const secrets = \{\s*$/.test(l));
40
+ if (start < 0)
41
+ throw new Error('secrets.ts has no `export const secrets = {` line');
42
+ const out = {};
43
+ for (let i = start + 1; i < lines.length; i++) {
44
+ const line = lines[i];
45
+ if (/^\}\s*;?\s*$/.test(line))
46
+ return out;
47
+ if (line.trim() === '')
48
+ continue;
49
+ const m = ENTRY.exec(line);
50
+ if (!m)
51
+ throw new Error(`secrets.ts line ${i + 1} is not a generated entry — was it hand-edited?`);
52
+ const name = JSON.parse(m[1]);
53
+ if (name in out)
54
+ throw new Error(`secrets.ts declares '${name}' twice`);
55
+ out[name] = JSON.parse(m[2]);
56
+ }
57
+ throw new Error('secrets.ts never closes its `secrets` object');
58
+ }
59
+ //# sourceMappingURL=secrets-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-file.js","sourceRoot":"","sources":["../src/secrets-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACrG,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAA+B;IAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;SAC9B,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;SAC9E,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO;;;;;;;;;;;EAWP,IAAI;;CAEL,CAAA;AACD,CAAC;AAED,MAAM,KAAK,GAAG,0EAA0E,CAAA;AAExF,gFAAgF;AAChF,MA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ponse } from 'node:http';
2
2
  import type { DaemonStatus, ReconcileResponse, RunRecord, RunSummary } from './api.js';
3
3
  import { type PlanService } from './plans.js';
4
+ import { type SecretService } from './secret-changes.js';
4
5
  /**
5
6
  * The daemon's two HTTP servers.
6
7
  *
@@ -46,13 +47,34 @@ export interface ApiOptions {
46
47
  get: (id: string) => RunRecord | undefined;
47
48
  };
48
49
  plans: PlanService;
50
+ /** The Secrets page's back end. Absent: /api/secrets says it is unavailable. */
51
+ secrets?: Pick<SecretService, 'list' | 'get' | 'stage' | 'deploy' | 'replan' | 'discard'>;
49
52
  /** Ask for a reconcile now; the daemon's own SIGHUP path. */
50
53
  reconcile: (reason: string) => ReconcileResponse['status'];
51
54
  /** The built web UI (dist-ui). Absent: the API is served without one. */
52
55
  uiDir?: string;
56
+ /**
57
+ * Origins allowed to frame the UI (CSP frame-ancestors), e.g. a dashboard
58
+ * that embeds it. Default: none. See parseFrameAncestors.
59
+ */
60
+ frameAncestors?: string[];
53
61
  log: Log;
54
62
  }
55
63
  export declare function apiHandler(opts: ApiOptions): Handler;
56
64
  export declare function routeApi(opts: ApiOptions, req: IncomingMessage, res: ServerResponse): Promise<void>;
65
+ /**
66
+ * The single-page UI, as built files. It holds no secrets and calls the API
67
+ * with the token like any client, so serving it needs no auth of its own.
68
+ * Unknown paths get index.html (its routes live behind `#`, so this only
69
+ * matters for a mistyped URL).
70
+ */
71
+ /**
72
+ * `CONCORD_FRAME_ANCESTORS`: space- or comma-separated origins
73
+ * (`https://dash.example.com`) that may embed the UI in a frame. Only exact
74
+ * http(s) origins are accepted, never wildcards or keywords: the UI drives the
75
+ * API, so a page that may frame it may trick clicks onto "reconcile" or
76
+ * "deploy". Throws on anything else, so a typo is loud rather than ignored.
77
+ */
78
+ export declare function parseFrameAncestors(spec: string | undefined): string[];
57
79
  export {};
58
80
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"m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