@runeditrun/rer 0.2.37 → 0.2.38

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/cli/contract.mjs CHANGED
@@ -11,7 +11,7 @@ const definitions = {
11
11
  build: [['--site'], 'Production build with private local settings excluded and restored. --site instead writes the static run site (homepage, /run, docs) to its declared folder and prints that folder.'],
12
12
  verify: [[], 'Run the complete internal verification target.'],
13
13
  reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
14
- deploy: [['--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret'], 'Owner-account deployment and health; dry run performs local validation/build only. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. After a healthy deploy rer claims the setup owner on the hosted app with the one-time setup token, then removes the token. --set-secret NAME (value from the environment or --env-file) and --unset-secret NAME change one secret of the deployed Worker without a build and record its new version. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
14
+ deploy: [['--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret'], 'Owner-account deployment and health; dry run performs local validation/build only. Builds and deploy hooks run with the checkout\'s local settings files moved aside, and a build output holding one (.dev.vars, .env) is refused. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. rer keeps the secrets it generates in .rer/deploy/ENVIRONMENT.secrets.env (0600) and reuses them on every redeploy; it refuses to generate a replacement for one a live Worker holds, and --rotate-secret NAME[,NAME] replaces them on purpose. After a healthy deploy rer claims the setup owner on the hosted app with the one-time setup token, then removes the token. --set-secret NAME (value from the environment or --env-file) and --unset-secret NAME change one secret of the deployed Worker without a build and record its new version. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
15
15
  export: [['--target', '--output', '--origin', '--session-file'], 'Complete supported installation archive with integrity and exclusions.'],
16
16
  import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--output'], 'Confirmed atomic restore into an empty destination; --journal LATER_ARCHIVE also fences rows that installation erased since. Backup-only local v1 recovery requires --legacy-v1 --acknowledge-unverified-metadata and a new --output v2 archive; --journal requires normal v2 import.'],
17
17
  doctor: [[], 'Read-only installed tool, configuration and state diagnostics.'],
@@ -18,9 +18,11 @@ import { refuseLocalModels } from '../modules/deploy-kit/local-only.mjs';
18
18
  import { migrationFailure, providerFailure, assetFailure } from '../modules/deploy-kit/diagnostics.mjs';
19
19
  import { shared } from './shared.mjs';
20
20
  import { deployGuide, neededForRealDeploy, reportNeeded } from './deploy-needs.mjs';
21
+ import { keepHookSecrets } from './deploy-secrets.mjs';
22
+ import { withoutLocalSettings, refuseLocalEnvOutput } from './local-env.mjs';
21
23
 
22
24
  export function validateDeployOptions(options) {
23
- const changes = [options.remove && '--remove', options.setSecret && '--set-secret', options.unsetSecret && '--unset-secret'].filter(Boolean);
25
+ const changes = [options.remove && '--remove', options.setSecret && '--set-secret', options.unsetSecret && '--unset-secret', options.rotateSecret && '--rotate-secret'].filter(Boolean);
24
26
  if (changes.length > 1 || changes.length && options.dryRun) throw invalid(`Use ${changes.join(', ')}${options.dryRun ? ' and --dry-run' : ''} on separate runs.`);
25
27
  if (options.remove && !options.yes) throw invalid(`${deployAgain(options)} --remove deletes this environment's Worker and every D1, R2, KV and queue rer created for it, with their data. Add --yes to confirm.`);
26
28
  }
@@ -73,16 +75,20 @@ export async function deployCommand(context) {
73
75
  // Custom hooks historically ignored these flags. Only the ownership controller
74
76
  // may perform them; neither a build nor a custom upload runs here.
75
77
  if (options.remove || options.setSecret || options.unsetSecret) return ownerDeploy(path, adapter)(context);
78
+ // A hook that deployed through the kit keeps what its Worker holds: rotate there as a secret change.
79
+ if (options.rotateSecret && !adapter.deploy.managesHostedOwner && await hookState(root, options.environment ?? 'production')) return ownerDeploy(path, adapter)(context);
76
80
  if (adapter.deploy.managesHostedOwner) { const result = await adapter.deploy(context); return options.dryRun ? dryRun(result) : result; }
77
81
  const production = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
78
82
  await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed: context.setupSeed, adapter, declarationPath: path, options });
79
83
  const sourceSha = options.dryRun ? undefined : committedSource(root, options);
80
- const { env, supplied } = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
84
+ const { env, supplied, generated, reused, rotated } = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
81
85
  const { createRedaction, credentialValues } = await shared('redaction.mjs');
82
86
  const redaction = createRedaction();
83
87
  const addSecret = value => { redaction.addSecrets([value]); store.addSecrets?.([value]); };
84
88
  for (const value of [...credentialValues(env), env.CLOUDFLARE_ACCOUNT_ID, ...(declaration.secrets ?? []).map(item => env[item.environment])].filter(Boolean)) addSecret(value);
85
89
  const environment = options.environment ?? 'production';
90
+ // The hook uploads every value it is given: a generated secret it gets is the one the Worker keeps.
91
+ if (!options.dryRun) await keepHookSecrets({ root, environment, declaration, setupManifest, env, generated, reused, rotated, again: deployAgain(options), report: line => store.report(line) });
86
92
  // A hook keeping the kit's record in its own state file named it; every kit
87
93
  // step after the hook (inspect, secret, record-owner) reads that record.
88
94
  let hookRecord = await hookState(root, environment);
@@ -103,12 +109,15 @@ export async function deployCommand(context) {
103
109
  const saved = { ...process.env };
104
110
  try {
105
111
  Object.assign(process.env, env);
106
- deployed = await adapter.deploy({ ...context, linkDependencies: async (origin, token) => link(token, origin) });
112
+ // The hook builds and uploads by itself: it never sees the checkout's local settings.
113
+ deployed = await withoutLocalSettings(root, { settings: [...(Array.isArray(adapter.settings) ? adapter.settings : []), adapter.hooks?.secrets?.file], operationToken: context.operationToken },
114
+ () => adapter.deploy({ ...context, linkDependencies: async (origin, token) => link(token, origin) }));
107
115
  } finally {
108
116
  for (const key of Object.keys(process.env)) if (!Object.hasOwn(saved, key)) delete process.env[key];
109
117
  Object.assign(process.env, saved);
110
118
  }
111
119
  hookReturned = true;
120
+ await refuseLocalEnvOutput(root, adapter.devIdentity?.output, { uploaded: !options.dryRun });
112
121
  if (options.dryRun) return dryRun(deployed);
113
122
  await rememberHookState(root, environment, deployed?.state);
114
123
  hookRecord = await hookState(root, environment);
@@ -4,12 +4,14 @@ import { shared } from './shared.mjs';
4
4
  import { invalid } from './errors.mjs';
5
5
  import { readDeployEnvFile } from '../modules/deploy-kit/env-file.mjs';
6
6
  import { publicOrigin } from '../modules/deploy-kit/public-origin.mjs';
7
+ import { keptSecrets, rotations, savedSecrets } from './deploy-secrets.mjs';
7
8
 
8
9
  // The values a Workers deploy reads for its declared secrets: this process's
9
10
  // environment, then the --env-file (which wins), then what rer supplies itself:
10
- // the local setup owner's email, and a fresh value for each secret the setup
11
- // manifest generates (a session secret, the one-time setup token). A value only
12
- // reaches a Worker that lacks that secret; an existing one is kept unchanged.
11
+ // the local setup owner's email, and for each secret the setup manifest generates
12
+ // the value kept for this environment (deploy-secrets.mjs), else a fresh one
13
+ // (`generated`; always fresh for the one-time setup token and --rotate-secret).
14
+ // The owner kit sends a value only to a Worker that lacks that secret.
13
15
  export async function deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys = [] }) {
14
16
  const env = { ...process.env }, supplied = [];
15
17
  if (options.envFile) {
@@ -35,11 +37,19 @@ export async function deployEnvironment({ root, options, declaration, setupManif
35
37
  const owner = (await readSettings(root, settings)).values[emailField];
36
38
  if (typeof owner === 'string' && owner.includes('@')) { env[email.environment] = owner; supplied.push(email.binding); }
37
39
  }
40
+ // withDeployEnvironment reads only the --env-file, with no declaration to rotate in.
41
+ const kept = keptSecrets(declaration, setupManifest), rotate = setupManifest || declaration.project ? rotations(options, kept, env) : [];
42
+ const saved = kept.some(absent) ? await savedSecrets(root, options.environment ?? 'production') : {};
43
+ const generated = [], reused = [];
38
44
  for (const field of setupManifest?.fields ?? []) {
39
45
  const item = field.kind === 'secret' && field.generate ? secrets.find(entry => entry?.binding === field.name) : undefined;
40
- if (absent(item)) { env[item.environment] = randomBytes(32).toString(field.generate); supplied.push(item.binding); }
46
+ if (!absent(item)) continue;
47
+ const keep = kept.includes(item), value = keep && !rotate.includes(item.binding) ? saved[item.binding] : undefined;
48
+ env[item.environment] = value ?? randomBytes(32).toString(field.generate);
49
+ supplied.push(item.binding);
50
+ if (value) reused.push(item.binding); else if (keep) generated.push(item.binding);
41
51
  }
42
- return { env, supplied };
52
+ return { env, supplied, generated, reused, rotated: rotate };
43
53
  }
44
54
 
45
55
  // Hooks and their child builds read process.env. Install the private file for
@@ -0,0 +1,99 @@
1
+ import { readFile, rm } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { invalid, missing, refuse } from './errors.mjs';
4
+ import { cloudflareCredentials, missingCredentialsMessage } from './deploy-needs.mjs';
5
+ import { shared } from './shared.mjs';
6
+ import { readDeployEnvFile } from '../modules/deploy-kit/env-file.mjs';
7
+ import { cloudflare } from '../modules/deploy-kit/provider.mjs';
8
+ import { ownerWorkerName } from '../modules/deploy-kit/owner.mjs';
9
+
10
+ // Secrets rer generates for a deployment (the setup manifest's `generate` secret
11
+ // fields, such as a session or subscriber-link secret) outlive the run that made
12
+ // them: rer keeps them with the environment's deployment record, in the private
13
+ // (0600) file .rer/deploy/<environment>.secrets.env, and a redeploy reuses them.
14
+ // Cloudflare never reads a secret's value back, only its name, so a checkout
15
+ // without that file cannot know what a live Worker holds: rer then refuses to
16
+ // generate a replacement unless `--rotate-secret NAME` asks for one. The one-time
17
+ // owner setup token is not kept: rer issues it fresh and retires it after the claim.
18
+ export const savedSecretsFile = environment => join('.rer', 'deploy', `${environment}.secrets.env`);
19
+
20
+ const ignore = '# rer: generated deployment secrets never enter Git.\n*.secrets.env\n.gitignore\n';
21
+
22
+ /** The declared secrets rer generates and keeps: `generate` secret fields, except the owner setup token. */
23
+ export function keptSecrets(declaration, setupManifest) {
24
+ const token = setupManifest?.steps?.find(step => step.type === 'owner-claim')?.tokenField ?? 'SETUP_TOKEN';
25
+ const declared = Array.isArray(declaration?.secrets) ? declaration.secrets : [];
26
+ return (setupManifest?.fields ?? []).flatMap(field => {
27
+ const item = field.kind === 'secret' && field.generate && field.name !== token ? declared.find(entry => entry?.binding === field.name) : undefined;
28
+ return item ? [item] : [];
29
+ });
30
+ }
31
+
32
+ /** `--rotate-secret A,B`: each must be a secret rer generates and keeps, and not supplied by the person. */
33
+ export function rotations(options, kept, env) {
34
+ const names = options.rotateSecret === undefined ? [] : options.rotateSecret.split(',');
35
+ const generated = kept.map(item => item.binding);
36
+ for (const name of names) {
37
+ if (!generated.includes(name)) throw invalid(`--rotate-secret names a secret rer generates for this deployment${generated.length ? ` (${generated.join(', ')})` : ', and this seed declares none'}; ${name} is not one. Set another secret with --set-secret.`);
38
+ const item = kept.find(entry => entry.binding === name);
39
+ if (env[item.environment]?.trim()) throw invalid(`--rotate-secret ${name} generates a fresh value, but ${item.environment} is also set in the environment or --env-file. Leave it unset to rotate, or deploy with the value you supplied.`);
40
+ }
41
+ return names;
42
+ }
43
+
44
+ /** The values kept for this environment, by binding; {} when none are. */
45
+ export async function savedSecrets(root, environment) {
46
+ try { return await readDeployEnvFile(root, savedSecretsFile(environment)); }
47
+ catch (error) {
48
+ if (error.code === 'ENOENT') return {};
49
+ throw invalid(`${savedSecretsFile(environment)} could not be read: ${error.message}. Restore it as an owned 0600 file of NAME=VALUE lines.`);
50
+ }
51
+ }
52
+
53
+ /** Keep these values (merged over what is kept) before they can reach a Worker. */
54
+ export async function saveSecrets(root, environment, values) {
55
+ if (!Object.keys(values).length) return;
56
+ const { privateDirectory, writePrivateFile } = await shared('private-files.mjs');
57
+ await privateDirectory(root, ['.rer', 'deploy']);
58
+ const gitignore = join(root, '.rer', 'deploy', '.gitignore');
59
+ const current = await readFile(gitignore, 'utf8').catch(error => { if (error.code === 'ENOENT') return ''; throw error; });
60
+ if (!current.split('\n').includes('*.secrets.env')) await writePrivateFile(gitignore, current + (current && !current.endsWith('\n') ? '\n' : '') + ignore);
61
+ const merged = { ...await savedSecrets(root, environment), ...values };
62
+ await writePrivateFile(join(root, savedSecretsFile(environment)), Object.entries(merged).map(([name, value]) => `${name}=${value}\n`).join(''));
63
+ }
64
+
65
+ export const forgetSecrets = (root, environment) => rm(join(root, savedSecretsFile(environment)), { force: true });
66
+
67
+ /** The secret names the environment's live Worker holds; [] when it has no Worker yet. */
68
+ export async function liveSecretNames(env, declaration, environment) {
69
+ const api = cloudflare({ accountId: env.CLOUDFLARE_ACCOUNT_ID, token: env.CLOUDFLARE_API_TOKEN });
70
+ try { return (await api.request(`/workers/scripts/${ownerWorkerName(declaration.project, environment)}/secrets`)).map(row => row.name); }
71
+ catch (error) { if (error.status === 404) return []; throw error; }
72
+ }
73
+
74
+ /** Refuse to replace generated secrets a live Worker holds when rer kept no value for them. */
75
+ export function refuseRotation({ worker, held, environment, again }) {
76
+ const names = held.map(item => item.binding), many = held.length > 1, them = many ? 'them' : 'it';
77
+ return refuse(`The live ${worker} Worker holds ${names.join(', ')}, which rer generates for this deployment, but this checkout keeps no value for ${them} in ${savedSecretsFile(environment)}. A new value would replace the live one and break everything made with it, such as signed-in sessions and links already emailed. Nothing was uploaded.\nTo keep ${them}: copy ${savedSecretsFile(environment)} from the checkout that deployed this environment, or set ${held.map(item => item.environment).join(', ')} in --env-file, then run ${again} again.\nTo replace ${them} on purpose: ${again} --rotate-secret ${names.join(',')}`);
78
+ }
79
+
80
+ /** Before a seed's own deploy hook uploads them: refuse to replace generated secrets a
81
+ * live Worker holds without a kept value, then keep what this run generated. */
82
+ export async function keepHookSecrets({ root, environment, declaration, setupManifest, env, generated, reused, rotated, again, report }) {
83
+ const kept = keptSecrets(declaration, setupManifest), fresh = generated.filter(binding => !rotated.includes(binding));
84
+ if (fresh.length) {
85
+ if (cloudflareCredentials.some(name => !env[name]?.trim())) throw missing(missingCredentialsMessage(declaration, env));
86
+ const live = await liveSecretNames(env, declaration, environment);
87
+ const held = kept.filter(item => fresh.includes(item.binding) && live.includes(item.binding));
88
+ if (held.length) throw refuseRotation({ worker: ownerWorkerName(declaration.project, environment), held, environment, again });
89
+ }
90
+ await keepSecrets({ root, environment, kept, env, generated, reused, report });
91
+ }
92
+
93
+ /** Keep the generated values that reach the Worker, and say which were generated or reused. */
94
+ export async function keepSecrets({ root, environment, kept, env, generated, reused, report }) {
95
+ await saveSecrets(root, environment, Object.fromEntries(kept.filter(item => generated.includes(item.binding)).map(item => [item.binding, env[item.environment]])));
96
+ const file = savedSecretsFile(environment), them = names => names.length > 1 ? 'them' : 'it';
97
+ if (generated.length) report(`rer generated ${generated.join(', ')} for this deployment and keeps ${them(generated)} in ${file} (private; Git ignores it), so a redeploy reuses ${them(generated)}. To deploy this environment from another checkout, copy that file there.`);
98
+ if (reused.length) report(`rer reused ${reused.join(', ')} kept in ${file}.`);
99
+ }
package/cli/deploy.mjs CHANGED
@@ -15,6 +15,8 @@ import { committedSource } from './deploy-source.mjs';
15
15
  import { hookState, forgetHookState } from './deploy-hook-record.mjs';
16
16
  import { deploymentRecord } from './deployment-record.mjs';
17
17
  import { cloudflareCredentials, missingCredentialsMessage } from './deploy-needs.mjs';
18
+ import { keptSecrets, keepSecrets, forgetSecrets } from './deploy-secrets.mjs';
19
+ import { withoutLocalSettings, refuseLocalEnvOutput } from './local-env.mjs';
18
20
 
19
21
  export function ownerDeploy(declarationPath, lifecycle) {
20
22
  // rer verify serves the build with this declaration's vars and secrets.
@@ -26,9 +28,9 @@ export function ownerDeploy(declarationPath, lifecycle) {
26
28
  if (local) throw refuse(`${declarationPath} names the local-only key ${local} as a deploy binding or secret. Remove it; local dev keys never reach a deployment.`);
27
29
  const environment = options.environment ?? 'production';
28
30
  const again = deployAgain(options);
29
- const change = [options.remove && '--remove', options.setSecret && '--set-secret', options.unsetSecret && '--unset-secret'].filter(Boolean);
31
+ const change = [options.remove && '--remove', options.setSecret && '--set-secret', options.unsetSecret && '--unset-secret', options.rotateSecret && '--rotate-secret'].filter(Boolean);
30
32
  // The command that finishes what this run started: the same verb, never a plain deploy in its place.
31
- const retry = options.remove ? `${again} --remove --yes` : options.setSecret ? `${again} --set-secret ${options.setSecret}` : options.unsetSecret ? `${again} --unset-secret ${options.unsetSecret}` : again;
33
+ const retry = options.remove ? `${again} --remove --yes` : options.setSecret ? `${again} --set-secret ${options.setSecret}` : options.unsetSecret ? `${again} --unset-secret ${options.unsetSecret}` : options.rotateSecret ? `${again} --rotate-secret ${options.rotateSecret}` : again;
32
34
  if (change.length > 1 || change.length && options.dryRun) throw invalid(`Use ${change.join(', ')}${options.dryRun ? ' and --dry-run' : ''} on separate runs.`);
33
35
  if (options.remove && !options.yes) throw invalid(`${again} --remove deletes this environment's Worker and every D1, R2, KV and queue rer created for it, with their data. Add --yes to confirm.`);
34
36
  const recordedState = change.length ? await deploymentRecord(root, options) : undefined;
@@ -39,8 +41,9 @@ export function ownerDeploy(declarationPath, lifecycle) {
39
41
  production = await deployEnvironment({ root, options, declaration, setupManifest, settings: lifecycle.settings, localOnlyKeys });
40
42
  await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed, adapter: lifecycle, declarationPath, options });
41
43
  if (!options.dryRun) committedSource(root, options);
42
- await lifecycle.run(root, {}, store, () => {}, signal, { verb: 'build', operationToken });
44
+ await withoutLocalSettings(root, { settings: lifecycle.settings, operationToken }, () => lifecycle.run(root, {}, store, () => {}, signal, { verb: 'build', operationToken }));
43
45
  await checkBuild();
46
+ await refuseLocalEnvOutput(root);
44
47
  }
45
48
  if (options.dryRun) {
46
49
  // Locally validate the real declaration/artifact without ownerTarget's
@@ -53,7 +56,8 @@ export function ownerDeploy(declarationPath, lifecycle) {
53
56
  store.report('deploy: dry run complete; no deployment occurred and no provider request was made.');
54
57
  return { dryRun: true, deployed: false };
55
58
  }
56
- const { env, supplied } = await deployEnvironment({ root, options, declaration, setupManifest, settings: lifecycle.settings, localOnlyKeys });
59
+ const { env, supplied, generated, reused, rotated } = await deployEnvironment({ root, options, declaration, setupManifest, settings: lifecycle.settings, localOnlyKeys });
60
+ const kept = keptSecrets(declaration, setupManifest);
57
61
  if (cloudflareCredentials.some(name => !env[name]?.trim())) throw missing(missingCredentialsMessage(declaration, env));
58
62
  const { main } = await import('../modules/deploy-kit/owner-cli.mjs');
59
63
  const { createRedaction, credentialValues } = await shared('redaction.mjs');
@@ -72,9 +76,20 @@ export function ownerDeploy(declarationPath, lifecycle) {
72
76
  step = 'remove';
73
77
  const result = await owner('remove', state ? ['--state', state] : []);
74
78
  await forgetHookState(root, environment);
79
+ await forgetSecrets(root, environment);
75
80
  store.report(`Removed ${result.removed.join(', ') || 'nothing (already gone)'}; read back: none of them remains.`);
76
81
  return { removed: result.removed, deployed: false };
77
82
  }
83
+ if (options.rotateSecret) {
84
+ // The kit never replaces a secret its Worker holds: rotation is this explicit change, kept once it is live.
85
+ step = 'secrets';
86
+ for (const binding of rotated) {
87
+ await owner('secret', ['--set', binding, ...(state ? ['--state', state] : [])]);
88
+ await keepSecrets({ root, environment, kept, env, generated: [binding], reused: [], report: () => {} });
89
+ store.report(`Rotated ${binding} on this environment's Worker to a fresh value kept in .rer/deploy/${environment}.secrets.env, recorded its new version and verified hosted readiness.`);
90
+ }
91
+ return { rotated, deployed: false };
92
+ }
78
93
  if (change.length) {
79
94
  step = 'secrets';
80
95
  const binding = options.setSecret ?? options.unsetSecret;
@@ -84,8 +99,11 @@ export function ownerDeploy(declarationPath, lifecycle) {
84
99
  }
85
100
  store.report(`Deploying the ${environment} environment to your Cloudflare account.`);
86
101
  deployed = await owner('deploy', [], env, { notice: line => store.report(line), onCreated: resource => created.push(redaction.redact(resource)) });
87
- const sent = supplied.filter(name => deployed.sentSecrets.includes(name));
88
- if (sent.length) store.report(`rer supplied ${sent.join(', ')} from the local setup owner and fresh generated values.`);
102
+ // A generated value the kit did not send stays unknown: the Worker kept its own.
103
+ const sent = supplied.filter(name => deployed.sentSecrets.includes(name)), keptSent = [...generated, ...reused].filter(name => sent.includes(name));
104
+ await keepSecrets({ root, environment, kept, env, generated: generated.filter(name => sent.includes(name)), reused: reused.filter(name => sent.includes(name)), report: line => store.report(line) });
105
+ const other = sent.filter(name => !keptSent.includes(name));
106
+ if (other.length) store.report(`rer supplied ${other.join(', ')} from the local setup owner and fresh generated values.`);
89
107
  if (deployed.optionalUnset) store.report(`Optional secrets not set: ${deployed.optionalUnset.join(', ')}. The application runs without them; set one later with ${again} --set-secret NAME.`);
90
108
  step = 'health';
91
109
  await owner('health', [], env, {propagation:deployed.propagation});
package/cli/lifecycle.mjs CHANGED
@@ -15,6 +15,7 @@ import { runtimeFrontDoor } from './runtime-front-door.mjs';
15
15
  import { localCliSessionProof, localSettingKeys } from './settings.mjs';
16
16
  import { rememberSetupAnswers } from './setup-answers.mjs';
17
17
  import { ensureDevKey, refuseDevLayerOutput } from './dev-identity.mjs';
18
+ import { withoutLocalSettings, refuseLocalEnvOutput } from './local-env.mjs';
18
19
  import { announceDoorRoute } from './door-mode.mjs';
19
20
 
20
21
  export async function runCommand(project, options, out) {
@@ -120,10 +121,15 @@ async function runLifecycle(project, options, out, deployRedaction) {
120
121
  if (options.verb === 'setup') { proxy = await runtimeFrontDoor({ ...selected, devKey: devKey ?? undefined, origin: selected.url }); if (selected.door) await announceDoorRoute(selected, proxy); }
121
122
  const { appFetch } = await shared('app-fetch.mjs');
122
123
  const emailKey = localSettingKeys(project).email;
123
- await adapter.run(project.root, input ?? { [emailKey]: options.ownerEmail ?? selected?.vars[emailKey] }, store,
124
+ const privateSettings = [...adapter.settings, '.rer/local/models.json', ...(project.privateInputs??[])];
125
+ const run = () => adapter.run(project.root, input ?? { [emailKey]: options.ownerEmail ?? selected?.vars[emailKey] }, store,
124
126
  child => { app = child; }, signal,
125
- { verb: options.verb, ownerKey: emailKey, selectedOrigin: selected?.url, runtimePort: proxy?.runtimePort, operationToken: operation?.token, dev: adapter.dev, privateSettings: [...adapter.settings, '.rer/local/models.json', ...(project.privateInputs??[])], devKey: devKey ?? undefined });
127
+ { verb: options.verb, ownerKey: emailKey, selectedOrigin: selected?.url, runtimePort: proxy?.runtimePort, operationToken: operation?.token, dev: adapter.dev, privateSettings, devKey: devKey ?? undefined });
128
+ // A production build never sees the checkout's local settings, whatever the seed's build runs.
129
+ if (options.verb === 'build') await withoutLocalSettings(project.root, { settings: privateSettings, operationToken: operation?.token }, run);
130
+ else await run();
126
131
  if (['setup', 'build'].includes(options.verb)) await refuseDevLayerOutput(project.root, adapter.devIdentity);
132
+ if (options.verb === 'build') await refuseLocalEnvOutput(project.root, adapter.devIdentity?.output);
127
133
  const url = selected?.url;
128
134
  if (options.verb === 'setup') {
129
135
  // Only a connected provider leaves first setup open; a native claim with
@@ -0,0 +1,33 @@
1
+ import { refuse } from './errors.mjs';
2
+ import { shared } from './shared.mjs';
3
+ import { refuseLocalEnvFiles } from '../modules/deploy-kit/local-only.mjs';
4
+
5
+ // Wrangler (and the Cloudflare Vite plugin through it) reads .dev.vars, then .env
6
+ // and process.env, and writes what it read into dist/<worker>/.dev.vars. During a
7
+ // deploy process.env holds the deployment's secrets.
8
+ const switches = { CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV: 'false', CLOUDFLARE_INCLUDE_PROCESS_ENV: 'false' };
9
+
10
+ // Every build rer runs for a deployment, and a seed's own deploy hook, runs with
11
+ // the checkout's local settings files moved aside (restored afterwards, or by the
12
+ // next operation after a hard kill) and those Wrangler sources switched off, so
13
+ // no bundler can copy local credentials into what is uploaded.
14
+ export async function withoutLocalSettings(root, { settings = [], operationToken } = {}, action) {
15
+ const { withoutLocalVariables } = await shared('local/build.mjs');
16
+ const saved = Object.fromEntries(Object.keys(switches).map(key => [key, process.env[key]]));
17
+ return withoutLocalVariables(root, async () => {
18
+ Object.assign(process.env, switches);
19
+ try { return await action(); }
20
+ finally { for (const [key, value] of Object.entries(saved)) { if (value === undefined) delete process.env[key]; else process.env[key] = value; } }
21
+ }, { nested: operationToken, settings: ['.dev.vars', '.dev.vars.previous', ...(Array.isArray(settings) ? settings : []).filter(path => typeof path === 'string')] });
22
+ }
23
+
24
+ // rer build and rer deploy refuse build output that holds a local settings file,
25
+ // naming it. `uploaded` says a deploy hook has already sent its build.
26
+ export async function refuseLocalEnvOutput(root, outputs, { uploaded = false } = {}) {
27
+ try { await refuseLocalEnvFiles(root, outputs ?? ['dist']); }
28
+ catch (error) {
29
+ if (!error.resource) throw error;
30
+ if (uploaded) throw refuse(`The deploy hook's build output holds the local settings file ${error.resource}, and the hook has already uploaded its build, so it may be on the live Worker. Remove what copies it into the build output, rotate every credential in that file, then run rer deploy again.`);
31
+ throw refuse(`The build output holds the local settings file ${error.resource}; a deployment never carries one. Remove what puts it there (a file in public/, or a build step that copies it), then run the command again. Nothing was uploaded.`);
32
+ }
33
+ }
package/cli/parse.mjs CHANGED
@@ -84,9 +84,10 @@ export function parse(argv, cwd = process.cwd(), { independent = false, deferTai
84
84
  if (options.profile !== undefined && options.profile !== 'first-party') throw invalid('The supported explicit profile is first-party.');
85
85
  if (options.environment !== undefined && !/^[a-z][a-z0-9-]{0,39}$/.test(options.environment)) throw invalid('Provide a valid deployment environment name.');
86
86
  for (const key of ['setSecret', 'unsetSecret']) if (options[key] !== undefined && !/^[A-Z][A-Z0-9_]{0,63}$/.test(options[key])) throw invalid('Name a declared secret binding, such as SESSION_SECRET.');
87
- if(verb==='deploy'&&options.demo&&(options.site||['platform','image','bindAddress','httpPort','httpsPort','envFile','host','setSecret','unsetSecret'].some(key=>options[key]!==undefined)))throw invalid('--demo takes only --environment, --dry-run and --remove --yes: the hosted demo is its own Worker on demo.<domain>.');
87
+ if (options.rotateSecret !== undefined && !/^[A-Z][A-Z0-9_]{0,63}(?:,[A-Z][A-Z0-9_]{0,63}){0,15}$/.test(options.rotateSecret)) throw invalid('--rotate-secret names generated secret bindings, separated by commas, such as SESSION_SECRET.');
88
+ if(verb==='deploy'&&options.demo&&(options.site||['platform','image','bindAddress','httpPort','httpsPort','envFile','host','setSecret','unsetSecret','rotateSecret'].some(key=>options[key]!==undefined)))throw invalid('--demo takes only --environment, --dry-run and --remove --yes: the hosted demo is its own Worker on demo.<domain>.');
88
89
  if(verb==='deploy'&&options.demo&&options.remove&&(options.dryRun||!options.yes))throw invalid(options.dryRun?'Use --remove and --dry-run on separate runs.':'deploy --demo --remove deletes the hosted demo\'s Worker, its demo.<domain> Custom Domain. Add --yes to confirm.');
89
- if ((options.remove || options.setSecret || options.unsetSecret) && options.site) throw invalid('--remove, --set-secret and --unset-secret act on the application Worker, not the run site.');
90
+ if ((options.remove || options.setSecret || options.unsetSecret || options.rotateSecret) && options.site) throw invalid('--remove, --set-secret, --unset-secret and --rotate-secret act on the application Worker, not the run site.');
90
91
  if (options.origin !== undefined) {
91
92
  let url; try { url = new URL(options.origin); } catch { throw invalid('Provide a valid credential-free origin.'); }
92
93
  if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== '/') throw invalid('Provide a credential-free HTTP origin without a path.');
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.38
4
+
5
+ - **Local settings never reach a deployment.** `rer build`, the build `rer deploy` runs, and every custom deploy hook now run with the checkout's local settings files (`.dev.vars`, `.env`) moved aside, and Wrangler's `.env` and `process.env` loading is switched off. A hard kill puts the files back on the next run. If build output still holds a `.dev.vars*`, `.env*` or `*.env` file, it is refused, naming the file, before anything is uploaded. This applies to `rer build`, `rer deploy`, the deploy kit, the container image build and the delivery package. Before, a seed whose build copied `.dev.vars` into `dist/client` uploaded it as a public Worker asset, and the demo container image copied `dist/server/.dev.vars`. No live deployment was affected. The Vite plugin that drops these files from every build now lives in onboarding (`@runeditrun/rer/local-variables-output` in package mode), and the seed template uses it too.
6
+ - **Generated deployment secrets are kept and reused.** Secrets rer generates for a deployment, such as the session and subscriber-link keys, are saved in `.rer/deploy/<env>.secrets.env`. The file is owner-only and Git-ignored, and every redeploy reuses it and says so. An existing unsubscribe link stays valid and the operator session stays alive across a redeploy. `--rotate-secret NAME[,NAME]` replaces the named secrets on purpose.
7
+ - **Release note: a custom-hook redeploy without that file now stops instead of rotating.** Custom-hook installs deployed before this release have no `.rer/deploy/<env>.secrets.env`. If the live Worker already holds the secrets, the next redeploy refuses before any upload and names them. Restore the file, or pass `--rotate-secret NAME` to rotate on purpose. Before, the redeploy rotated those secrets silently, which broke existing links and sessions.
8
+
3
9
  ## 0.2.37
4
10
 
5
11
  - **A native demo's D1 answers `withSession`, `dump()` and `meta.size_after`, as production D1 does.** In a native hosted demo, `env.DB.withSession(...)` now returns a session whose `prepare`, `batch` and `getBookmark` work against the visitor's own database. Each visitor's database is a single primary, so every constraint or bookmark is already met and the bookmark stays the same. Before, a seed that read through a session hung: Slate's feature routes never answered. `dump()` now exists and rejects with `D1_DUMP_ERROR`, as production D1 does. Before, Uptime's owner-session revoke bound `db.dump` and answered 503 `auth_unavailable`; it now answers 404 `session_not_found`, once Uptime takes this release. Query `meta` adds `size_after`, which Orbit's archive budget reads.
@@ -9,6 +9,7 @@ import { localDurableObjects } from './durable-objects.mjs';
9
9
  import { readMigrationRewrites, withRewrites } from '../deploy-kit/migrations.mjs';
10
10
  import { containerMigrationInventory } from './migration-inventory.mjs';
11
11
  import { checkImageVariables } from './image-variables.mjs';
12
+ import { refuseLocalEnvFiles } from '../deploy-kit/local-only.mjs';
12
13
  export async function buildContainer(root, options={}) {
13
14
  const previous=process.cwd();process.chdir(root);
14
15
  try{return await buildImage(root,options);}finally{process.chdir(previous);}
@@ -57,6 +58,9 @@ async function buildImage(root, { output = join(root,'.rer/container/image'), en
57
58
  const builder = await vite.createBuilder({ ...config,root,configFile:false }); await builder.buildApp();
58
59
  // Apply the same local-only bundle guard before packaging any container image.
59
60
  await (await import('../../cli/dev-identity.mjs')).refuseDevLayerOutput(root);
61
+ // The image copies dist/ whole: a local settings file there would ship in it.
62
+ try { await refuseLocalEnvFiles(root,['dist']); }
63
+ catch (error) { if (!error.resource) throw error; throw new Error(`The build output holds the local settings file ${error.resource}; a container image never carries one. Remove what copies it into dist/, then build again.`); }
60
64
  let workerConfig;
61
65
  if (engine === 'workerd') {
62
66
  workerConfig = JSON.parse(await readFile(join(root,'dist/server/wrangler.json'),'utf8'));
@@ -115,9 +115,9 @@ A transport failure carries `providerTransport`: the operation, sanitized endpoi
115
115
 
116
116
  `rer deploy` runs these steps for a seed whose adapter uses `ownerDeploy` from `cli/deploy.mjs`.
117
117
 
118
- - **Inputs.** Declared secrets come from the environment, then `--env-file FILE` (an owned 0600 file of `KEY=VALUE` lines), which wins. For a secret the Worker does not hold yet, rer supplies the setup manifest's owner email (`emailField`) from the local setup's private settings, and a fresh random value for each secret field the manifest generates (`generate`), such as the session secret and the setup token; a value the Worker already holds is kept. A still-missing secret stops the run before any write with a message that names it, unless its declaration says `"optional": true`: then the deploy binds nothing for it and reports it as not set, and `--set-secret` adds it later.
118
+ - **Inputs.** Declared secrets come from the environment, then `--env-file FILE` (an owned 0600 file of `KEY=VALUE` lines), which wins. For a secret the Worker does not hold yet, rer supplies the setup manifest's owner email (`emailField`) from the local setup's private settings, and for each secret field the manifest generates (`generate`) the value rer keeps for this environment in `.rer/deploy/<environment>.secrets.env` (0600, ignored by Git), else a fresh random value, which rer keeps once the Worker holds it (the one-time setup token is always fresh and never kept); a value the Worker already holds is kept. The build runs with the checkout's local settings files moved aside, and a `dist/` holding a `.dev.vars*`, `.env*` or `*.env` file is refused by name before any provider request. A still-missing secret stops the run before any write with a message that names it, unless its declaration says `"optional": true`: then the deploy binds nothing for it and reports it as not set, and `--set-secret` adds it later.
119
119
  - **Hosted owner.** After deploy and health pass, rer claims the setup owner on the hosted app: it POSTs the setup token to the seed's standard owner step (`hooks.owner`, by default `/auth/bootstrap`). 303 means claimed; `409 already_initialized` means an owner was already claimed and is kept. Then rer deletes the token secret from the Worker, records the new Worker version in the state file, and lists the token in `retiredSecrets`, so later plans no longer declare it. The build fingerprint still names it, and the recorded claim stays as recorded, so an untouched repeat deploy writes nothing. A Worker that still holds a token rer did not upload in this run (an older deploy) first gets a fresh token through the same recorded secret change. Dependency approvals that need the token run before the claim. A seed with an owner step function, an identity-provider claim, or no declared token secret claims its owner its own way.
120
- - **Secret changes.** `rer deploy --set-secret NAME` (value from the environment or `--env-file`, under the declaration's environment name) and `--unset-secret NAME` change one declared secret of the recorded Worker without a build. Before writing, rer records the starting version and the exact live names of all other secrets, never their values. Accepted or ambiguous writes retain that intent until readback confirms the change; explicit refusals clear it. An ambiguous failure, or a later command's preflight, can clear an unapplied intent only when the live deployment still matches the receipt and the newest listed version matches it too. A surviving intent blocks further mutations until consistency returns; retry the same command then. Recovery requires the recorded immediate successor (or the recorded confirming rotation's successor), the receipt's script etag and fingerprint, the intended binding's presence, and an unchanged set of other secret names. Ambiguous rotations require a confirming PUT before reporting success. Older intents without names may recover only from the exact starting version's historical bindings, with its id, etag and fingerprint verified; unavailable or malformed historical bindings refuse adoption. Each historical binding must have an exact provider type supported by this kit; unrecognized types cannot prove that a name was not a secret. Added, removed or renamed other secrets refuse deploy and removal before writes. Values remain opaque: these checks cannot distinguish an otherwise identical outside change to the pending binding.
120
+ - **Secret changes.** `rer deploy --set-secret NAME` (value from the environment or `--env-file`, under the declaration's environment name), `--unset-secret NAME` and `--rotate-secret NAME[,NAME]` (a fresh value for a secret rer generates, kept in `.rer/deploy/<environment>.secrets.env` once set) change declared secrets of the recorded Worker without a build. Before writing, rer records the starting version and the exact live names of all other secrets, never their values. Accepted or ambiguous writes retain that intent until readback confirms the change; explicit refusals clear it. An ambiguous failure, or a later command's preflight, can clear an unapplied intent only when the live deployment still matches the receipt and the newest listed version matches it too. A surviving intent blocks further mutations until consistency returns; retry the same command then. Recovery requires the recorded immediate successor (or the recorded confirming rotation's successor), the receipt's script etag and fingerprint, the intended binding's presence, and an unchanged set of other secret names. Ambiguous rotations require a confirming PUT before reporting success. Older intents without names may recover only from the exact starting version's historical bindings, with its id, etag and fingerprint verified; unavailable or malformed historical bindings refuse adoption. Each historical binding must have an exact provider type supported by this kit; unrecognized types cannot prove that a name was not a secret. Added, removed or renamed other secrets refuse deploy and removal before writes. Values remain opaque: these checks cannot distinguish an otherwise identical outside change to the pending binding.
121
121
  - **Removal.** `rer deploy --remove --yes` deletes what the state file says rer created for this environment: the Worker (schedules first; its Durable Objects go with it) and each D1, R2, KV and queue that is still the one rer created, after checking all of them before the first delete. A replaced or uncertain resource refuses the whole removal, except a D1 or KV whose create answer was lost: under this environment's derived name it is deleted once confirmed empty (a D1 with no tables, a KV namespace with no keys); one holding data is refused as `uncertain-resource-not-empty`, and an uncertain queue, whose backlog rer cannot read, as `uncertain-resource-unverifiable` (delete it by hand if it is the empty one from the interrupted run).
122
122
 
123
123
  R2 removal requires a saved `created` identity (the bucket's creation date). Pending buckets or buckets missing that identity are refused as `uncertain-resource-create`, and same-named replacements as `owned-resource-replaced`, even if empty. For a confirmed bucket, removal automatically lists and deletes its objects before deleting the bucket, checking its identity again before every object delete and the bucket delete. Serialize outside bucket deletion and recreation with removal: the provider cannot make a delete conditional on that identity.
@@ -1,5 +1,5 @@
1
- import { lstat } from 'node:fs/promises';
2
- import { join } from 'node:path';
1
+ import { lstat, readdir } from 'node:fs/promises';
2
+ import { join, relative } from 'node:path';
3
3
 
4
4
  export const LOCAL_MODELS_FILE = '.rer/local/models.json';
5
5
  /** Refuse presence, including symlinks: never read this key to build a plan. */
@@ -8,3 +8,21 @@ export async function refuseLocalModels(root) {
8
8
  catch (error) { if (error.code === 'ENOENT') return; throw error; }
9
9
  throw new Error('local-only-models-file');
10
10
  }
11
+
12
+ /** A local settings file: .dev.vars or .env with any suffix (.dev.vars.production,
13
+ * .env.local), or a NAME.env file such as rer's own dev-key.env. */
14
+ export const localEnvFile = path => /(?:^|\/)(?:\.dev\.vars(?:\.[^/]*)?|\.env(?:\.[^/]*)?|[^/]+\.env)$/.test(path);
15
+
16
+ /** Refuse build output that holds a local settings file, by presence alone: the
17
+ * Cloudflare Vite plugin copies .dev.vars into dist/<worker>/ for preview, and a
18
+ * deployment never carries one. The error names the first file, relative to root;
19
+ * its contents are never read. */
20
+ export async function refuseLocalEnvFiles(root, directories) {
21
+ for (const directory of directories) {
22
+ let entries;
23
+ try { entries = await readdir(join(root, directory), { withFileTypes: true, recursive: true }); }
24
+ catch (error) { if (error.code === 'ENOENT') continue; throw error; }
25
+ const found = entries.map(entry => relative(root, join(entry.parentPath, entry.name)).split('\\').join('/')).filter(localEnvFile).sort()[0];
26
+ if (found) throw Object.assign(new Error('local-env-file-in-build-output'), { resource: found });
27
+ }
28
+ }
@@ -5,7 +5,7 @@ import { pathToFileURL } from 'node:url';
5
5
  import { assert, hash, localPath } from './validation.mjs';
6
6
  import { assetsIgnore, collectFiles, regularBytes, validateArtifact, MAX_ARTIFACT } from './artifact.mjs';
7
7
  import { collectBuildModules } from './build-modules.mjs';
8
- import { refuseLocalModels } from './local-only.mjs';
8
+ import { refuseLocalEnvFiles, refuseLocalModels } from './local-only.mjs';
9
9
  import { readMigrationRewrites, withRewrites } from './migrations.mjs';
10
10
 
11
11
  export function assertCredentialFree(env) {
@@ -21,6 +21,7 @@ export async function packageBuild({root,source,runIdentity,productDirectory = '
21
21
  const product = join(root,productDirectory);
22
22
  await refuseLocalModels(root);
23
23
  if (product !== root) await refuseLocalModels(product);
24
+ await refuseLocalEnvFiles(root, [join(productDirectory,'dist/server'), join(productDirectory,'dist/client')]);
24
25
  const build = join(product,'dist/server');
25
26
  const config = JSON.parse(await regularBytes(join(build,'wrangler.json'),1024*1024));
26
27
  const main = localPath(relative(build,resolve(build,config.main)));
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'vite';
2
+ export function excludeLocalVariables(): Plugin;
@@ -0,0 +1,21 @@
1
+ // The Cloudflare Vite plugin serialises .dev.vars (or .env, or process
2
+ // variables) into dist/<worker>/.dev.vars for `vite preview`. Every build,
3
+ // including a direct `vite build`, drops local settings files before they are
4
+ // written: local credentials never reach dist/, and so never a deployment.
5
+ // rer build and rer deploy also run builds with these files moved aside and
6
+ // refuse output that still holds one, naming it.
7
+ const localVariables = fileName => /(?:^|\/)(?:\.dev\.vars|\.env)(?:\.[^/]*)?$/.test(fileName);
8
+
9
+ export function excludeLocalVariables() {
10
+ return {
11
+ name: 'rer:exclude-local-variables',
12
+ apply: 'build',
13
+ enforce: 'post',
14
+ generateBundle: {
15
+ order: 'post',
16
+ handler(_options, bundle) {
17
+ for (const fileName of Object.keys(bundle)) if (localVariables(fileName)) delete bundle[fileName];
18
+ },
19
+ },
20
+ };
21
+ }
@@ -37,7 +37,7 @@ const PRIVATE_VALUE = `(?:${DOUBLE_QUOTED}(?:"|(?=[\\r\\n]|$))|${SINGLE_QUOTED}(
37
37
  const FIELD_VALUE = '["\']?\\s*[=:]\\s*' + NOT_FLAG + PRIVATE_VALUE;
38
38
  // These deploy flags take a binding name, never the secret value. Explicitly
39
39
  // registered private bytes remain redacted by the exact-value pass.
40
- const CLI_PREFIX = '(?<![A-Za-z0-9_-])--(?!(?:set|unset)-secret(?:\\s|$))(?:[A-Za-z0-9]+[_-])*';
40
+ const CLI_PREFIX = '(?<![A-Za-z0-9_-])--(?!(?:set|unset|rotate)-secret(?:\\s|$))(?:[A-Za-z0-9]+[_-])*';
41
41
  const CLI_ARGUMENT = CLI_PREFIX + '(' + FIELD_NAME + ')\\s+' + NOT_FLAG + '(' + PRIVATE_VALUE + ')';
42
42
  // A bare Bearer/Basic value must look like a credential, not the next word of
43
43
  // prose such as "Basic checks passed"; after Authorization any value is private.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,6 +46,10 @@
46
46
  "types": "./onboarding/archive-output.d.mts",
47
47
  "default": "./onboarding/archive-output.mjs"
48
48
  },
49
+ "./local-variables-output": {
50
+ "types": "./onboarding/local-variables-output.d.mts",
51
+ "default": "./onboarding/local-variables-output.mjs"
52
+ },
49
53
  "./launcher": "./onboarding/launcher.mjs",
50
54
  "./installer-server": "./onboarding/server.mjs",
51
55
  "./server-resources": "./cli/server-resources.mjs",