@capraconsulting/cals-cli 3.5.2 → 3.6.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/lib/cals-cli.js +6 -7
- package/lib/cals-cli.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.es.js +13 -342
- package/lib/index.es.js.map +1 -1
- package/lib/index.js +15 -345
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/lib/load-secrets/index.d.ts +0 -2
- package/lib/load-secrets/load-secrets.d.ts +0 -7
- package/lib/load-secrets/types.d.ts +0 -34
package/lib/cals-cli.js
CHANGED
|
@@ -68,7 +68,7 @@ var read__default = /*#__PURE__*/_interopDefaultLegacy(read);
|
|
|
68
68
|
var findUp__default = /*#__PURE__*/_interopDefaultLegacy(findUp);
|
|
69
69
|
var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
|
|
70
70
|
|
|
71
|
-
var version = "3.
|
|
71
|
+
var version = "3.6.0";
|
|
72
72
|
var engines = {
|
|
73
73
|
node: ">=12.0.0"
|
|
74
74
|
};
|
|
@@ -583,7 +583,6 @@ class GitHubService {
|
|
|
583
583
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
584
584
|
this._requestCount++;
|
|
585
585
|
if (options.method !== "GET") {
|
|
586
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
587
586
|
return this.semaphore(() => request(options));
|
|
588
587
|
}
|
|
589
588
|
// Try to cache ETag for GET requests to save on rate limiting.
|
|
@@ -607,7 +606,6 @@ class GitHubService {
|
|
|
607
606
|
}
|
|
608
607
|
const getResponse = async (allowRetry = true) => {
|
|
609
608
|
try {
|
|
610
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
611
609
|
return await request(options);
|
|
612
610
|
}
|
|
613
611
|
catch (e) {
|
|
@@ -736,7 +734,6 @@ class GitHubService {
|
|
|
736
734
|
if (res.organization.repositories.nodes == null) {
|
|
737
735
|
throw new Error("Missing organization nodes");
|
|
738
736
|
}
|
|
739
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
740
737
|
repos.push(...res.organization.repositories.nodes);
|
|
741
738
|
if (!res.organization.repositories.pageInfo.hasNextPage) {
|
|
742
739
|
break;
|
|
@@ -1991,7 +1988,6 @@ async function createChangeSetItemsForTeams(github, definition, org) {
|
|
|
1991
1988
|
});
|
|
1992
1989
|
const overlappingTeams = actualTeams.filter((it) => wantedTeamNames.includes(it.name));
|
|
1993
1990
|
await pMap__default["default"](overlappingTeams, async (actualTeam) => {
|
|
1994
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1995
1991
|
const wantedTeam = teams.find((it) => it.name === actualTeam.name);
|
|
1996
1992
|
const actualMembers = await github.getTeamMemberListIncludingInvited(org, actualTeam);
|
|
1997
1993
|
actualMembers
|
|
@@ -2256,6 +2252,7 @@ async function process$1(reporter, github, definition, getOrg, execute, limitToO
|
|
|
2256
2252
|
timeout: 60000,
|
|
2257
2253
|
}, (err, answer) => {
|
|
2258
2254
|
if (err) {
|
|
2255
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
2259
2256
|
reject(err);
|
|
2260
2257
|
}
|
|
2261
2258
|
resolve(answer);
|
|
@@ -2633,6 +2630,7 @@ async function setToken$1({ reporter, token, tokenProvider, }) {
|
|
|
2633
2630
|
silent: true,
|
|
2634
2631
|
}, (err, answer) => {
|
|
2635
2632
|
if (err) {
|
|
2633
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
2636
2634
|
reject(err);
|
|
2637
2635
|
}
|
|
2638
2636
|
resolve(answer);
|
|
@@ -2815,7 +2813,6 @@ async function updateReposInParallel(reporter, items) {
|
|
|
2815
2813
|
};
|
|
2816
2814
|
}
|
|
2817
2815
|
catch (e) {
|
|
2818
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
2819
2816
|
reporter.error(`Failed for ${repo.actualRelpath} - skipping. ${e}`);
|
|
2820
2817
|
return null;
|
|
2821
2818
|
}
|
|
@@ -2979,6 +2976,7 @@ async function getInput(prompt) {
|
|
|
2979
2976
|
timeout: 60000,
|
|
2980
2977
|
}, (err, answer) => {
|
|
2981
2978
|
if (err) {
|
|
2979
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
2982
2980
|
reject(err);
|
|
2983
2981
|
}
|
|
2984
2982
|
resolve(answer);
|
|
@@ -3328,6 +3326,7 @@ async function setToken({ reporter, token, tokenProvider, }) {
|
|
|
3328
3326
|
silent: true,
|
|
3329
3327
|
}, (err, answer) => {
|
|
3330
3328
|
if (err) {
|
|
3329
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
3331
3330
|
reject(err);
|
|
3332
3331
|
}
|
|
3333
3332
|
resolve(answer);
|
|
@@ -3411,7 +3410,7 @@ async function main() {
|
|
|
3411
3410
|
/ /___/ ___ |/ /______/ /
|
|
3412
3411
|
\\____/_/ |_/_____/____/
|
|
3413
3412
|
cli ${version}
|
|
3414
|
-
built ${"2024-
|
|
3413
|
+
built ${"2024-12-05T12:13:34+0000"}
|
|
3415
3414
|
|
|
3416
3415
|
https://github.com/capralifecycle/cals-cli/
|
|
3417
3416
|
|
package/lib/cals-cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cals-cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cals-cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { createGitHubService, GitHubService } from "./github/service";
|
|
|
7
7
|
export declare const VERSION: string;
|
|
8
8
|
export * as definition from "./definition";
|
|
9
9
|
export * as github from "./github";
|
|
10
|
-
export * as loadSecrets from "./load-secrets";
|
|
11
10
|
export * as snyk from "./snyk";
|
|
12
11
|
export * as sonarCloud from "./sonarcloud";
|
|
13
12
|
export * from "./testing";
|
package/lib/index.es.js
CHANGED
|
@@ -16,14 +16,12 @@ import pLimit from 'p-limit';
|
|
|
16
16
|
import keytar from 'keytar';
|
|
17
17
|
import * as process$1 from 'process';
|
|
18
18
|
import { performance } from 'perf_hooks';
|
|
19
|
-
import { SecretsManagerClient, DescribeSecretCommand, UntagResourceCommand, TagResourceCommand, GetSecretValueCommand, CreateSecretCommand, RestoreSecretCommand, PutSecretValueCommand, ReplicateSecretToRegionsCommand, RemoveRegionsFromReplicationCommand } from '@aws-sdk/client-secrets-manager';
|
|
20
|
-
import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
|
|
21
|
-
import read from 'read';
|
|
22
19
|
import { strict } from 'assert';
|
|
23
20
|
import execa from 'execa';
|
|
21
|
+
import read from 'read';
|
|
24
22
|
import { Transform } from 'stream';
|
|
25
23
|
|
|
26
|
-
var version = "3.
|
|
24
|
+
var version = "3.6.0";
|
|
27
25
|
|
|
28
26
|
class CacheProvider {
|
|
29
27
|
constructor(config) {
|
|
@@ -639,7 +637,6 @@ class GitHubService {
|
|
|
639
637
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
640
638
|
this._requestCount++;
|
|
641
639
|
if (options.method !== "GET") {
|
|
642
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
643
640
|
return this.semaphore(() => request(options));
|
|
644
641
|
}
|
|
645
642
|
// Try to cache ETag for GET requests to save on rate limiting.
|
|
@@ -663,7 +660,6 @@ class GitHubService {
|
|
|
663
660
|
}
|
|
664
661
|
const getResponse = async (allowRetry = true) => {
|
|
665
662
|
try {
|
|
666
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
667
663
|
return await request(options);
|
|
668
664
|
}
|
|
669
665
|
catch (e) {
|
|
@@ -792,7 +788,6 @@ class GitHubService {
|
|
|
792
788
|
if (res.organization.repositories.nodes == null) {
|
|
793
789
|
throw new Error("Missing organization nodes");
|
|
794
790
|
}
|
|
795
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
796
791
|
repos.push(...res.organization.repositories.nodes);
|
|
797
792
|
if (!res.organization.repositories.pageInfo.hasNextPage) {
|
|
798
793
|
break;
|
|
@@ -1132,7 +1127,7 @@ async function createGitHubService(props) {
|
|
|
1132
1127
|
});
|
|
1133
1128
|
}
|
|
1134
1129
|
|
|
1135
|
-
var index$
|
|
1130
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
1136
1131
|
__proto__: null,
|
|
1137
1132
|
DefinitionFile: DefinitionFile,
|
|
1138
1133
|
getGitHubOrgs: getGitHubOrgs,
|
|
@@ -1141,336 +1136,12 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
1141
1136
|
parseDefinition: parseDefinition
|
|
1142
1137
|
});
|
|
1143
1138
|
|
|
1144
|
-
var index$
|
|
1139
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1145
1140
|
__proto__: null,
|
|
1146
1141
|
createGitHubService: createGitHubService,
|
|
1147
1142
|
GitHubService: GitHubService
|
|
1148
1143
|
});
|
|
1149
1144
|
|
|
1150
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1151
|
-
class LoadSecrets {
|
|
1152
|
-
constructor(props) {
|
|
1153
|
-
this.smClientForRegions = {};
|
|
1154
|
-
this.stsClient = new STSClient({
|
|
1155
|
-
region: "eu-west-1",
|
|
1156
|
-
});
|
|
1157
|
-
this.reporter = props.reporter;
|
|
1158
|
-
this.silent = props.silent;
|
|
1159
|
-
}
|
|
1160
|
-
getSmClient(region) {
|
|
1161
|
-
if (!this.smClientForRegions[region]) {
|
|
1162
|
-
this.smClientForRegions[region] = new SecretsManagerClient({
|
|
1163
|
-
region,
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
return this.smClientForRegions[region];
|
|
1167
|
-
}
|
|
1168
|
-
async getInput(options) {
|
|
1169
|
-
return new Promise((resolve, reject) => {
|
|
1170
|
-
read(options, (err, answer) => {
|
|
1171
|
-
if (err) {
|
|
1172
|
-
reject(err);
|
|
1173
|
-
}
|
|
1174
|
-
resolve(answer);
|
|
1175
|
-
});
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
async getSecretDetails(client, secretId) {
|
|
1179
|
-
try {
|
|
1180
|
-
return await client.send(new DescribeSecretCommand({ SecretId: secretId }));
|
|
1181
|
-
}
|
|
1182
|
-
catch (e) {
|
|
1183
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1184
|
-
if (e.name && e.name === "ResourceNotFoundException") {
|
|
1185
|
-
return null;
|
|
1186
|
-
}
|
|
1187
|
-
throw e;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
async handleStringUpdate() {
|
|
1191
|
-
return await this.getInput({
|
|
1192
|
-
prompt: "Enter value (Ctrl+C to abort): ",
|
|
1193
|
-
silent: this.silent,
|
|
1194
|
-
});
|
|
1195
|
-
}
|
|
1196
|
-
async handleJsonUpdate(secret) {
|
|
1197
|
-
this.reporter.log("The secret is of type JSON with these expected fields:");
|
|
1198
|
-
for (const field of secret.fields) {
|
|
1199
|
-
const key = typeof field === "string" ? field : field.key;
|
|
1200
|
-
const desc = typeof field === "string"
|
|
1201
|
-
? ""
|
|
1202
|
-
: field.description
|
|
1203
|
-
? ` (${field.description})`
|
|
1204
|
-
: "";
|
|
1205
|
-
this.reporter.log(` - ${key}${desc}`);
|
|
1206
|
-
}
|
|
1207
|
-
this.reporter.log("");
|
|
1208
|
-
// TODO: Ability to specify full json value as one line.
|
|
1209
|
-
const collectedValues = {};
|
|
1210
|
-
for (const field of secret.fields) {
|
|
1211
|
-
const key = typeof field === "string" ? field : field.key;
|
|
1212
|
-
this.reporter.log(`Field: ${this.reporter.format.greenBright(key)}`);
|
|
1213
|
-
if (typeof field !== "string" && field.example != null) {
|
|
1214
|
-
this.reporter.log(`Example: ${this.reporter.format.magentaBright(field.example)}`);
|
|
1215
|
-
}
|
|
1216
|
-
const value = await this.getInput({
|
|
1217
|
-
prompt: "Enter value (Ctrl+C to abort): ",
|
|
1218
|
-
silent: this.silent,
|
|
1219
|
-
});
|
|
1220
|
-
collectedValues[key] = value;
|
|
1221
|
-
this.reporter.log("");
|
|
1222
|
-
}
|
|
1223
|
-
return JSON.stringify(collectedValues, undefined, " ");
|
|
1224
|
-
}
|
|
1225
|
-
getFullName(secretGroup, secret) {
|
|
1226
|
-
return `${secretGroup.namePrefix}${secret.name}`;
|
|
1227
|
-
}
|
|
1228
|
-
async syncTags(client, secret, tags) {
|
|
1229
|
-
const keysToRemove = secret
|
|
1230
|
-
.Tags.filter((existingTag) => !tags.some((it) => it.Key === existingTag.Key))
|
|
1231
|
-
.map((it) => it.Key);
|
|
1232
|
-
if (keysToRemove.length > 0) {
|
|
1233
|
-
this.reporter.log(`Removing obsolete tags: ${keysToRemove.join(", ")}`);
|
|
1234
|
-
await client.send(new UntagResourceCommand({
|
|
1235
|
-
SecretId: secret.ARN,
|
|
1236
|
-
TagKeys: keysToRemove,
|
|
1237
|
-
}));
|
|
1238
|
-
}
|
|
1239
|
-
const tagsToUpdate = tags.filter((expectedTag) => {
|
|
1240
|
-
const existing = secret.Tags.find((it) => it.Key === expectedTag.Key);
|
|
1241
|
-
return existing == null || existing.Value != expectedTag.Value;
|
|
1242
|
-
});
|
|
1243
|
-
if (tagsToUpdate.length > 0) {
|
|
1244
|
-
this.reporter.log(`Storing tags: ${tagsToUpdate.map((it) => it.Key).join(", ")}`);
|
|
1245
|
-
await client.send(new TagResourceCommand({
|
|
1246
|
-
SecretId: secret.ARN,
|
|
1247
|
-
Tags: tagsToUpdate,
|
|
1248
|
-
}));
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
async getSecretValue(client, secretId) {
|
|
1252
|
-
const result = await client.send(new GetSecretValueCommand({
|
|
1253
|
-
SecretId: secretId,
|
|
1254
|
-
}));
|
|
1255
|
-
if (result.SecretString == null) {
|
|
1256
|
-
throw new Error("Missing SecretString (is it a binary?)");
|
|
1257
|
-
}
|
|
1258
|
-
return result.SecretString;
|
|
1259
|
-
}
|
|
1260
|
-
async handleUpdate(secretGroup, secret) {
|
|
1261
|
-
var _a, _b, _c, _d, _e;
|
|
1262
|
-
const client = this.getSmClient(secretGroup.region);
|
|
1263
|
-
const fullName = this.getFullName(secretGroup, secret);
|
|
1264
|
-
const describeSecret = await this.getSecretDetails(client, fullName);
|
|
1265
|
-
this.reporter.log(`Secret: ${this.reporter.format.greenBright(fullName)}`);
|
|
1266
|
-
if (describeSecret == null) {
|
|
1267
|
-
this.reporter.log("The secret does not already exist and will be created");
|
|
1268
|
-
}
|
|
1269
|
-
else {
|
|
1270
|
-
this.reporter.log("Current value:");
|
|
1271
|
-
this.reporter.log(this.reporter.format.yellowBright((await this.getSecretValue(client, fullName)).replace(/^/gm, " ")));
|
|
1272
|
-
}
|
|
1273
|
-
this.reporter.log("");
|
|
1274
|
-
let secretValue;
|
|
1275
|
-
if (secret.type === "json") {
|
|
1276
|
-
try {
|
|
1277
|
-
secretValue = await this.handleJsonUpdate(secret);
|
|
1278
|
-
}
|
|
1279
|
-
catch (e) {
|
|
1280
|
-
if (e instanceof Error && e.message === "canceled") {
|
|
1281
|
-
this.reporter.log("Aborted");
|
|
1282
|
-
return;
|
|
1283
|
-
}
|
|
1284
|
-
throw e;
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
else if (secret.type === "string") {
|
|
1288
|
-
secretValue = await this.handleStringUpdate();
|
|
1289
|
-
}
|
|
1290
|
-
else {
|
|
1291
|
-
throw new Error(`Unsupported type`);
|
|
1292
|
-
}
|
|
1293
|
-
this.reporter.log("Storing secret value:");
|
|
1294
|
-
this.reporter.log(this.reporter.format.yellowBright(secretValue.replace(/^/gm, " ")));
|
|
1295
|
-
const tags = [
|
|
1296
|
-
{
|
|
1297
|
-
Key: "Source",
|
|
1298
|
-
Value: "load-secrets script",
|
|
1299
|
-
},
|
|
1300
|
-
];
|
|
1301
|
-
let arn;
|
|
1302
|
-
let version;
|
|
1303
|
-
let newReplicaRegions = [];
|
|
1304
|
-
let removedReplicaRegions = [];
|
|
1305
|
-
if (describeSecret == null) {
|
|
1306
|
-
newReplicaRegions = (_a = secret.replicaRegions) !== null && _a !== void 0 ? _a : [];
|
|
1307
|
-
const createResult = await client.send(new CreateSecretCommand({
|
|
1308
|
-
Name: fullName,
|
|
1309
|
-
AddReplicaRegions: secret.replicaRegions
|
|
1310
|
-
? secret.replicaRegions.map((replicaRegion) => ({
|
|
1311
|
-
Region: replicaRegion,
|
|
1312
|
-
}))
|
|
1313
|
-
: undefined,
|
|
1314
|
-
Description: "Created by load-secrets",
|
|
1315
|
-
SecretString: secretValue,
|
|
1316
|
-
Tags: tags,
|
|
1317
|
-
}));
|
|
1318
|
-
if (createResult.VersionId == null) {
|
|
1319
|
-
throw new Error("Expected versionId");
|
|
1320
|
-
}
|
|
1321
|
-
arn = createResult.ARN;
|
|
1322
|
-
version = createResult.VersionId;
|
|
1323
|
-
}
|
|
1324
|
-
else {
|
|
1325
|
-
if (describeSecret.DeletedDate != null) {
|
|
1326
|
-
await client.send(new RestoreSecretCommand({
|
|
1327
|
-
SecretId: fullName,
|
|
1328
|
-
}));
|
|
1329
|
-
}
|
|
1330
|
-
const updateResult = await client.send(new PutSecretValueCommand({
|
|
1331
|
-
SecretId: fullName,
|
|
1332
|
-
SecretString: secretValue,
|
|
1333
|
-
}));
|
|
1334
|
-
const currentReplicaRegions = (_c = (_b = describeSecret.ReplicationStatus) === null || _b === void 0 ? void 0 : _b.map((replicationStatus) => replicationStatus.Region)) !== null && _c !== void 0 ? _c : [];
|
|
1335
|
-
newReplicaRegions =
|
|
1336
|
-
(_e = (_d = secret.replicaRegions) === null || _d === void 0 ? void 0 : _d.filter((region) => !currentReplicaRegions.includes(region))) !== null && _e !== void 0 ? _e : [];
|
|
1337
|
-
removedReplicaRegions = currentReplicaRegions
|
|
1338
|
-
.filter((region) => !!region && typeof region === "string")
|
|
1339
|
-
.filter((region) => !(secret.replicaRegions || []).includes(region));
|
|
1340
|
-
if (newReplicaRegions.length > 0) {
|
|
1341
|
-
await client.send(new ReplicateSecretToRegionsCommand({
|
|
1342
|
-
SecretId: fullName,
|
|
1343
|
-
AddReplicaRegions: newReplicaRegions.map((region) => ({
|
|
1344
|
-
Region: region,
|
|
1345
|
-
})),
|
|
1346
|
-
}));
|
|
1347
|
-
}
|
|
1348
|
-
if (removedReplicaRegions.length > 0) {
|
|
1349
|
-
await client.send(new RemoveRegionsFromReplicationCommand({
|
|
1350
|
-
SecretId: fullName,
|
|
1351
|
-
RemoveReplicaRegions: removedReplicaRegions,
|
|
1352
|
-
}));
|
|
1353
|
-
}
|
|
1354
|
-
if (updateResult.VersionId == null) {
|
|
1355
|
-
throw new Error("Expected versionId");
|
|
1356
|
-
}
|
|
1357
|
-
await this.syncTags(client, describeSecret, tags);
|
|
1358
|
-
arn = updateResult.ARN;
|
|
1359
|
-
version = updateResult.VersionId;
|
|
1360
|
-
}
|
|
1361
|
-
this.reporter.log("");
|
|
1362
|
-
this.reporter.log("Secret stored:");
|
|
1363
|
-
this.reporter.log(`ARN: ${this.reporter.format.greenBright(arn)}`);
|
|
1364
|
-
this.reporter.log(`Version: ${this.reporter.format.greenBright(version)}`);
|
|
1365
|
-
if (newReplicaRegions.length > 0) {
|
|
1366
|
-
this.reporter.log(`Read replicas added to regions: ${newReplicaRegions
|
|
1367
|
-
.map((r) => this.reporter.format.greenBright(r))
|
|
1368
|
-
.join(", ")}`);
|
|
1369
|
-
}
|
|
1370
|
-
if (removedReplicaRegions.length > 0) {
|
|
1371
|
-
this.reporter.log(`Read replicas removed from regions: ${removedReplicaRegions
|
|
1372
|
-
.map((r) => this.reporter.format.redBright(r))
|
|
1373
|
-
.join(", ")}`);
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
checkSecretGroup(secretGroup) {
|
|
1377
|
-
if (!secretGroup.namePrefix.startsWith("/") ||
|
|
1378
|
-
!secretGroup.namePrefix.endsWith("/")) {
|
|
1379
|
-
throw new Error(`namePrefix should start and end with /. Current value: ${secretGroup.namePrefix}`);
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
getSecretDescription(details) {
|
|
1383
|
-
var _a, _b;
|
|
1384
|
-
return details == null
|
|
1385
|
-
? "not yet created"
|
|
1386
|
-
: (details === null || details === void 0 ? void 0 : details.DeletedDate) != null
|
|
1387
|
-
? `scheduled for deletion ${details.DeletedDate.toISOString()}`
|
|
1388
|
-
: `last changed ${(_b = (_a = details.LastChangedDate) === null || _a === void 0 ? void 0 : _a.toISOString()) !== null && _b !== void 0 ? _b : "unknown"}`;
|
|
1389
|
-
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Returns false if aborted.
|
|
1392
|
-
*/
|
|
1393
|
-
async selectAndUpdate(secretGroups) {
|
|
1394
|
-
const secrets = [];
|
|
1395
|
-
this.reporter.log("Select secret to write:");
|
|
1396
|
-
this.reporter.log("");
|
|
1397
|
-
for (const secretGroup of secretGroups) {
|
|
1398
|
-
this.reporter.log(`${secretGroup.description} (prefix: ${secretGroup.namePrefix})`);
|
|
1399
|
-
for (let i = 0; i < secretGroup.secrets.length; i++) {
|
|
1400
|
-
const offset = secrets.length;
|
|
1401
|
-
const secret = secretGroup.secrets[i];
|
|
1402
|
-
secrets.push({
|
|
1403
|
-
secret: secret,
|
|
1404
|
-
secretGroup,
|
|
1405
|
-
});
|
|
1406
|
-
const client = this.getSmClient(secretGroup.region);
|
|
1407
|
-
const details = await this.getSecretDetails(client, this.getFullName(secretGroup, secret));
|
|
1408
|
-
const desc = this.getSecretDescription(details);
|
|
1409
|
-
this.reporter.log(` (${offset}) ${secret.name} (${desc})`);
|
|
1410
|
-
}
|
|
1411
|
-
this.reporter.log("");
|
|
1412
|
-
}
|
|
1413
|
-
let index;
|
|
1414
|
-
try {
|
|
1415
|
-
const answer = await this.getInput({
|
|
1416
|
-
prompt: "Enter index (or enter to quit): ",
|
|
1417
|
-
});
|
|
1418
|
-
if (answer.trim() === "") {
|
|
1419
|
-
return false;
|
|
1420
|
-
}
|
|
1421
|
-
index = parseInt(answer);
|
|
1422
|
-
if (!secrets[index]) {
|
|
1423
|
-
throw new Error();
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
catch (e) {
|
|
1427
|
-
this.reporter.warn("Secret not found - aborting");
|
|
1428
|
-
return false;
|
|
1429
|
-
}
|
|
1430
|
-
this.reporter.log("");
|
|
1431
|
-
await this.handleUpdate(secrets[index].secretGroup, secrets[index].secret);
|
|
1432
|
-
this.reporter.log("");
|
|
1433
|
-
return true;
|
|
1434
|
-
}
|
|
1435
|
-
async process(secretGroups) {
|
|
1436
|
-
this.reporter.info("Checking account for current credentials");
|
|
1437
|
-
this.reporter.info("If any error is given, make sure you have valid credentials active");
|
|
1438
|
-
const currentAccount = await this.stsClient.send(new GetCallerIdentityCommand({}));
|
|
1439
|
-
this.reporter.info(`Running for account ${currentAccount.Account}`);
|
|
1440
|
-
this.reporter.log("");
|
|
1441
|
-
const matchedSecretGroups = secretGroups.filter((it) => it.accountId === currentAccount.Account);
|
|
1442
|
-
if (matchedSecretGroups.length === 0) {
|
|
1443
|
-
this.reporter.error(`No secrets specified for this account - aborting`);
|
|
1444
|
-
return;
|
|
1445
|
-
}
|
|
1446
|
-
for (const secretGroup of matchedSecretGroups) {
|
|
1447
|
-
this.checkSecretGroup(secretGroup);
|
|
1448
|
-
}
|
|
1449
|
-
while (await this.selectAndUpdate(matchedSecretGroups)) { }
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
/**
|
|
1453
|
-
* Load secrets interactively into Secrets Manager.
|
|
1454
|
-
*/
|
|
1455
|
-
function loadSecretsCli(props) {
|
|
1456
|
-
const loadSecrets = new LoadSecrets({
|
|
1457
|
-
reporter: createReporter({}),
|
|
1458
|
-
// For now we show the secrets, so that we get positive feedback that the value
|
|
1459
|
-
// is correctly entered.
|
|
1460
|
-
silent: false,
|
|
1461
|
-
});
|
|
1462
|
-
loadSecrets.process(props.secretGroups).catch((error) => {
|
|
1463
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1464
|
-
console.error(error.stack || error.message || error);
|
|
1465
|
-
process.exitCode = 1;
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1470
|
-
__proto__: null,
|
|
1471
|
-
loadSecretsCli: loadSecretsCli
|
|
1472
|
-
});
|
|
1473
|
-
|
|
1474
1145
|
class SnykTokenCliProvider {
|
|
1475
1146
|
constructor() {
|
|
1476
1147
|
this.keyringService = "cals";
|
|
@@ -1878,7 +1549,7 @@ async function pollForCondition({ container, attempts, waitIntervalSec, conditio
|
|
|
1878
1549
|
log(`Took ${duration()} seconds for condition`);
|
|
1879
1550
|
return;
|
|
1880
1551
|
}
|
|
1881
|
-
catch
|
|
1552
|
+
catch {
|
|
1882
1553
|
log("Still waiting...");
|
|
1883
1554
|
await new Promise((resolve) => setTimeout(resolve, waitIntervalSec * 1000));
|
|
1884
1555
|
}
|
|
@@ -1926,7 +1597,7 @@ async function isRunning(executor, container) {
|
|
|
1926
1597
|
await execa("docker", ["inspect", container.name]);
|
|
1927
1598
|
return true;
|
|
1928
1599
|
}
|
|
1929
|
-
catch
|
|
1600
|
+
catch {
|
|
1930
1601
|
return false;
|
|
1931
1602
|
}
|
|
1932
1603
|
}
|
|
@@ -1967,7 +1638,7 @@ function checkPidRunning(pid) {
|
|
|
1967
1638
|
process.kill(pid, 0);
|
|
1968
1639
|
return true;
|
|
1969
1640
|
}
|
|
1970
|
-
catch
|
|
1641
|
+
catch {
|
|
1971
1642
|
return false;
|
|
1972
1643
|
}
|
|
1973
1644
|
}
|
|
@@ -1981,7 +1652,7 @@ async function getContainerId({ executor, name, hasFailed, pid, }) {
|
|
|
1981
1652
|
result = (await execa("docker", ["inspect", name, "-f", "{{.Id}}"]))
|
|
1982
1653
|
.stdout;
|
|
1983
1654
|
}
|
|
1984
|
-
catch
|
|
1655
|
+
catch {
|
|
1985
1656
|
result = null;
|
|
1986
1657
|
}
|
|
1987
1658
|
// Debugging to help us solve CALS-366.
|
|
@@ -2115,13 +1786,12 @@ async function getDockerHostAddress() {
|
|
|
2115
1786
|
pipeToConsole(process, "ip route");
|
|
2116
1787
|
const res = await process;
|
|
2117
1788
|
try {
|
|
2118
|
-
return
|
|
1789
|
+
return res.stdout
|
|
2119
1790
|
.split("\n")
|
|
2120
1791
|
.filter((it) => it.includes("default via"))
|
|
2121
|
-
|
|
2122
|
-
.map((it) => /default via ([\d\.]+) /.exec(it)[1])[0]);
|
|
1792
|
+
.map((it) => /default via ([\d\.]+) /.exec(it)[1])[0];
|
|
2123
1793
|
}
|
|
2124
|
-
catch
|
|
1794
|
+
catch {
|
|
2125
1795
|
throw new Error("Failed to extract docker host address");
|
|
2126
1796
|
}
|
|
2127
1797
|
}
|
|
@@ -2134,6 +1804,7 @@ async function waitForEnterToContinue(prompt = "Press enter to continue") {
|
|
|
2134
1804
|
silent: true,
|
|
2135
1805
|
}, (err) => {
|
|
2136
1806
|
if (err) {
|
|
1807
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
2137
1808
|
reject(err);
|
|
2138
1809
|
}
|
|
2139
1810
|
resolve();
|
|
@@ -2143,5 +1814,5 @@ async function waitForEnterToContinue(prompt = "Press enter to continue") {
|
|
|
2143
1814
|
|
|
2144
1815
|
const VERSION = version;
|
|
2145
1816
|
|
|
2146
|
-
export { CacheProvider, Config, DefinitionFile, GitHubService, Reporter, TestExecutor, VERSION, createGitHubService, createNetwork, createReporter, createTestExecutor, curl, index$
|
|
1817
|
+
export { CacheProvider, Config, DefinitionFile, GitHubService, Reporter, TestExecutor, VERSION, createGitHubService, createNetwork, createReporter, createTestExecutor, curl, index$3 as definition, getDockerHostAddress, index$2 as github, pollForCondition, runNpmRunScript, index$1 as snyk, index as sonarCloud, startContainer, waitForEnterToContinue, waitForHttpOk, waitForPostgresAvailable };
|
|
2147
1818
|
//# sourceMappingURL=index.es.js.map
|
package/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -20,11 +20,9 @@ var pLimit = require('p-limit');
|
|
|
20
20
|
var keytar = require('keytar');
|
|
21
21
|
var process$1 = require('process');
|
|
22
22
|
var perf_hooks = require('perf_hooks');
|
|
23
|
-
var clientSecretsManager = require('@aws-sdk/client-secrets-manager');
|
|
24
|
-
var clientSts = require('@aws-sdk/client-sts');
|
|
25
|
-
var read = require('read');
|
|
26
23
|
var assert = require('assert');
|
|
27
24
|
var execa = require('execa');
|
|
25
|
+
var read = require('read');
|
|
28
26
|
var stream = require('stream');
|
|
29
27
|
|
|
30
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -61,10 +59,10 @@ var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
|
|
|
61
59
|
var pLimit__default = /*#__PURE__*/_interopDefaultLegacy(pLimit);
|
|
62
60
|
var keytar__default = /*#__PURE__*/_interopDefaultLegacy(keytar);
|
|
63
61
|
var process__namespace = /*#__PURE__*/_interopNamespace(process$1);
|
|
64
|
-
var read__default = /*#__PURE__*/_interopDefaultLegacy(read);
|
|
65
62
|
var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
|
|
63
|
+
var read__default = /*#__PURE__*/_interopDefaultLegacy(read);
|
|
66
64
|
|
|
67
|
-
var version = "3.
|
|
65
|
+
var version = "3.6.0";
|
|
68
66
|
|
|
69
67
|
class CacheProvider {
|
|
70
68
|
constructor(config) {
|
|
@@ -680,7 +678,6 @@ class GitHubService {
|
|
|
680
678
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
681
679
|
this._requestCount++;
|
|
682
680
|
if (options.method !== "GET") {
|
|
683
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
684
681
|
return this.semaphore(() => request(options));
|
|
685
682
|
}
|
|
686
683
|
// Try to cache ETag for GET requests to save on rate limiting.
|
|
@@ -704,7 +701,6 @@ class GitHubService {
|
|
|
704
701
|
}
|
|
705
702
|
const getResponse = async (allowRetry = true) => {
|
|
706
703
|
try {
|
|
707
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
708
704
|
return await request(options);
|
|
709
705
|
}
|
|
710
706
|
catch (e) {
|
|
@@ -833,7 +829,6 @@ class GitHubService {
|
|
|
833
829
|
if (res.organization.repositories.nodes == null) {
|
|
834
830
|
throw new Error("Missing organization nodes");
|
|
835
831
|
}
|
|
836
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
837
832
|
repos.push(...res.organization.repositories.nodes);
|
|
838
833
|
if (!res.organization.repositories.pageInfo.hasNextPage) {
|
|
839
834
|
break;
|
|
@@ -1173,7 +1168,7 @@ async function createGitHubService(props) {
|
|
|
1173
1168
|
});
|
|
1174
1169
|
}
|
|
1175
1170
|
|
|
1176
|
-
var index$
|
|
1171
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
1177
1172
|
__proto__: null,
|
|
1178
1173
|
DefinitionFile: DefinitionFile,
|
|
1179
1174
|
getGitHubOrgs: getGitHubOrgs,
|
|
@@ -1182,336 +1177,12 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
1182
1177
|
parseDefinition: parseDefinition
|
|
1183
1178
|
});
|
|
1184
1179
|
|
|
1185
|
-
var index$
|
|
1180
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1186
1181
|
__proto__: null,
|
|
1187
1182
|
createGitHubService: createGitHubService,
|
|
1188
1183
|
GitHubService: GitHubService
|
|
1189
1184
|
});
|
|
1190
1185
|
|
|
1191
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1192
|
-
class LoadSecrets {
|
|
1193
|
-
constructor(props) {
|
|
1194
|
-
this.smClientForRegions = {};
|
|
1195
|
-
this.stsClient = new clientSts.STSClient({
|
|
1196
|
-
region: "eu-west-1",
|
|
1197
|
-
});
|
|
1198
|
-
this.reporter = props.reporter;
|
|
1199
|
-
this.silent = props.silent;
|
|
1200
|
-
}
|
|
1201
|
-
getSmClient(region) {
|
|
1202
|
-
if (!this.smClientForRegions[region]) {
|
|
1203
|
-
this.smClientForRegions[region] = new clientSecretsManager.SecretsManagerClient({
|
|
1204
|
-
region,
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
return this.smClientForRegions[region];
|
|
1208
|
-
}
|
|
1209
|
-
async getInput(options) {
|
|
1210
|
-
return new Promise((resolve, reject) => {
|
|
1211
|
-
read__default["default"](options, (err, answer) => {
|
|
1212
|
-
if (err) {
|
|
1213
|
-
reject(err);
|
|
1214
|
-
}
|
|
1215
|
-
resolve(answer);
|
|
1216
|
-
});
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
async getSecretDetails(client, secretId) {
|
|
1220
|
-
try {
|
|
1221
|
-
return await client.send(new clientSecretsManager.DescribeSecretCommand({ SecretId: secretId }));
|
|
1222
|
-
}
|
|
1223
|
-
catch (e) {
|
|
1224
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1225
|
-
if (e.name && e.name === "ResourceNotFoundException") {
|
|
1226
|
-
return null;
|
|
1227
|
-
}
|
|
1228
|
-
throw e;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
async handleStringUpdate() {
|
|
1232
|
-
return await this.getInput({
|
|
1233
|
-
prompt: "Enter value (Ctrl+C to abort): ",
|
|
1234
|
-
silent: this.silent,
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
async handleJsonUpdate(secret) {
|
|
1238
|
-
this.reporter.log("The secret is of type JSON with these expected fields:");
|
|
1239
|
-
for (const field of secret.fields) {
|
|
1240
|
-
const key = typeof field === "string" ? field : field.key;
|
|
1241
|
-
const desc = typeof field === "string"
|
|
1242
|
-
? ""
|
|
1243
|
-
: field.description
|
|
1244
|
-
? ` (${field.description})`
|
|
1245
|
-
: "";
|
|
1246
|
-
this.reporter.log(` - ${key}${desc}`);
|
|
1247
|
-
}
|
|
1248
|
-
this.reporter.log("");
|
|
1249
|
-
// TODO: Ability to specify full json value as one line.
|
|
1250
|
-
const collectedValues = {};
|
|
1251
|
-
for (const field of secret.fields) {
|
|
1252
|
-
const key = typeof field === "string" ? field : field.key;
|
|
1253
|
-
this.reporter.log(`Field: ${this.reporter.format.greenBright(key)}`);
|
|
1254
|
-
if (typeof field !== "string" && field.example != null) {
|
|
1255
|
-
this.reporter.log(`Example: ${this.reporter.format.magentaBright(field.example)}`);
|
|
1256
|
-
}
|
|
1257
|
-
const value = await this.getInput({
|
|
1258
|
-
prompt: "Enter value (Ctrl+C to abort): ",
|
|
1259
|
-
silent: this.silent,
|
|
1260
|
-
});
|
|
1261
|
-
collectedValues[key] = value;
|
|
1262
|
-
this.reporter.log("");
|
|
1263
|
-
}
|
|
1264
|
-
return JSON.stringify(collectedValues, undefined, " ");
|
|
1265
|
-
}
|
|
1266
|
-
getFullName(secretGroup, secret) {
|
|
1267
|
-
return `${secretGroup.namePrefix}${secret.name}`;
|
|
1268
|
-
}
|
|
1269
|
-
async syncTags(client, secret, tags) {
|
|
1270
|
-
const keysToRemove = secret
|
|
1271
|
-
.Tags.filter((existingTag) => !tags.some((it) => it.Key === existingTag.Key))
|
|
1272
|
-
.map((it) => it.Key);
|
|
1273
|
-
if (keysToRemove.length > 0) {
|
|
1274
|
-
this.reporter.log(`Removing obsolete tags: ${keysToRemove.join(", ")}`);
|
|
1275
|
-
await client.send(new clientSecretsManager.UntagResourceCommand({
|
|
1276
|
-
SecretId: secret.ARN,
|
|
1277
|
-
TagKeys: keysToRemove,
|
|
1278
|
-
}));
|
|
1279
|
-
}
|
|
1280
|
-
const tagsToUpdate = tags.filter((expectedTag) => {
|
|
1281
|
-
const existing = secret.Tags.find((it) => it.Key === expectedTag.Key);
|
|
1282
|
-
return existing == null || existing.Value != expectedTag.Value;
|
|
1283
|
-
});
|
|
1284
|
-
if (tagsToUpdate.length > 0) {
|
|
1285
|
-
this.reporter.log(`Storing tags: ${tagsToUpdate.map((it) => it.Key).join(", ")}`);
|
|
1286
|
-
await client.send(new clientSecretsManager.TagResourceCommand({
|
|
1287
|
-
SecretId: secret.ARN,
|
|
1288
|
-
Tags: tagsToUpdate,
|
|
1289
|
-
}));
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
async getSecretValue(client, secretId) {
|
|
1293
|
-
const result = await client.send(new clientSecretsManager.GetSecretValueCommand({
|
|
1294
|
-
SecretId: secretId,
|
|
1295
|
-
}));
|
|
1296
|
-
if (result.SecretString == null) {
|
|
1297
|
-
throw new Error("Missing SecretString (is it a binary?)");
|
|
1298
|
-
}
|
|
1299
|
-
return result.SecretString;
|
|
1300
|
-
}
|
|
1301
|
-
async handleUpdate(secretGroup, secret) {
|
|
1302
|
-
var _a, _b, _c, _d, _e;
|
|
1303
|
-
const client = this.getSmClient(secretGroup.region);
|
|
1304
|
-
const fullName = this.getFullName(secretGroup, secret);
|
|
1305
|
-
const describeSecret = await this.getSecretDetails(client, fullName);
|
|
1306
|
-
this.reporter.log(`Secret: ${this.reporter.format.greenBright(fullName)}`);
|
|
1307
|
-
if (describeSecret == null) {
|
|
1308
|
-
this.reporter.log("The secret does not already exist and will be created");
|
|
1309
|
-
}
|
|
1310
|
-
else {
|
|
1311
|
-
this.reporter.log("Current value:");
|
|
1312
|
-
this.reporter.log(this.reporter.format.yellowBright((await this.getSecretValue(client, fullName)).replace(/^/gm, " ")));
|
|
1313
|
-
}
|
|
1314
|
-
this.reporter.log("");
|
|
1315
|
-
let secretValue;
|
|
1316
|
-
if (secret.type === "json") {
|
|
1317
|
-
try {
|
|
1318
|
-
secretValue = await this.handleJsonUpdate(secret);
|
|
1319
|
-
}
|
|
1320
|
-
catch (e) {
|
|
1321
|
-
if (e instanceof Error && e.message === "canceled") {
|
|
1322
|
-
this.reporter.log("Aborted");
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
throw e;
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
else if (secret.type === "string") {
|
|
1329
|
-
secretValue = await this.handleStringUpdate();
|
|
1330
|
-
}
|
|
1331
|
-
else {
|
|
1332
|
-
throw new Error(`Unsupported type`);
|
|
1333
|
-
}
|
|
1334
|
-
this.reporter.log("Storing secret value:");
|
|
1335
|
-
this.reporter.log(this.reporter.format.yellowBright(secretValue.replace(/^/gm, " ")));
|
|
1336
|
-
const tags = [
|
|
1337
|
-
{
|
|
1338
|
-
Key: "Source",
|
|
1339
|
-
Value: "load-secrets script",
|
|
1340
|
-
},
|
|
1341
|
-
];
|
|
1342
|
-
let arn;
|
|
1343
|
-
let version;
|
|
1344
|
-
let newReplicaRegions = [];
|
|
1345
|
-
let removedReplicaRegions = [];
|
|
1346
|
-
if (describeSecret == null) {
|
|
1347
|
-
newReplicaRegions = (_a = secret.replicaRegions) !== null && _a !== void 0 ? _a : [];
|
|
1348
|
-
const createResult = await client.send(new clientSecretsManager.CreateSecretCommand({
|
|
1349
|
-
Name: fullName,
|
|
1350
|
-
AddReplicaRegions: secret.replicaRegions
|
|
1351
|
-
? secret.replicaRegions.map((replicaRegion) => ({
|
|
1352
|
-
Region: replicaRegion,
|
|
1353
|
-
}))
|
|
1354
|
-
: undefined,
|
|
1355
|
-
Description: "Created by load-secrets",
|
|
1356
|
-
SecretString: secretValue,
|
|
1357
|
-
Tags: tags,
|
|
1358
|
-
}));
|
|
1359
|
-
if (createResult.VersionId == null) {
|
|
1360
|
-
throw new Error("Expected versionId");
|
|
1361
|
-
}
|
|
1362
|
-
arn = createResult.ARN;
|
|
1363
|
-
version = createResult.VersionId;
|
|
1364
|
-
}
|
|
1365
|
-
else {
|
|
1366
|
-
if (describeSecret.DeletedDate != null) {
|
|
1367
|
-
await client.send(new clientSecretsManager.RestoreSecretCommand({
|
|
1368
|
-
SecretId: fullName,
|
|
1369
|
-
}));
|
|
1370
|
-
}
|
|
1371
|
-
const updateResult = await client.send(new clientSecretsManager.PutSecretValueCommand({
|
|
1372
|
-
SecretId: fullName,
|
|
1373
|
-
SecretString: secretValue,
|
|
1374
|
-
}));
|
|
1375
|
-
const currentReplicaRegions = (_c = (_b = describeSecret.ReplicationStatus) === null || _b === void 0 ? void 0 : _b.map((replicationStatus) => replicationStatus.Region)) !== null && _c !== void 0 ? _c : [];
|
|
1376
|
-
newReplicaRegions =
|
|
1377
|
-
(_e = (_d = secret.replicaRegions) === null || _d === void 0 ? void 0 : _d.filter((region) => !currentReplicaRegions.includes(region))) !== null && _e !== void 0 ? _e : [];
|
|
1378
|
-
removedReplicaRegions = currentReplicaRegions
|
|
1379
|
-
.filter((region) => !!region && typeof region === "string")
|
|
1380
|
-
.filter((region) => !(secret.replicaRegions || []).includes(region));
|
|
1381
|
-
if (newReplicaRegions.length > 0) {
|
|
1382
|
-
await client.send(new clientSecretsManager.ReplicateSecretToRegionsCommand({
|
|
1383
|
-
SecretId: fullName,
|
|
1384
|
-
AddReplicaRegions: newReplicaRegions.map((region) => ({
|
|
1385
|
-
Region: region,
|
|
1386
|
-
})),
|
|
1387
|
-
}));
|
|
1388
|
-
}
|
|
1389
|
-
if (removedReplicaRegions.length > 0) {
|
|
1390
|
-
await client.send(new clientSecretsManager.RemoveRegionsFromReplicationCommand({
|
|
1391
|
-
SecretId: fullName,
|
|
1392
|
-
RemoveReplicaRegions: removedReplicaRegions,
|
|
1393
|
-
}));
|
|
1394
|
-
}
|
|
1395
|
-
if (updateResult.VersionId == null) {
|
|
1396
|
-
throw new Error("Expected versionId");
|
|
1397
|
-
}
|
|
1398
|
-
await this.syncTags(client, describeSecret, tags);
|
|
1399
|
-
arn = updateResult.ARN;
|
|
1400
|
-
version = updateResult.VersionId;
|
|
1401
|
-
}
|
|
1402
|
-
this.reporter.log("");
|
|
1403
|
-
this.reporter.log("Secret stored:");
|
|
1404
|
-
this.reporter.log(`ARN: ${this.reporter.format.greenBright(arn)}`);
|
|
1405
|
-
this.reporter.log(`Version: ${this.reporter.format.greenBright(version)}`);
|
|
1406
|
-
if (newReplicaRegions.length > 0) {
|
|
1407
|
-
this.reporter.log(`Read replicas added to regions: ${newReplicaRegions
|
|
1408
|
-
.map((r) => this.reporter.format.greenBright(r))
|
|
1409
|
-
.join(", ")}`);
|
|
1410
|
-
}
|
|
1411
|
-
if (removedReplicaRegions.length > 0) {
|
|
1412
|
-
this.reporter.log(`Read replicas removed from regions: ${removedReplicaRegions
|
|
1413
|
-
.map((r) => this.reporter.format.redBright(r))
|
|
1414
|
-
.join(", ")}`);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
checkSecretGroup(secretGroup) {
|
|
1418
|
-
if (!secretGroup.namePrefix.startsWith("/") ||
|
|
1419
|
-
!secretGroup.namePrefix.endsWith("/")) {
|
|
1420
|
-
throw new Error(`namePrefix should start and end with /. Current value: ${secretGroup.namePrefix}`);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
getSecretDescription(details) {
|
|
1424
|
-
var _a, _b;
|
|
1425
|
-
return details == null
|
|
1426
|
-
? "not yet created"
|
|
1427
|
-
: (details === null || details === void 0 ? void 0 : details.DeletedDate) != null
|
|
1428
|
-
? `scheduled for deletion ${details.DeletedDate.toISOString()}`
|
|
1429
|
-
: `last changed ${(_b = (_a = details.LastChangedDate) === null || _a === void 0 ? void 0 : _a.toISOString()) !== null && _b !== void 0 ? _b : "unknown"}`;
|
|
1430
|
-
}
|
|
1431
|
-
/**
|
|
1432
|
-
* Returns false if aborted.
|
|
1433
|
-
*/
|
|
1434
|
-
async selectAndUpdate(secretGroups) {
|
|
1435
|
-
const secrets = [];
|
|
1436
|
-
this.reporter.log("Select secret to write:");
|
|
1437
|
-
this.reporter.log("");
|
|
1438
|
-
for (const secretGroup of secretGroups) {
|
|
1439
|
-
this.reporter.log(`${secretGroup.description} (prefix: ${secretGroup.namePrefix})`);
|
|
1440
|
-
for (let i = 0; i < secretGroup.secrets.length; i++) {
|
|
1441
|
-
const offset = secrets.length;
|
|
1442
|
-
const secret = secretGroup.secrets[i];
|
|
1443
|
-
secrets.push({
|
|
1444
|
-
secret: secret,
|
|
1445
|
-
secretGroup,
|
|
1446
|
-
});
|
|
1447
|
-
const client = this.getSmClient(secretGroup.region);
|
|
1448
|
-
const details = await this.getSecretDetails(client, this.getFullName(secretGroup, secret));
|
|
1449
|
-
const desc = this.getSecretDescription(details);
|
|
1450
|
-
this.reporter.log(` (${offset}) ${secret.name} (${desc})`);
|
|
1451
|
-
}
|
|
1452
|
-
this.reporter.log("");
|
|
1453
|
-
}
|
|
1454
|
-
let index;
|
|
1455
|
-
try {
|
|
1456
|
-
const answer = await this.getInput({
|
|
1457
|
-
prompt: "Enter index (or enter to quit): ",
|
|
1458
|
-
});
|
|
1459
|
-
if (answer.trim() === "") {
|
|
1460
|
-
return false;
|
|
1461
|
-
}
|
|
1462
|
-
index = parseInt(answer);
|
|
1463
|
-
if (!secrets[index]) {
|
|
1464
|
-
throw new Error();
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
catch (e) {
|
|
1468
|
-
this.reporter.warn("Secret not found - aborting");
|
|
1469
|
-
return false;
|
|
1470
|
-
}
|
|
1471
|
-
this.reporter.log("");
|
|
1472
|
-
await this.handleUpdate(secrets[index].secretGroup, secrets[index].secret);
|
|
1473
|
-
this.reporter.log("");
|
|
1474
|
-
return true;
|
|
1475
|
-
}
|
|
1476
|
-
async process(secretGroups) {
|
|
1477
|
-
this.reporter.info("Checking account for current credentials");
|
|
1478
|
-
this.reporter.info("If any error is given, make sure you have valid credentials active");
|
|
1479
|
-
const currentAccount = await this.stsClient.send(new clientSts.GetCallerIdentityCommand({}));
|
|
1480
|
-
this.reporter.info(`Running for account ${currentAccount.Account}`);
|
|
1481
|
-
this.reporter.log("");
|
|
1482
|
-
const matchedSecretGroups = secretGroups.filter((it) => it.accountId === currentAccount.Account);
|
|
1483
|
-
if (matchedSecretGroups.length === 0) {
|
|
1484
|
-
this.reporter.error(`No secrets specified for this account - aborting`);
|
|
1485
|
-
return;
|
|
1486
|
-
}
|
|
1487
|
-
for (const secretGroup of matchedSecretGroups) {
|
|
1488
|
-
this.checkSecretGroup(secretGroup);
|
|
1489
|
-
}
|
|
1490
|
-
while (await this.selectAndUpdate(matchedSecretGroups)) { }
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
/**
|
|
1494
|
-
* Load secrets interactively into Secrets Manager.
|
|
1495
|
-
*/
|
|
1496
|
-
function loadSecretsCli(props) {
|
|
1497
|
-
const loadSecrets = new LoadSecrets({
|
|
1498
|
-
reporter: createReporter({}),
|
|
1499
|
-
// For now we show the secrets, so that we get positive feedback that the value
|
|
1500
|
-
// is correctly entered.
|
|
1501
|
-
silent: false,
|
|
1502
|
-
});
|
|
1503
|
-
loadSecrets.process(props.secretGroups).catch((error) => {
|
|
1504
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1505
|
-
console.error(error.stack || error.message || error);
|
|
1506
|
-
process.exitCode = 1;
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1511
|
-
__proto__: null,
|
|
1512
|
-
loadSecretsCli: loadSecretsCli
|
|
1513
|
-
});
|
|
1514
|
-
|
|
1515
1186
|
class SnykTokenCliProvider {
|
|
1516
1187
|
constructor() {
|
|
1517
1188
|
this.keyringService = "cals";
|
|
@@ -1919,7 +1590,7 @@ async function pollForCondition({ container, attempts, waitIntervalSec, conditio
|
|
|
1919
1590
|
log(`Took ${duration()} seconds for condition`);
|
|
1920
1591
|
return;
|
|
1921
1592
|
}
|
|
1922
|
-
catch
|
|
1593
|
+
catch {
|
|
1923
1594
|
log("Still waiting...");
|
|
1924
1595
|
await new Promise((resolve) => setTimeout(resolve, waitIntervalSec * 1000));
|
|
1925
1596
|
}
|
|
@@ -1967,7 +1638,7 @@ async function isRunning(executor, container) {
|
|
|
1967
1638
|
await execa__default["default"]("docker", ["inspect", container.name]);
|
|
1968
1639
|
return true;
|
|
1969
1640
|
}
|
|
1970
|
-
catch
|
|
1641
|
+
catch {
|
|
1971
1642
|
return false;
|
|
1972
1643
|
}
|
|
1973
1644
|
}
|
|
@@ -2008,7 +1679,7 @@ function checkPidRunning(pid) {
|
|
|
2008
1679
|
process.kill(pid, 0);
|
|
2009
1680
|
return true;
|
|
2010
1681
|
}
|
|
2011
|
-
catch
|
|
1682
|
+
catch {
|
|
2012
1683
|
return false;
|
|
2013
1684
|
}
|
|
2014
1685
|
}
|
|
@@ -2022,7 +1693,7 @@ async function getContainerId({ executor, name, hasFailed, pid, }) {
|
|
|
2022
1693
|
result = (await execa__default["default"]("docker", ["inspect", name, "-f", "{{.Id}}"]))
|
|
2023
1694
|
.stdout;
|
|
2024
1695
|
}
|
|
2025
|
-
catch
|
|
1696
|
+
catch {
|
|
2026
1697
|
result = null;
|
|
2027
1698
|
}
|
|
2028
1699
|
// Debugging to help us solve CALS-366.
|
|
@@ -2156,13 +1827,12 @@ async function getDockerHostAddress() {
|
|
|
2156
1827
|
pipeToConsole(process, "ip route");
|
|
2157
1828
|
const res = await process;
|
|
2158
1829
|
try {
|
|
2159
|
-
return
|
|
1830
|
+
return res.stdout
|
|
2160
1831
|
.split("\n")
|
|
2161
1832
|
.filter((it) => it.includes("default via"))
|
|
2162
|
-
|
|
2163
|
-
.map((it) => /default via ([\d\.]+) /.exec(it)[1])[0]);
|
|
1833
|
+
.map((it) => /default via ([\d\.]+) /.exec(it)[1])[0];
|
|
2164
1834
|
}
|
|
2165
|
-
catch
|
|
1835
|
+
catch {
|
|
2166
1836
|
throw new Error("Failed to extract docker host address");
|
|
2167
1837
|
}
|
|
2168
1838
|
}
|
|
@@ -2175,6 +1845,7 @@ async function waitForEnterToContinue(prompt = "Press enter to continue") {
|
|
|
2175
1845
|
silent: true,
|
|
2176
1846
|
}, (err) => {
|
|
2177
1847
|
if (err) {
|
|
1848
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
2178
1849
|
reject(err);
|
|
2179
1850
|
}
|
|
2180
1851
|
resolve();
|
|
@@ -2196,10 +1867,9 @@ exports.createNetwork = createNetwork;
|
|
|
2196
1867
|
exports.createReporter = createReporter;
|
|
2197
1868
|
exports.createTestExecutor = createTestExecutor;
|
|
2198
1869
|
exports.curl = curl;
|
|
2199
|
-
exports.definition = index$
|
|
1870
|
+
exports.definition = index$3;
|
|
2200
1871
|
exports.getDockerHostAddress = getDockerHostAddress;
|
|
2201
|
-
exports.github = index$
|
|
2202
|
-
exports.loadSecrets = index$2;
|
|
1872
|
+
exports.github = index$2;
|
|
2203
1873
|
exports.pollForCondition = pollForCondition;
|
|
2204
1874
|
exports.runNpmRunScript = runNpmRunScript;
|
|
2205
1875
|
exports.snyk = index$1;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capraconsulting/cals-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "CLI for repeatable tasks in CALS",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "node scripts/create-definition-schema.js && husky install",
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
"cals": "lib/cals-cli.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/client-secrets-manager": "^3.621.0",
|
|
25
|
-
"@aws-sdk/client-sts": "^3.577.0",
|
|
26
24
|
"@octokit/rest": "^19.0.0",
|
|
27
25
|
"ajv": "^8.11.0",
|
|
28
26
|
"cachedir": "^2.4.0",
|
|
@@ -49,6 +47,8 @@
|
|
|
49
47
|
"devDependencies": {
|
|
50
48
|
"@commitlint/cli": "19.6.0",
|
|
51
49
|
"@commitlint/config-conventional": "19.6.0",
|
|
50
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
51
|
+
"@eslint/js": "^9.16.0",
|
|
52
52
|
"@octokit/types": "10.0.0",
|
|
53
53
|
"@rollup/plugin-alias": "5.1.1",
|
|
54
54
|
"@rollup/plugin-json": "6.1.0",
|
|
@@ -56,18 +56,18 @@
|
|
|
56
56
|
"@types/jest": "29.5.14",
|
|
57
57
|
"@types/js-yaml": "4.0.9",
|
|
58
58
|
"@types/lodash": "4.17.13",
|
|
59
|
-
"@types/node": "
|
|
59
|
+
"@types/node": "22.10.1",
|
|
60
60
|
"@types/node-fetch": "2.6.12",
|
|
61
61
|
"@types/read": "0.0.32",
|
|
62
62
|
"@types/rimraf": "3.0.2",
|
|
63
63
|
"@types/semver": "7.5.8",
|
|
64
64
|
"@types/sprintf-js": "1.1.4",
|
|
65
65
|
"@types/yargs": "17.0.33",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "
|
|
67
|
-
"@typescript-eslint/parser": "
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "8.17.0",
|
|
67
|
+
"@typescript-eslint/parser": "8.17.0",
|
|
68
68
|
"dateformat": "4.6.3",
|
|
69
69
|
"del": "6.1.1",
|
|
70
|
-
"eslint": "
|
|
70
|
+
"eslint": "9.16.0",
|
|
71
71
|
"eslint-config-prettier": "9.1.0",
|
|
72
72
|
"eslint-plugin-prettier": "5.2.1",
|
|
73
73
|
"husky": "8.0.3",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface BaseSecret {
|
|
2
|
-
name: string;
|
|
3
|
-
description?: string;
|
|
4
|
-
/**
|
|
5
|
-
* A list of regions to create read replicas
|
|
6
|
-
* of the secret in.
|
|
7
|
-
*/
|
|
8
|
-
replicaRegions?: string[];
|
|
9
|
-
}
|
|
10
|
-
export type JsonSecretSimpleField = string;
|
|
11
|
-
export interface JsonSecretDescribedField {
|
|
12
|
-
key: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
example?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Used for secrets that are a single plaintext string,
|
|
18
|
-
* and do not require JSON formating.
|
|
19
|
-
*/
|
|
20
|
-
export interface StringSecret extends BaseSecret {
|
|
21
|
-
type: "string";
|
|
22
|
-
}
|
|
23
|
-
export interface JsonSecret extends BaseSecret {
|
|
24
|
-
type: "json";
|
|
25
|
-
fields: (JsonSecretSimpleField | JsonSecretDescribedField)[];
|
|
26
|
-
}
|
|
27
|
-
export type Secret = JsonSecret | StringSecret;
|
|
28
|
-
export interface SecretGroup {
|
|
29
|
-
accountId: string;
|
|
30
|
-
region: string;
|
|
31
|
-
description: string;
|
|
32
|
-
namePrefix: string;
|
|
33
|
-
secrets: Secret[];
|
|
34
|
-
}
|