@clef-sh/cli 0.1.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/bin/clef.js +2 -0
- package/dist/commands/delete.d.ts +6 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +130 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/diff.d.ts +6 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +168 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +6 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +331 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/exec.d.ts +6 -0
- package/dist/commands/exec.d.ts.map +1 -0
- package/dist/commands/exec.js +187 -0
- package/dist/commands/exec.js.map +1 -0
- package/dist/commands/export.d.ts +6 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +110 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/get.d.ts +6 -0
- package/dist/commands/get.d.ts.map +1 -0
- package/dist/commands/get.js +85 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/hooks.d.ts +6 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +89 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/import.d.ts +6 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +210 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +499 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +6 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +152 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/merge-driver.d.ts +6 -0
- package/dist/commands/merge-driver.d.ts.map +1 -0
- package/dist/commands/merge-driver.js +152 -0
- package/dist/commands/merge-driver.js.map +1 -0
- package/dist/commands/recipients.d.ts +7 -0
- package/dist/commands/recipients.d.ts.map +1 -0
- package/dist/commands/recipients.js +316 -0
- package/dist/commands/recipients.js.map +1 -0
- package/dist/commands/rotate.d.ts +6 -0
- package/dist/commands/rotate.d.ts.map +1 -0
- package/dist/commands/rotate.js +97 -0
- package/dist/commands/rotate.js.map +1 -0
- package/dist/commands/scan.d.ts +6 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +152 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/set.d.ts +6 -0
- package/dist/commands/set.d.ts.map +1 -0
- package/dist/commands/set.js +137 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/ui.d.ts +7 -0
- package/dist/commands/ui.d.ts.map +1 -0
- package/dist/commands/ui.js +100 -0
- package/dist/commands/ui.js.map +1 -0
- package/dist/commands/update.d.ts +6 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +119 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatter.d.ts +20 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +191 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/symbols.d.ts +21 -0
- package/dist/output/symbols.d.ts.map +1 -0
- package/dist/output/symbols.js +59 -0
- package/dist/output/symbols.js.map +1 -0
- package/dist/subprocess.d.ts +5 -0
- package/dist/subprocess.d.ts.map +1 -0
- package/dist/subprocess.js +27 -0
- package/dist/subprocess.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.waitForEnter = waitForEnter;
|
|
37
|
+
exports.registerRecipientsCommand = registerRecipientsCommand;
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const readline = __importStar(require("readline"));
|
|
40
|
+
const core_1 = require("@clef-sh/core");
|
|
41
|
+
const formatter_1 = require("../output/formatter");
|
|
42
|
+
const symbols_1 = require("../output/symbols");
|
|
43
|
+
function waitForEnter(message) {
|
|
44
|
+
return new Promise((resolve) => {
|
|
45
|
+
const rl = readline.createInterface({
|
|
46
|
+
input: process.stdin,
|
|
47
|
+
output: process.stderr,
|
|
48
|
+
});
|
|
49
|
+
rl.question(message, () => {
|
|
50
|
+
rl.close();
|
|
51
|
+
resolve();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function registerRecipientsCommand(program, deps) {
|
|
56
|
+
const recipientsCmd = program
|
|
57
|
+
.command("recipients")
|
|
58
|
+
.description("Manage age recipients that can decrypt this repository.");
|
|
59
|
+
// --- list ---
|
|
60
|
+
recipientsCmd
|
|
61
|
+
.command("list")
|
|
62
|
+
.description("List all age recipients configured for this repository.")
|
|
63
|
+
.option("-e, --environment <env>", "List recipients for a specific environment")
|
|
64
|
+
.action(async (opts) => {
|
|
65
|
+
try {
|
|
66
|
+
const repoRoot = program.opts().repo || process.cwd();
|
|
67
|
+
const parser = new core_1.ManifestParser();
|
|
68
|
+
const manifest = parser.parse(path.join(repoRoot, "clef.yaml"));
|
|
69
|
+
if (opts.environment) {
|
|
70
|
+
const env = manifest.environments.find((e) => e.name === opts.environment);
|
|
71
|
+
if (!env) {
|
|
72
|
+
formatter_1.formatter.error(`Environment '${opts.environment}' not found. Available: ${manifest.environments.map((e) => e.name).join(", ")}`);
|
|
73
|
+
process.exit(2);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const matrixManager = new core_1.MatrixManager();
|
|
78
|
+
const sopsClient = new core_1.SopsClient(deps.runner);
|
|
79
|
+
const recipientManager = new core_1.RecipientManager(sopsClient, matrixManager);
|
|
80
|
+
const recipients = await recipientManager.list(manifest, repoRoot, opts.environment);
|
|
81
|
+
if (recipients.length === 0) {
|
|
82
|
+
const scope = opts.environment ? ` for environment '${opts.environment}'` : "";
|
|
83
|
+
formatter_1.formatter.info(`No recipients configured${scope}.`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const count = recipients.length;
|
|
87
|
+
const scope = opts.environment ? ` (${opts.environment})` : "";
|
|
88
|
+
formatter_1.formatter.print(`${(0, symbols_1.sym)("recipient")} ${count} recipient${count !== 1 ? "s" : ""}${scope}\n`);
|
|
89
|
+
for (const r of recipients) {
|
|
90
|
+
formatter_1.formatter.recipientItem(r.label || r.preview, r.label ? r.preview : "");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err instanceof core_1.SopsMissingError || err instanceof core_1.SopsVersionError) {
|
|
95
|
+
formatter_1.formatter.formatDependencyError(err);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
formatter_1.formatter.error(err.message);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// --- add ---
|
|
104
|
+
recipientsCmd
|
|
105
|
+
.command("add <key>")
|
|
106
|
+
.description("Add an age recipient and re-encrypt all files in the matrix.")
|
|
107
|
+
.option("--label <name>", "Human-readable label for this recipient")
|
|
108
|
+
.option("-e, --environment <env>", "Scope recipient to a specific environment")
|
|
109
|
+
.action(async (key, opts) => {
|
|
110
|
+
try {
|
|
111
|
+
const repoRoot = program.opts().repo || process.cwd();
|
|
112
|
+
// Validate key format before anything else
|
|
113
|
+
const validation = (0, core_1.validateAgePublicKey)(key);
|
|
114
|
+
if (!validation.valid) {
|
|
115
|
+
formatter_1.formatter.error(validation.error);
|
|
116
|
+
process.exit(2);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const parser = new core_1.ManifestParser();
|
|
120
|
+
const manifest = parser.parse(path.join(repoRoot, "clef.yaml"));
|
|
121
|
+
if (opts.environment) {
|
|
122
|
+
const env = manifest.environments.find((e) => e.name === opts.environment);
|
|
123
|
+
if (!env) {
|
|
124
|
+
formatter_1.formatter.error(`Environment '${opts.environment}' not found. Available: ${manifest.environments.map((e) => e.name).join(", ")}`);
|
|
125
|
+
process.exit(2);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const matrixManager = new core_1.MatrixManager();
|
|
130
|
+
const sopsClient = new core_1.SopsClient(deps.runner);
|
|
131
|
+
const recipientManager = new core_1.RecipientManager(sopsClient, matrixManager);
|
|
132
|
+
// Check for duplicate before prompting
|
|
133
|
+
const existing = await recipientManager.list(manifest, repoRoot, opts.environment);
|
|
134
|
+
const normalizedKey = validation.key;
|
|
135
|
+
if (existing.some((r) => r.key === normalizedKey)) {
|
|
136
|
+
formatter_1.formatter.error(`Recipient '${(0, core_1.keyPreview)(normalizedKey)}' is already present.`);
|
|
137
|
+
process.exit(2);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Count files for the confirmation message
|
|
141
|
+
const allCells = matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists);
|
|
142
|
+
const cells = opts.environment
|
|
143
|
+
? allCells.filter((c) => c.environment === opts.environment)
|
|
144
|
+
: allCells;
|
|
145
|
+
const fileCount = cells.length;
|
|
146
|
+
// Show confirmation prompt
|
|
147
|
+
const scope = opts.environment ? ` for environment '${opts.environment}'` : "";
|
|
148
|
+
formatter_1.formatter.print(`Add recipient to this repository${scope}?\n`);
|
|
149
|
+
formatter_1.formatter.print(` Key: ${(0, core_1.keyPreview)(normalizedKey)}`);
|
|
150
|
+
if (opts.label) {
|
|
151
|
+
formatter_1.formatter.print(` Label: ${opts.label}`);
|
|
152
|
+
}
|
|
153
|
+
formatter_1.formatter.print(`\nThis will re-encrypt ${fileCount} files in the matrix.`);
|
|
154
|
+
if (opts.environment) {
|
|
155
|
+
formatter_1.formatter.print(`The new recipient will be able to decrypt '${opts.environment}' secrets.\n`);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
formatter_1.formatter.print("The new recipient will be able to decrypt all secrets.\n");
|
|
159
|
+
}
|
|
160
|
+
const confirmed = await formatter_1.formatter.confirm("Proceed?");
|
|
161
|
+
if (!confirmed) {
|
|
162
|
+
formatter_1.formatter.info("Aborted.");
|
|
163
|
+
process.exit(0);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// Show progress
|
|
167
|
+
formatter_1.formatter.print(`\n${(0, symbols_1.sym)("working")} Re-encrypting matrix...`);
|
|
168
|
+
const result = await recipientManager.add(normalizedKey, opts.label, manifest, repoRoot, opts.environment);
|
|
169
|
+
// Check for rollback (failedFiles indicates failure)
|
|
170
|
+
if (result.failedFiles.length > 0) {
|
|
171
|
+
const failedFile = result.failedFiles[0];
|
|
172
|
+
formatter_1.formatter.print(`\n${(0, symbols_1.sym)("failure")} Re-encryption failed on ${path.basename(failedFile)}`);
|
|
173
|
+
formatter_1.formatter.print(` Error: re-encryption failed`);
|
|
174
|
+
formatter_1.formatter.print("\nRolling back...");
|
|
175
|
+
formatter_1.formatter.print(` ${(0, symbols_1.sym)("success")} clef.yaml restored`);
|
|
176
|
+
formatter_1.formatter.print(` ${(0, symbols_1.sym)("success")} ${result.reEncryptedFiles.length} re-encrypted files restored from backup`);
|
|
177
|
+
formatter_1.formatter.print("\nNo changes were applied. Investigate the error above and retry.");
|
|
178
|
+
process.exit(1);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// Show success progress
|
|
182
|
+
for (const file of result.reEncryptedFiles) {
|
|
183
|
+
const relative = path.relative(repoRoot, file);
|
|
184
|
+
formatter_1.formatter.print(` ${(0, symbols_1.sym)("success")} ${relative}`);
|
|
185
|
+
}
|
|
186
|
+
const label = opts.label || (0, core_1.keyPreview)(normalizedKey);
|
|
187
|
+
const envSuffix = opts.environment ? ` [${opts.environment}]` : "";
|
|
188
|
+
formatter_1.formatter.success(`${label} added. ${result.reEncryptedFiles.length} files re-encrypted. ${(0, symbols_1.sym)("locked")}`);
|
|
189
|
+
formatter_1.formatter.hint(`git add clef.yaml && git add -A && git commit -m "add recipient: ${label}${envSuffix}"`);
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
if (err instanceof core_1.SopsMissingError || err instanceof core_1.SopsVersionError) {
|
|
193
|
+
formatter_1.formatter.formatDependencyError(err);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
formatter_1.formatter.error(err.message);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
// --- remove ---
|
|
202
|
+
recipientsCmd
|
|
203
|
+
.command("remove <key>")
|
|
204
|
+
.description("Remove an age recipient and re-encrypt all files in the matrix.")
|
|
205
|
+
.option("-e, --environment <env>", "Scope removal to a specific environment")
|
|
206
|
+
.action(async (key, opts) => {
|
|
207
|
+
try {
|
|
208
|
+
// Non-TTY check — must be interactive
|
|
209
|
+
if (!process.stdin.isTTY) {
|
|
210
|
+
formatter_1.formatter.error("clef recipients remove requires interactive input.\n" +
|
|
211
|
+
"Recipient management should not be automated in CI.");
|
|
212
|
+
process.exit(2);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const repoRoot = program.opts().repo || process.cwd();
|
|
216
|
+
const parser = new core_1.ManifestParser();
|
|
217
|
+
const manifest = parser.parse(path.join(repoRoot, "clef.yaml"));
|
|
218
|
+
if (opts.environment) {
|
|
219
|
+
const env = manifest.environments.find((e) => e.name === opts.environment);
|
|
220
|
+
if (!env) {
|
|
221
|
+
formatter_1.formatter.error(`Environment '${opts.environment}' not found. Available: ${manifest.environments.map((e) => e.name).join(", ")}`);
|
|
222
|
+
process.exit(2);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const matrixManager = new core_1.MatrixManager();
|
|
227
|
+
const sopsClient = new core_1.SopsClient(deps.runner);
|
|
228
|
+
const recipientManager = new core_1.RecipientManager(sopsClient, matrixManager);
|
|
229
|
+
// Verify recipient exists
|
|
230
|
+
const existing = await recipientManager.list(manifest, repoRoot, opts.environment);
|
|
231
|
+
const trimmedKey = key.trim();
|
|
232
|
+
const target = existing.find((r) => r.key === trimmedKey);
|
|
233
|
+
if (!target) {
|
|
234
|
+
formatter_1.formatter.error(`Recipient '${(0, core_1.keyPreview)(trimmedKey)}' is not in the manifest.`);
|
|
235
|
+
process.exit(2);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
// Mandatory re-encryption warning — cannot be bypassed
|
|
239
|
+
formatter_1.formatter.warn("Important: re-encryption is not full revocation.\n\n" +
|
|
240
|
+
" Removing a recipient re-encrypts all files so the\n" +
|
|
241
|
+
" removed key cannot decrypt future versions. However,\n" +
|
|
242
|
+
" if the removed recipient previously had access, they\n" +
|
|
243
|
+
" may have decrypted values cached locally.\n\n" +
|
|
244
|
+
" To fully revoke access, you must also rotate the\n" +
|
|
245
|
+
" secret values themselves using clef rotate.\n");
|
|
246
|
+
await waitForEnter(" Press Enter to continue, or Ctrl+C to cancel.\n");
|
|
247
|
+
// Count files for confirmation
|
|
248
|
+
const allCells = matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists);
|
|
249
|
+
const cells = opts.environment
|
|
250
|
+
? allCells.filter((c) => c.environment === opts.environment)
|
|
251
|
+
: allCells;
|
|
252
|
+
const fileCount = cells.length;
|
|
253
|
+
const label = target.label || (0, core_1.keyPreview)(trimmedKey);
|
|
254
|
+
// Show confirmation prompt
|
|
255
|
+
const scope = opts.environment ? ` for environment '${opts.environment}'` : "";
|
|
256
|
+
formatter_1.formatter.print(`Remove recipient from this repository${scope}?\n`);
|
|
257
|
+
formatter_1.formatter.print(` Key: ${target.preview}`);
|
|
258
|
+
if (target.label) {
|
|
259
|
+
formatter_1.formatter.print(` Label: ${target.label}`);
|
|
260
|
+
}
|
|
261
|
+
formatter_1.formatter.print(`\nThis will re-encrypt ${fileCount} files in the matrix.`);
|
|
262
|
+
formatter_1.formatter.print(`${label} will not be able to decrypt new versions of these files.\n`);
|
|
263
|
+
formatter_1.formatter.warn("Remember: rotate secrets after removing a recipient.\n" +
|
|
264
|
+
` Run: clef rotate <namespace>/<environment>`);
|
|
265
|
+
const confirmed = await formatter_1.formatter.confirm("\nProceed?");
|
|
266
|
+
if (!confirmed) {
|
|
267
|
+
formatter_1.formatter.info("Aborted.");
|
|
268
|
+
process.exit(0);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// Show progress
|
|
272
|
+
formatter_1.formatter.print(`\n${(0, symbols_1.sym)("working")} Re-encrypting matrix...`);
|
|
273
|
+
const result = await recipientManager.remove(trimmedKey, manifest, repoRoot, opts.environment);
|
|
274
|
+
// Check for rollback
|
|
275
|
+
if (result.failedFiles.length > 0) {
|
|
276
|
+
const failedFile = result.failedFiles[0];
|
|
277
|
+
formatter_1.formatter.print(`\n${(0, symbols_1.sym)("failure")} Re-encryption failed on ${path.basename(failedFile)}`);
|
|
278
|
+
formatter_1.formatter.print(` Error: re-encryption failed`);
|
|
279
|
+
formatter_1.formatter.print("\nRolling back...");
|
|
280
|
+
formatter_1.formatter.print(` ${(0, symbols_1.sym)("success")} clef.yaml restored`);
|
|
281
|
+
formatter_1.formatter.print(` ${(0, symbols_1.sym)("success")} ${result.reEncryptedFiles.length} re-encrypted files restored from backup`);
|
|
282
|
+
formatter_1.formatter.print("\nNo changes were applied. Investigate the error above and retry.");
|
|
283
|
+
process.exit(1);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
// Show success progress
|
|
287
|
+
for (const file of result.reEncryptedFiles) {
|
|
288
|
+
const relative = path.relative(repoRoot, file);
|
|
289
|
+
formatter_1.formatter.print(` ${(0, symbols_1.sym)("success")} ${relative}`);
|
|
290
|
+
}
|
|
291
|
+
formatter_1.formatter.success(`${label} removed. ${result.reEncryptedFiles.length} files re-encrypted. ${(0, symbols_1.sym)("locked")}`);
|
|
292
|
+
// Rotation reminder — scope to affected environments
|
|
293
|
+
formatter_1.formatter.warn("Rotate secrets to complete revocation:");
|
|
294
|
+
const targetEnvs = opts.environment
|
|
295
|
+
? manifest.environments.filter((e) => e.name === opts.environment)
|
|
296
|
+
: manifest.environments;
|
|
297
|
+
for (const ns of manifest.namespaces) {
|
|
298
|
+
for (const env of targetEnvs) {
|
|
299
|
+
formatter_1.formatter.hint(`clef rotate ${ns.name}/${env.name}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const envSuffix = opts.environment ? ` [${opts.environment}]` : "";
|
|
303
|
+
formatter_1.formatter.hint(`git add clef.yaml && git add -A && git commit -m "remove recipient: ${label}${envSuffix}"`);
|
|
304
|
+
}
|
|
305
|
+
catch (err) {
|
|
306
|
+
if (err instanceof core_1.SopsMissingError || err instanceof core_1.SopsVersionError) {
|
|
307
|
+
formatter_1.formatter.formatDependencyError(err);
|
|
308
|
+
process.exit(1);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
formatter_1.formatter.error(err.message);
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=recipients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipients.js","sourceRoot":"","sources":["../../src/commands/recipients.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,oCAWC;AAED,8DAmVC;AAjXD,2CAA6B;AAC7B,mDAAqC;AAErC,wCAUuB;AACvB,mDAAgD;AAChD,+CAAwC;AAExC,SAAgB,YAAY,CAAC,OAAe;IAC1C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YAClC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QACH,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;YACxB,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,yBAAyB,CACvC,OAAgB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GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,uBAAgB,IAAI,GAAG,YAAY,uBAAgB,EAAE,CAAC;gBACvE,qBAAS,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAChB,OAAO;YACT,CAAC;YACD,qBAAS,CAAC,KAAK,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../../src/commands/rotate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAML,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAIvB,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAgEhG"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerRotateCommand = registerRotateCommand;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const core_1 = require("@clef-sh/core");
|
|
39
|
+
const formatter_1 = require("../output/formatter");
|
|
40
|
+
const symbols_1 = require("../output/symbols");
|
|
41
|
+
function registerRotateCommand(program, deps) {
|
|
42
|
+
program
|
|
43
|
+
.command("rotate <target>")
|
|
44
|
+
.description("Rotate encryption key for a namespace/environment file.\n\n" +
|
|
45
|
+
" target: namespace/environment (e.g. payments/production)\n" +
|
|
46
|
+
" --new-key: the new age public key to add (required)\n\n" +
|
|
47
|
+
"Exit codes:\n" +
|
|
48
|
+
" 0 key rotated successfully\n" +
|
|
49
|
+
" 1 operation failed")
|
|
50
|
+
.requiredOption("--new-key <key>", "New age public key to rotate to")
|
|
51
|
+
.action(async (target, options) => {
|
|
52
|
+
try {
|
|
53
|
+
const [namespace, environment] = parseTarget(target);
|
|
54
|
+
const repoRoot = program.opts().repo || process.cwd();
|
|
55
|
+
const parser = new core_1.ManifestParser();
|
|
56
|
+
const manifest = parser.parse(path.join(repoRoot, "clef.yaml"));
|
|
57
|
+
// Check for protected environment
|
|
58
|
+
const matrixManager = new core_1.MatrixManager();
|
|
59
|
+
if (matrixManager.isProtectedEnvironment(manifest, environment)) {
|
|
60
|
+
const confirmed = await formatter_1.formatter.confirm(`${environment} is a protected environment. Rotate key anyway?`);
|
|
61
|
+
if (!confirmed) {
|
|
62
|
+
formatter_1.formatter.info("Rotation cancelled.");
|
|
63
|
+
process.exit(0);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const filePath = path.join(repoRoot, manifest.file_pattern
|
|
68
|
+
.replace("{namespace}", namespace)
|
|
69
|
+
.replace("{environment}", environment));
|
|
70
|
+
const sopsClient = new core_1.SopsClient(deps.runner);
|
|
71
|
+
const relativeFile = manifest.file_pattern
|
|
72
|
+
.replace("{namespace}", namespace)
|
|
73
|
+
.replace("{environment}", environment);
|
|
74
|
+
formatter_1.formatter.print(`${(0, symbols_1.sym)("working")} Rotating ${namespace}/${environment}...`);
|
|
75
|
+
await sopsClient.reEncrypt(filePath, options.newKey);
|
|
76
|
+
formatter_1.formatter.success(`Rotated. New values encrypted. ${(0, symbols_1.sym)("locked")}`);
|
|
77
|
+
formatter_1.formatter.hint(`git add ${relativeFile} && git commit -m "rotate: ${namespace}/${environment}"`);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
if (err instanceof core_1.SopsMissingError || err instanceof core_1.SopsVersionError) {
|
|
81
|
+
formatter_1.formatter.formatDependencyError(err);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
formatter_1.formatter.error(err.message);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function parseTarget(target) {
|
|
91
|
+
const parts = target.split("/");
|
|
92
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
93
|
+
throw new Error(`Invalid target "${target}". Expected format: namespace/environment`);
|
|
94
|
+
}
|
|
95
|
+
return [parts[0], parts[1]];
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=rotate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotate.js","sourceRoot":"","sources":["../../src/commands/rotate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,sDAgEC;AA7ED,2CAA6B;AAE7B,wCAOuB;AACvB,mDAAgD;AAChD,+CAAwC;AAExC,SAAgB,qBAAqB,CAAC,OAAgB,EAAE,IAAkC;IACxF,OAAO;SACJ,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CACV,6DAA6D;QAC3D,kEAAkE;QAClE,4DAA4D;QAC5D,eAAe;QACf,iCAAiC;QACjC,uBAAuB,CAC1B;SACA,cAAc,CAAC,iBAAiB,EAAE,iCAAiC,CAAC;SACpE,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,OAA2B,EAAE,EAAE;QAC5D,IAAI,CAAC;YACH,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAI,OAAO,CAAC,IAAI,EAAE,CAAC,IAAe,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAElE,MAAM,MAAM,GAAG,IAAI,qBAAc,EAAE,CAAC;YACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;YAEhE,kCAAkC;YAClC,MAAM,aAAa,GAAG,IAAI,oBAAa,EAAE,CAAC;YAC1C,IAAI,aAAa,CAAC,sBAAsB,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,CAAC;gBAChE,MAAM,SAAS,GAAG,MAAM,qBAAS,CAAC,OAAO,CACvC,GAAG,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AAC,OAAO,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,2CAA2C,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAIL,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AAIvB,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAqF9F"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.registerScanCommand = registerScanCommand;
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
42
|
+
const core_1 = require("@clef-sh/core");
|
|
43
|
+
const formatter_1 = require("../output/formatter");
|
|
44
|
+
const symbols_1 = require("../output/symbols");
|
|
45
|
+
function registerScanCommand(program, deps) {
|
|
46
|
+
program
|
|
47
|
+
.command("scan [paths...]")
|
|
48
|
+
.description("Scan the repository for secrets that have escaped the Clef matrix.\n\n" +
|
|
49
|
+
"Exit codes:\n" +
|
|
50
|
+
" 0 No issues found\n" +
|
|
51
|
+
" 1 Issues found\n" +
|
|
52
|
+
" 2 Scan could not complete (manifest missing, permission error)")
|
|
53
|
+
.option("--staged", "Only scan files staged for commit")
|
|
54
|
+
.option("--severity <level>", "Detection level: all (patterns+entropy) or high (patterns only)", "all")
|
|
55
|
+
.option("--json", "Output machine-readable JSON")
|
|
56
|
+
.action(async (paths, options) => {
|
|
57
|
+
const repoRoot = program.opts().repo || process.cwd();
|
|
58
|
+
let manifest;
|
|
59
|
+
try {
|
|
60
|
+
const parser = new core_1.ManifestParser();
|
|
61
|
+
manifest = parser.parse(path.join(repoRoot, "clef.yaml"));
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err instanceof core_1.ManifestValidationError ||
|
|
65
|
+
err.message?.includes("clef.yaml")) {
|
|
66
|
+
formatter_1.formatter.error("No clef.yaml found. Run 'clef init' to set up this repository.");
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
formatter_1.formatter.error(err.message);
|
|
70
|
+
}
|
|
71
|
+
process.exit(2);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const severity = options.severity === "high" ? "high" : "all";
|
|
75
|
+
const scanRunner = new core_1.ScanRunner(deps.runner);
|
|
76
|
+
if (!options.json) {
|
|
77
|
+
formatter_1.formatter.print(picocolors_1.default.dim("Scanning repository for unencrypted secrets..."));
|
|
78
|
+
}
|
|
79
|
+
let result;
|
|
80
|
+
try {
|
|
81
|
+
result = await scanRunner.scan(repoRoot, manifest, {
|
|
82
|
+
stagedOnly: options.staged,
|
|
83
|
+
paths: paths.length > 0 ? paths : undefined,
|
|
84
|
+
severity,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
formatter_1.formatter.error(`Scan failed: ${err.message}`);
|
|
89
|
+
process.exit(2);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (options.json) {
|
|
93
|
+
const totalIssues = result.matches.length + result.unencryptedMatrixFiles.length;
|
|
94
|
+
formatter_1.formatter.raw(JSON.stringify({
|
|
95
|
+
matches: result.matches,
|
|
96
|
+
unencryptedMatrixFiles: result.unencryptedMatrixFiles,
|
|
97
|
+
filesScanned: result.filesScanned,
|
|
98
|
+
filesSkipped: result.filesSkipped,
|
|
99
|
+
durationMs: result.durationMs,
|
|
100
|
+
summary: `${totalIssues} issue${totalIssues !== 1 ? "s" : ""} found`,
|
|
101
|
+
}, null, 2) + "\n");
|
|
102
|
+
const hasIssues = result.matches.length > 0 || result.unencryptedMatrixFiles.length > 0;
|
|
103
|
+
process.exit(hasIssues ? 1 : 0);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
formatScanOutput(result);
|
|
107
|
+
const hasIssues = result.matches.length > 0 || result.unencryptedMatrixFiles.length > 0;
|
|
108
|
+
process.exit(hasIssues ? 1 : 0);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function formatScanOutput(result) {
|
|
112
|
+
const totalIssues = result.matches.length + result.unencryptedMatrixFiles.length;
|
|
113
|
+
const durationSec = (result.durationMs / 1000).toFixed(1);
|
|
114
|
+
formatter_1.formatter.print("");
|
|
115
|
+
// Unencrypted matrix files (errors)
|
|
116
|
+
for (const file of result.unencryptedMatrixFiles) {
|
|
117
|
+
formatter_1.formatter.print(picocolors_1.default.red(`${(0, symbols_1.sym)("failure")} Unencrypted matrix file`));
|
|
118
|
+
formatter_1.formatter.print(` ${picocolors_1.default.white(file)} \u2014 missing ${(0, symbols_1.sym)("locked")}`);
|
|
119
|
+
const base = file.replace(/\.enc\.(yaml|json)$/, "").replace(/\//g, "/");
|
|
120
|
+
formatter_1.formatter.hint(`clef encrypt ${base}`);
|
|
121
|
+
formatter_1.formatter.print("");
|
|
122
|
+
}
|
|
123
|
+
// Pattern and entropy matches (warnings)
|
|
124
|
+
for (const match of result.matches) {
|
|
125
|
+
if (match.matchType === "pattern") {
|
|
126
|
+
formatter_1.formatter.print(picocolors_1.default.yellow(`${(0, symbols_1.sym)("warning")} Pattern match: ${match.patternName}`));
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
formatter_1.formatter.print(picocolors_1.default.yellow(`${(0, symbols_1.sym)("warning")} High entropy value (entropy: ${match.entropy?.toFixed(1)})`));
|
|
130
|
+
}
|
|
131
|
+
formatter_1.formatter.print(` ${picocolors_1.default.white(match.file)}:${match.line}`);
|
|
132
|
+
formatter_1.formatter.print(` ${picocolors_1.default.dim(match.preview)}`);
|
|
133
|
+
if (match.matchType === "pattern") {
|
|
134
|
+
formatter_1.formatter.hint("clef set <namespace>/<env> <KEY>");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const varName = match.preview.split("=")[0] ?? "KEY";
|
|
138
|
+
formatter_1.formatter.hint(`clef set <namespace>/<env> ${varName}`);
|
|
139
|
+
formatter_1.formatter.print(` ${picocolors_1.default.dim("or suppress: add '# clef-ignore' to line")} ${match.line} ${picocolors_1.default.dim("of")} ${match.file}`);
|
|
140
|
+
}
|
|
141
|
+
formatter_1.formatter.print("");
|
|
142
|
+
}
|
|
143
|
+
// Summary
|
|
144
|
+
if (totalIssues === 0) {
|
|
145
|
+
formatter_1.formatter.success(`No issues found \u2014 ${result.filesScanned} files scanned in ${durationSec}s`);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
formatter_1.formatter.print(`${picocolors_1.default.yellow(`${totalIssues} issue${totalIssues !== 1 ? "s" : ""} found`)} in ${result.filesScanned} files (${durationSec}s)`);
|
|
149
|
+
formatter_1.formatter.hint("Add false positives to .clefignore");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kDAqFC;AAlGD,2CAA6B;AAC7B,4DAA4B;AA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