envilder 0.15.1 → 0.17.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/README.md +54 -30
- package/ROADMAP.md +1 -1
- package/docs/changelogs/cli.md +64 -0
- package/docs/changelogs/gha.md +32 -0
- package/docs/changelogs/sdk-dotnet.md +12 -0
- package/docs/changelogs/sdk-nodejs.md +12 -0
- package/docs/changelogs/sdk-python.md +26 -0
- package/lib/envilder/apps/cli/entry/Cli.d.ts.map +1 -1
- package/lib/envilder/apps/cli/entry/Cli.js +30 -12
- package/lib/envilder/apps/cli/entry/Cli.js.map +1 -1
- package/lib/envilder/core/application/dispatch/DispatchActionCommand.d.ts +6 -1
- package/lib/envilder/core/application/dispatch/DispatchActionCommand.d.ts.map +1 -1
- package/lib/envilder/core/application/dispatch/DispatchActionCommand.js +5 -2
- package/lib/envilder/core/application/dispatch/DispatchActionCommand.js.map +1 -1
- package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.d.ts.map +1 -1
- package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.js +1 -1
- package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.js.map +1 -1
- package/lib/envilder/core/application/pushSingle/PushSingleCommand.d.ts +11 -2
- package/lib/envilder/core/application/pushSingle/PushSingleCommand.d.ts.map +1 -1
- package/lib/envilder/core/application/pushSingle/PushSingleCommand.js +9 -3
- package/lib/envilder/core/application/pushSingle/PushSingleCommand.js.map +1 -1
- package/lib/envilder/core/application/pushSingle/PushSingleCommandHandler.d.ts +11 -1
- package/lib/envilder/core/application/pushSingle/PushSingleCommandHandler.d.ts.map +1 -1
- package/lib/envilder/core/application/pushSingle/PushSingleCommandHandler.js +116 -3
- package/lib/envilder/core/application/pushSingle/PushSingleCommandHandler.js.map +1 -1
- package/lib/envilder/core/domain/CliOptions.d.ts +11 -0
- package/lib/envilder/core/domain/CliOptions.d.ts.map +1 -1
- package/lib/envilder/core/domain/MapFileUpdate.d.ts +37 -0
- package/lib/envilder/core/domain/MapFileUpdate.d.ts.map +1 -0
- package/lib/envilder/core/domain/MapFileUpdate.js +105 -0
- package/lib/envilder/core/domain/MapFileUpdate.js.map +1 -0
- package/lib/envilder/core/domain/ports/IVariableStore.d.ts +9 -0
- package/lib/envilder/core/domain/ports/IVariableStore.d.ts.map +1 -1
- package/lib/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.d.ts +9 -6
- package/lib/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.d.ts.map +1 -1
- package/lib/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.js +21 -46
- package/lib/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.js.map +1 -1
- package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.d.ts +3 -0
- package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.d.ts.map +1 -1
- package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.js +52 -13
- package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.js.map +1 -1
- package/lib/iac/bin/main.d.ts +6 -0
- package/lib/iac/bin/main.d.ts.map +1 -1
- package/lib/iac/bin/main.js +23 -2
- package/lib/iac/bin/main.js.map +1 -1
- package/lib/iac/lib/stacks/publicFilesStack.d.ts +18 -0
- package/lib/iac/lib/stacks/publicFilesStack.d.ts.map +1 -0
- package/lib/iac/lib/stacks/publicFilesStack.js +74 -0
- package/lib/iac/lib/stacks/publicFilesStack.js.map +1 -0
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-key-vault-secret-provider.d.ts +2 -0
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-key-vault-secret-provider.d.ts.map +1 -1
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-key-vault-secret-provider.js +6 -2
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-key-vault-secret-provider.js.map +1 -1
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-secret-name.d.ts +10 -0
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-secret-name.d.ts.map +1 -0
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-secret-name.js +12 -0
- package/lib/sdks/nodejs/src/infrastructure/azure/azure-secret-name.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DispatchActionCommandHandler.js","sourceRoot":"","sources":["../../../../../src/envilder/core/application/dispatch/DispatchActionCommandHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAGtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAKhE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,WAA2C,EAE3C,WAA2C,EAE3C,iBAA2C,EAE3C,cAA+B;IAChD,mEAAmE;IAGlD,WAA2C;2BAV3C,WAAW;2BAEX,WAAW;iCAEX,iBAAiB;8BAEjB,cAAc;2BAId,WAAW;IAC3B,CAAC;IAEJ;;;OAGG;IACG,aAAa,CACjB,OAA8B;;YAE9B,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;gBACxC,yDAAyD;gBACzD,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC;YAED,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;YAExC,IAAI,OAAO,IAAI,CAAC,c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IAAI,EACZ,OAAO,CAAC,WAAW,CACpB,CACF,CAAC;QACJ,CAAC;KAAA;IAEa,gBAAgB,CAC5B,OAA8B;;YAE9B,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAChD,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"DispatchActionCommandHandler.js","sourceRoot":"","sources":["../../../../../src/envilder/core/application/dispatch/DispatchActionCommandHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAGtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAKhE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,WAA2C,EAE3C,WAA2C,EAE3C,iBAA2C,EAE3C,cAA+B;IAChD,mEAAmE;IAGlD,WAA2C;2BAV3C,WAAW;2BAEX,WAAW;iCAEX,iBAAiB;8BAEjB,cAAc;2BAId,WAAW;IAC3B,CAAC;IAEJ;;;OAGG;IACG,aAAa,CACjB,OAA8B;;YAE9B,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;gBACxC,yDAAyD;gBACzD,OAAO,IAAI,CAAC,UAAU,CAAC,O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AC5B,+DAA+D,CAChE,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,4BAA4B,CAClC,OAA8B;QAK9B,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrC,MAAM,IAAI,oBAAoB,CAC5B,iDAAiD,CAClD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AA9IY,4BAA4B;IADxC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;IAE5C,WAAA,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;IAE5C,WAAA,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAEtC,WAAA,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAG7B,WAAA,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAC3C,WAAA,QAAQ,EAAE,CAAA;;GAZF,4BAA4B,CA8IxC"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import type { MapFileTarget } from '../../domain/MapFileUpdate.js';
|
|
1
2
|
export declare class PushSingleCommand {
|
|
2
3
|
readonly key: string;
|
|
3
4
|
readonly value: string;
|
|
4
5
|
readonly secretPath: string;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
/** Map file to record the mapping in; undefined leaves map files alone. */
|
|
7
|
+
readonly mapFile?: string | undefined;
|
|
8
|
+
/** Where the secret is pushed to, compared with the map file's target. */
|
|
9
|
+
readonly target: MapFileTarget;
|
|
10
|
+
constructor(key: string, value: string, secretPath: string,
|
|
11
|
+
/** Map file to record the mapping in; undefined leaves map files alone. */
|
|
12
|
+
mapFile?: string | undefined,
|
|
13
|
+
/** Where the secret is pushed to, compared with the map file's target. */
|
|
14
|
+
target?: MapFileTarget);
|
|
15
|
+
static create(key: string, value: string, secretPath: string, mapFile?: string, target?: MapFileTarget): PushSingleCommand;
|
|
7
16
|
}
|
|
8
17
|
//# sourceMappingURL=PushSingleCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushSingleCommand.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommand.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB;aAEV,GAAG,EAAE,MAAM;aACX,KAAK,EAAE,MAAM;aACb,UAAU,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"PushSingleCommand.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,qBAAa,iBAAiB;aAEV,GAAG,EAAE,MAAM;aACX,KAAK,EAAE,MAAM;aACb,UAAU,EAAE,MAAM;IAClC,2EAA2E;aAC3D,OAAO,CAAC,EAAE,MAAM;IAChC,0EAA0E;aAC1D,MAAM,EAAE,aAAa;IAPvC,YACkB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM;IAClC,2EAA2E;IAC3D,OAAO,CAAC,EAAE,MAAM,YAAA;IAChC,0EAA0E;IAC1D,MAAM,GAAE,aAAmC,EACzD;IAEJ,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,aAAa,GACrB,iBAAiB,CAEnB;CACF"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
export class PushSingleCommand {
|
|
2
|
-
constructor(key, value, secretPath
|
|
2
|
+
constructor(key, value, secretPath,
|
|
3
|
+
/** Map file to record the mapping in; undefined leaves map files alone. */
|
|
4
|
+
mapFile,
|
|
5
|
+
/** Where the secret is pushed to, compared with the map file's target. */
|
|
6
|
+
target = { provider: 'aws' }) {
|
|
3
7
|
this.key = key;
|
|
4
8
|
this.value = value;
|
|
5
9
|
this.secretPath = secretPath;
|
|
10
|
+
this.mapFile = mapFile;
|
|
11
|
+
this.target = target;
|
|
6
12
|
}
|
|
7
|
-
static create(key, value, secretPath) {
|
|
8
|
-
return new PushSingleCommand(key, value, secretPath);
|
|
13
|
+
static create(key, value, secretPath, mapFile, target) {
|
|
14
|
+
return new PushSingleCommand(key, value, secretPath, mapFile, target);
|
|
9
15
|
}
|
|
10
16
|
}
|
|
11
17
|
//# sourceMappingURL=PushSingleCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushSingleCommand.js","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PushSingleCommand.js","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommand.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAC5B,YACkB,GAAW,EACX,KAAa,EACb,UAAkB;IAClC,2EAA2E;IAC3D,OAAgB;IAChC,0EAA0E;IAC1D,MAAM,GAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE;mBAN3C,GAAG;qBACH,KAAK;0BACL,UAAU;uBAEV,OAAO;sBAEP,MAAM;IACrB,CAAC;IAEJ,MAAM,CAAC,MAAM,CACX,GAAW,EACX,KAAa,EACb,UAAkB,EAClB,OAAgB,EAChB,MAAsB;QAEtB,OAAO,IAAI,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import type { ILogger } from '../../domain/ports/ILogger.js';
|
|
2
2
|
import type { ISecretProvider } from '../../domain/ports/ISecretProvider.js';
|
|
3
|
+
import type { IVariableStore } from '../../domain/ports/IVariableStore.js';
|
|
3
4
|
import type { PushSingleCommand } from './PushSingleCommand.js';
|
|
4
5
|
export declare class PushSingleCommandHandler {
|
|
5
6
|
private readonly secretProvider;
|
|
6
7
|
private readonly logger;
|
|
8
|
+
private readonly variableStore;
|
|
7
9
|
private static readonly RULE;
|
|
8
|
-
constructor(secretProvider: ISecretProvider, logger: ILogger);
|
|
10
|
+
constructor(secretProvider: ISecretProvider, logger: ILogger, variableStore: IVariableStore);
|
|
9
11
|
/**
|
|
10
12
|
* Handles the PushSingleCommand which pushes a single environment variable to the secret store.
|
|
13
|
+
* When the command names a map file, the mapping is recorded there first and
|
|
14
|
+
* restored if the push fails, so the file never claims a secret that was not pushed.
|
|
11
15
|
*
|
|
12
16
|
* @param command - The PushSingleCommand containing key, value and secretPath
|
|
13
17
|
*/
|
|
14
18
|
handle(command: PushSingleCommand): Promise<void>;
|
|
19
|
+
private planMapFileUpdate;
|
|
20
|
+
private writeMapFile;
|
|
21
|
+
private rollBackMapFile;
|
|
22
|
+
private reportMapFile;
|
|
23
|
+
/** Provider and vault name only: a vault URL may carry credentials. */
|
|
24
|
+
private describeTarget;
|
|
15
25
|
}
|
|
16
26
|
//# sourceMappingURL=PushSingleCommandHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushSingleCommandHandler.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommandHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PushSingleCommandHandler.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommandHandler.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAahE,qBACa,wBAAwB;IAKjC,OAAO,CAAC,QAAQ,CAAC,cAAc;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;IAE9C,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAmC;IAE/D,YAEmB,cAAc,EAAE,eAAe,EACR,MAAM,EAAE,OAAO,EAEtC,aAAa,EAAE,cAAc,EAC5C;IAEJ;;;;;;OAMG;IACG,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+CtD;YAEa,iBAAiB;YA6DjB,YAAY;YAOZ,eAAe;IAgB7B,OAAO,CAAC,aAAa;IAWrB,uEAAuE;IACvE,OAAO,CAAC,cAAc;CAUvB"}
|
|
@@ -23,14 +23,19 @@ var PushSingleCommandHandler_1;
|
|
|
23
23
|
import { inject, injectable } from 'inversify';
|
|
24
24
|
import pc from 'picocolors';
|
|
25
25
|
import { EnvironmentVariable } from '../../domain/EnvironmentVariable.js';
|
|
26
|
+
import { EnvironmentFileError, InvalidArgumentError, } from '../../domain/errors/DomainErrors.js';
|
|
27
|
+
import { decideMapFileUpdate, } from '../../domain/MapFileUpdate.js';
|
|
26
28
|
import { TYPES } from '../../types.js';
|
|
27
29
|
let PushSingleCommandHandler = PushSingleCommandHandler_1 = class PushSingleCommandHandler {
|
|
28
|
-
constructor(secretProvider, logger) {
|
|
30
|
+
constructor(secretProvider, logger, variableStore) {
|
|
29
31
|
this.secretProvider = secretProvider;
|
|
30
32
|
this.logger = logger;
|
|
33
|
+
this.variableStore = variableStore;
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
36
|
* Handles the PushSingleCommand which pushes a single environment variable to the secret store.
|
|
37
|
+
* When the command names a map file, the mapping is recorded there first and
|
|
38
|
+
* restored if the push fails, so the file never claims a secret that was not pushed.
|
|
34
39
|
*
|
|
35
40
|
* @param command - The PushSingleCommand containing key, value and secretPath
|
|
36
41
|
*/
|
|
@@ -42,8 +47,24 @@ let PushSingleCommandHandler = PushSingleCommandHandler_1 = class PushSingleComm
|
|
|
42
47
|
this.logger.info(PushSingleCommandHandler_1.RULE);
|
|
43
48
|
this.logger.info(` ${pc.dim('\u2192 ')}${pc.bold(command.key)}${pc.dim(' \u2192 ')}${pc.dim(maskedPath)}`);
|
|
44
49
|
const envVariable = new EnvironmentVariable(command.key, command.value, true);
|
|
45
|
-
yield this.
|
|
50
|
+
const plan = yield this.planMapFileUpdate(command);
|
|
51
|
+
try {
|
|
52
|
+
yield this.writeMapFile(plan);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// A write that fails midway can leave a truncated file behind.
|
|
56
|
+
yield this.rollBackMapFile(plan, command.key);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
yield this.secretProvider.setSecret(command.secretPath, command.value);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
yield this.rollBackMapFile(plan, command.key);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
46
66
|
this.logger.info(`\n${pc.bold(pc.green('\u2B50 SECRET PUSHED'))}${pc.dim(' \u2014 ')}${pc.bold(command.key)}${pc.dim('=')}${envVariable.maskedValue}${pc.dim(' \u2192 ')}${pc.dim(maskedPath)}\n`);
|
|
67
|
+
this.reportMapFile(plan);
|
|
47
68
|
}
|
|
48
69
|
catch (error) {
|
|
49
70
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -52,13 +73,105 @@ let PushSingleCommandHandler = PushSingleCommandHandler_1 = class PushSingleComm
|
|
|
52
73
|
}
|
|
53
74
|
});
|
|
54
75
|
}
|
|
76
|
+
planMapFileUpdate(command) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const { mapFile, key, secretPath, target } = command;
|
|
79
|
+
if (mapFile === undefined) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
const original = yield this.variableStore.readMapFileContent(mapFile);
|
|
83
|
+
const decision = decideMapFileUpdate(original, key, secretPath, target, mapFile);
|
|
84
|
+
switch (decision.kind) {
|
|
85
|
+
case 'create':
|
|
86
|
+
return {
|
|
87
|
+
mapFile,
|
|
88
|
+
original,
|
|
89
|
+
content: decision.content,
|
|
90
|
+
summary: `Created ${mapFile}`,
|
|
91
|
+
};
|
|
92
|
+
case 'append':
|
|
93
|
+
return {
|
|
94
|
+
mapFile,
|
|
95
|
+
original,
|
|
96
|
+
content: decision.content,
|
|
97
|
+
summary: `Added ${key} to ${mapFile}`,
|
|
98
|
+
};
|
|
99
|
+
case 'unchanged':
|
|
100
|
+
return {
|
|
101
|
+
mapFile,
|
|
102
|
+
original,
|
|
103
|
+
summary: `${key} already mapped in ${mapFile}, no changes`,
|
|
104
|
+
};
|
|
105
|
+
case 'targetMismatch':
|
|
106
|
+
return {
|
|
107
|
+
mapFile,
|
|
108
|
+
original,
|
|
109
|
+
summary: '',
|
|
110
|
+
warning: `\u26A0 ${mapFile} targets ${this.describeTarget(decision.fileTarget)}, ` +
|
|
111
|
+
`but the secret was pushed to ${this.describeTarget(target)}. ` +
|
|
112
|
+
'The mapping was not added. Use --map=<file> to record it in a different map file.',
|
|
113
|
+
};
|
|
114
|
+
case 'conflict':
|
|
115
|
+
// Names the variable only: the existing path is not ours to echo.
|
|
116
|
+
throw new InvalidArgumentError(`${key} is already mapped to a different secret path in ${mapFile}. ` +
|
|
117
|
+
'Nothing was pushed. Update the mapping manually, ' +
|
|
118
|
+
'or use --no-map-update to push without recording it.');
|
|
119
|
+
case 'invalidJson':
|
|
120
|
+
throw new EnvironmentFileError(`Invalid JSON in parameter map file: ${mapFile}`);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
writeMapFile(plan) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
if ((plan === null || plan === void 0 ? void 0 : plan.content) === undefined) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
yield this.variableStore.writeMapFileContent(plan.mapFile, plan.content);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
rollBackMapFile(plan, key) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
if ((plan === null || plan === void 0 ? void 0 : plan.content) === undefined) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
yield this.variableStore.restoreMapFile(plan.mapFile, plan.original);
|
|
139
|
+
}
|
|
140
|
+
catch (_a) {
|
|
141
|
+
this.logger.error(`Could not restore ${plan.mapFile}. Remove ${key} from it manually.`);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
reportMapFile(plan) {
|
|
146
|
+
if (plan === undefined) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (plan.warning !== undefined) {
|
|
150
|
+
this.logger.warn(pc.yellow(plan.warning));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this.logger.info(`${pc.green('\u2713')} ${plan.summary}\n`);
|
|
154
|
+
}
|
|
155
|
+
/** Provider and vault name only: a vault URL may carry credentials. */
|
|
156
|
+
describeTarget(target) {
|
|
157
|
+
if (target.provider !== 'azure' || !target.vaultUrl) {
|
|
158
|
+
return target.provider;
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
return `${target.provider} (${new URL(target.vaultUrl).hostname.split('.')[0]})`;
|
|
162
|
+
}
|
|
163
|
+
catch (_a) {
|
|
164
|
+
return target.provider;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
55
167
|
};
|
|
56
168
|
PushSingleCommandHandler.RULE = pc.magenta('\u2501'.repeat(60));
|
|
57
169
|
PushSingleCommandHandler = PushSingleCommandHandler_1 = __decorate([
|
|
58
170
|
injectable(),
|
|
59
171
|
__param(0, inject(TYPES.ISecretProvider)),
|
|
60
172
|
__param(1, inject(TYPES.ILogger)),
|
|
61
|
-
|
|
173
|
+
__param(2, inject(TYPES.IVariableStore)),
|
|
174
|
+
__metadata("design:paramtypes", [Object, Object, Object])
|
|
62
175
|
], PushSingleCommandHandler);
|
|
63
176
|
export { PushSingleCommandHandler };
|
|
64
177
|
//# sourceMappingURL=PushSingleCommandHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushSingleCommandHandler.js","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommandHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"PushSingleCommandHandler.js","sourceRoot":"","sources":["../../../../../src/envilder/core/application/pushSingle/PushSingleCommandHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAehC,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAGnC,YAEmB,cAA+B,EACR,MAAe,EAEtC,aAA6B;8BAH7B,cAAc;sBACS,MAAM;6BAE7B,aAAa;IAC7B,CAAC;IAEJ;;;;;;OAMG;IACG,MAAM,CAAC,OAA0B;;YACrC,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,mBAAmB,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBAE1E,IAAI,CAAC,MAAM,CAAC,IAAI,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AC,KAAK,CAAC,eAAe,CAAC,CAAA;IAE7B,WAAA,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACrB,WAAA,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;;GAPpB,wBAAwB,CA6KpC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MapFileTarget } from './MapFileUpdate.js';
|
|
1
2
|
/**
|
|
2
3
|
* Options for the CLI commands.
|
|
3
4
|
*/
|
|
@@ -30,5 +31,15 @@ export type CliOptions = {
|
|
|
30
31
|
* Flag to push local .env file back to the secret store
|
|
31
32
|
*/
|
|
32
33
|
push?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* False when `--no-map-update` is given: a single-secret push neither reads
|
|
36
|
+
* nor writes a map file
|
|
37
|
+
*/
|
|
38
|
+
mapUpdate?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Effective provider target of a single-secret push, compared with the map
|
|
41
|
+
* file's own target before the mapping is recorded
|
|
42
|
+
*/
|
|
43
|
+
mapTarget?: MapFileTarget;
|
|
33
44
|
};
|
|
34
45
|
//# sourceMappingURL=CliOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CliOptions.d.ts","sourceRoot":"","sources":["../../../../src/envilder/core/domain/CliOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CliOptions.d.ts","sourceRoot":"","sources":["../../../../src/envilder/core/domain/CliOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { MapFileConfig } from './MapFileConfig.js';
|
|
2
|
+
export declare const MAP_FILE_SCHEMA_URL = "https://envilder.com/schema/map-file.v1.json";
|
|
3
|
+
/**
|
|
4
|
+
* Where a secret is pushed to. A profile is deliberately absent: it is a
|
|
5
|
+
* local credential choice and never belongs in a committed map file.
|
|
6
|
+
*/
|
|
7
|
+
export type MapFileTarget = {
|
|
8
|
+
provider: string;
|
|
9
|
+
vaultUrl?: string;
|
|
10
|
+
};
|
|
11
|
+
export type MapFileUpdateDecision = {
|
|
12
|
+
kind: 'create';
|
|
13
|
+
content: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'append';
|
|
16
|
+
content: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'unchanged';
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'conflict';
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'invalidJson';
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'targetMismatch';
|
|
25
|
+
fileTarget: MapFileTarget;
|
|
26
|
+
};
|
|
27
|
+
export declare function resolveMapFileTarget(config: MapFileConfig): MapFileTarget;
|
|
28
|
+
/**
|
|
29
|
+
* Decides how recording `key` -> `secretPath` changes a map file. Pure: it
|
|
30
|
+
* never touches the filesystem, so every outcome can be checked on strings.
|
|
31
|
+
*
|
|
32
|
+
* A file that targets somewhere else than the push is left alone, and that
|
|
33
|
+
* outranks a conflicting mapping, because the mapping then describes another
|
|
34
|
+
* secret store.
|
|
35
|
+
*/
|
|
36
|
+
export declare function decideMapFileUpdate(existingContent: string | null, key: string, secretPath: string, target: MapFileTarget, mapFile: string): MapFileUpdateDecision;
|
|
37
|
+
//# sourceMappingURL=MapFileUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapFileUpdate.d.ts","sourceRoot":"","sources":["../../../../src/envilder/core/domain/MapFileUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,mBAAmB,iDACgB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,UAAU,EAAE,aAAa,CAAA;CAAE,CAAC;AAe1D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAMzE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,GACd,qBAAqB,CA+BvB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export const MAP_FILE_SCHEMA_URL = 'https://envilder.com/schema/map-file.v1.json';
|
|
2
|
+
const DEFAULT_PROVIDER = 'aws';
|
|
3
|
+
const DEFAULT_LAYOUT = {
|
|
4
|
+
indent: 2,
|
|
5
|
+
newline: '\n',
|
|
6
|
+
trailingNewline: true,
|
|
7
|
+
};
|
|
8
|
+
export function resolveMapFileTarget(config) {
|
|
9
|
+
var _a;
|
|
10
|
+
const provider = ((_a = config.provider) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || DEFAULT_PROVIDER;
|
|
11
|
+
if (provider === 'azure' && config.vaultUrl) {
|
|
12
|
+
return { provider, vaultUrl: config.vaultUrl };
|
|
13
|
+
}
|
|
14
|
+
return { provider };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Decides how recording `key` -> `secretPath` changes a map file. Pure: it
|
|
18
|
+
* never touches the filesystem, so every outcome can be checked on strings.
|
|
19
|
+
*
|
|
20
|
+
* A file that targets somewhere else than the push is left alone, and that
|
|
21
|
+
* outranks a conflicting mapping, because the mapping then describes another
|
|
22
|
+
* secret store.
|
|
23
|
+
*/
|
|
24
|
+
export function decideMapFileUpdate(existingContent, key, secretPath, target, mapFile) {
|
|
25
|
+
if (existingContent === null) {
|
|
26
|
+
const file = buildNewFile(key, secretPath, target, mapFile);
|
|
27
|
+
return { kind: 'create', content: serialize(file, DEFAULT_LAYOUT) };
|
|
28
|
+
}
|
|
29
|
+
const parsed = parseObject(existingContent);
|
|
30
|
+
if (parsed === undefined) {
|
|
31
|
+
return { kind: 'invalidJson' };
|
|
32
|
+
}
|
|
33
|
+
const fileTarget = resolveMapFileTarget(readConfig(parsed));
|
|
34
|
+
if (!sameTarget(fileTarget, target)) {
|
|
35
|
+
return { kind: 'targetMismatch', fileTarget };
|
|
36
|
+
}
|
|
37
|
+
if (Object.hasOwn(parsed, key)) {
|
|
38
|
+
return parsed[key] === secretPath
|
|
39
|
+
? { kind: 'unchanged' }
|
|
40
|
+
: { kind: 'conflict' };
|
|
41
|
+
}
|
|
42
|
+
// fromEntries defines own properties, so a `__proto__` key stays data.
|
|
43
|
+
const updated = Object.fromEntries([
|
|
44
|
+
...Object.entries(parsed),
|
|
45
|
+
[key, secretPath],
|
|
46
|
+
]);
|
|
47
|
+
return {
|
|
48
|
+
kind: 'append',
|
|
49
|
+
content: serialize(updated, detectLayout(existingContent)),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* File names SchemaStore already associates with the map-file schema
|
|
54
|
+
* (`envilder.json`, `envilder.*.json`), so editors validate them without a
|
|
55
|
+
* `$schema` key.
|
|
56
|
+
*/
|
|
57
|
+
const SCHEMA_STORE_FILE_NAME = /^envilder(?:\.[^.]+)*\.json$/;
|
|
58
|
+
function buildNewFile(key, secretPath, target, mapFile) {
|
|
59
|
+
var _a;
|
|
60
|
+
const fileName = (_a = mapFile.split(/[\\/]/).pop()) !== null && _a !== void 0 ? _a : mapFile;
|
|
61
|
+
const file = SCHEMA_STORE_FILE_NAME.test(fileName)
|
|
62
|
+
? {}
|
|
63
|
+
: { $schema: MAP_FILE_SCHEMA_URL };
|
|
64
|
+
if (target.provider !== DEFAULT_PROVIDER) {
|
|
65
|
+
file.$config = Object.assign({ provider: target.provider }, (target.vaultUrl && { vaultUrl: target.vaultUrl }));
|
|
66
|
+
}
|
|
67
|
+
file[key] = secretPath;
|
|
68
|
+
return file;
|
|
69
|
+
}
|
|
70
|
+
function parseObject(content) {
|
|
71
|
+
try {
|
|
72
|
+
const value = JSON.parse(content);
|
|
73
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
74
|
+
? value
|
|
75
|
+
: undefined;
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function readConfig(parsed) {
|
|
82
|
+
const config = parsed.$config;
|
|
83
|
+
return config && typeof config === 'object' ? config : {};
|
|
84
|
+
}
|
|
85
|
+
function sameTarget(a, b) {
|
|
86
|
+
return (a.provider === b.provider &&
|
|
87
|
+
normalizeVaultUrl(a.vaultUrl) === normalizeVaultUrl(b.vaultUrl));
|
|
88
|
+
}
|
|
89
|
+
function normalizeVaultUrl(vaultUrl) {
|
|
90
|
+
return vaultUrl === null || vaultUrl === void 0 ? void 0 : vaultUrl.trim().replace(/\/+$/, '').toLowerCase();
|
|
91
|
+
}
|
|
92
|
+
function detectLayout(content) {
|
|
93
|
+
var _a;
|
|
94
|
+
const indent = (_a = /\n([ \t]+)\S/.exec(content)) === null || _a === void 0 ? void 0 : _a[1];
|
|
95
|
+
return {
|
|
96
|
+
indent: indent !== null && indent !== void 0 ? indent : DEFAULT_LAYOUT.indent,
|
|
97
|
+
newline: content.includes('\r\n') ? '\r\n' : '\n',
|
|
98
|
+
trailingNewline: /\n$/.test(content),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function serialize(value, layout) {
|
|
102
|
+
const body = JSON.stringify(value, null, layout.indent).replace(/\n/g, layout.newline);
|
|
103
|
+
return layout.trailingNewline ? `${body}${layout.newline}` : body;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=MapFileUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapFileUpdate.js","sourceRoot":"","sources":["../../../../src/envilder/core/domain/MapFileUpdate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAC9B,8CAA8C,CAAC;AAyBjD,MAAM,gBAAgB,G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,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAA8B,EAAE,MAAc;IAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAC7D,KAAK,EACL,MAAM,CAAC,OAAO,CACf,CAAC;IACF,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC"}
|
|
@@ -4,5 +4,14 @@ export interface IVariableStore {
|
|
|
4
4
|
getParsedMapping(source: string): Promise<ParsedMapFile>;
|
|
5
5
|
getEnvironment(source: string): Promise<Record<string, string>>;
|
|
6
6
|
saveEnvironment(destination: string, envVariables: Record<string, string>): Promise<void>;
|
|
7
|
+
/** Raw map-file text, or `null` when the file does not exist. */
|
|
8
|
+
readMapFileContent(source: string): Promise<string | null>;
|
|
9
|
+
/** Writes map-file text as given; never creates missing directories. */
|
|
10
|
+
writeMapFileContent(destination: string, content: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Puts a map file back as it was: writes `original`, or removes the file
|
|
13
|
+
* when `original` is `null` because it did not exist before.
|
|
14
|
+
*/
|
|
15
|
+
restoreMapFile(destination: string, original: string | null): Promise<void>;
|
|
7
16
|
}
|
|
8
17
|
//# sourceMappingURL=IVariableStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IVariableStore.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/domain/ports/IVariableStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,gBA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
|
|
@@ -6,12 +6,15 @@ export declare class AzureKeyVaultSecretProvider implements ISecretProvider {
|
|
|
6
6
|
constructor(client: SecretClient);
|
|
7
7
|
getSecret(name: string): Promise<string | undefined>;
|
|
8
8
|
setSecret(name: string, value: string): Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* Validates that the secret name meets Azure Key Vault naming constraints.
|
|
11
|
-
* @see https://learn.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#objects-identifiers-and-versioning
|
|
12
|
-
*/
|
|
13
|
-
private validateSecretName;
|
|
14
9
|
private resolveSecretName;
|
|
15
|
-
private normalizeSecretName;
|
|
16
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The only translation between a map-file reference and a Key Vault secret
|
|
13
|
+
* name, shared with every SDK: `/` becomes `-`, ignoring leading slashes, so
|
|
14
|
+
* a path-style reference such as `/myapp/db/password` reads
|
|
15
|
+
* `myapp-db-password`. Anything else reaches Key Vault as written, and a
|
|
16
|
+
* name it does not accept fails with Key Vault's own error.
|
|
17
|
+
* @see https://learn.microsoft.com/azure/key-vault/general/about-keys-secrets-certificates#objects-identifiers-and-versioning
|
|
18
|
+
*/
|
|
19
|
+
export declare function toAzureSecretName(name: string): string;
|
|
17
20
|
//# sourceMappingURL=AzureKeyVaultSecretProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureKeyVaultSecretProvider.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAO5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAG7E,qBACa,2BAA4B,YAAW,eAAe;IACjE,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,sBAAsB,CAA6B;IAE3D,YAAY,MAAM,EAAE,YAAY,EAE/B;IAEK,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkBzD;IAEK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1D;IAED
|
|
1
|
+
{"version":3,"file":"AzureKeyVaultSecretProvider.d.ts","sourceRoot":"","sources":["../../../../../src/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAO5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAG7E,qBACa,2BAA4B,YAAW,eAAe;IACjE,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,sBAAsB,CAA6B;IAE3D,YAAY,MAAM,EAAE,YAAY,EAE/B;IAEK,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkBzD;IAEK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1D;IAED,OAAO,CAAC,iBAAiB;CAsB1B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -50,58 +50,22 @@ let AzureKeyVaultSecretProvider = class AzureKeyVaultSecretProvider {
|
|
|
50
50
|
yield this.client.setSecret(secretName, value);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Validates that the secret name meets Azure Key Vault naming constraints.
|
|
55
|
-
* @see https://learn.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#objects-identifiers-and-versioning
|
|
56
|
-
*/
|
|
57
|
-
validateSecretName(name) {
|
|
58
|
-
if (name.trim().length === 0) {
|
|
59
|
-
throw new InvalidArgumentError('Invalid secret name: name cannot be empty or whitespace-only.');
|
|
60
|
-
}
|
|
61
|
-
if (/[^a-zA-Z0-9\-_/]/.test(name)) {
|
|
62
|
-
throw new InvalidArgumentError(`Invalid secret name '${name}': contains characters not allowed` +
|
|
63
|
-
' by Azure Key Vault. Only alphanumeric characters,' +
|
|
64
|
-
' hyphens, slashes, and underscores are accepted.');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
53
|
resolveSecretName(originalName) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (normalized.length > 127) {
|
|
71
|
-
throw new InvalidArgumentError(`Invalid secret name '${originalName}': normalized name '${normalized}' exceeds the 127-character limit for Azure Key Vault.`);
|
|
54
|
+
if (originalName.trim().length === 0) {
|
|
55
|
+
throw new InvalidArgumentError('Invalid secret name: name cannot be empty or whitespace-only.');
|
|
72
56
|
}
|
|
73
|
-
const
|
|
57
|
+
const normalized = toAzureSecretName(originalName);
|
|
58
|
+
// Key Vault names are case-insensitive, so two references that differ
|
|
59
|
+
// only by case still address the same secret.
|
|
60
|
+
const registryKey = normalized.toLowerCase();
|
|
61
|
+
const existing = this.normalizedNameRegistry.get(registryKey);
|
|
74
62
|
if (existing !== undefined && existing !== originalName) {
|
|
75
63
|
throw new SecretOperationError(`Secret name collision: '${originalName}' and '${existing}' ` +
|
|
76
|
-
`both
|
|
77
|
-
'Key Vault
|
|
64
|
+
`both resolve to '${normalized}'. Use distinct ` +
|
|
65
|
+
'Key Vault secret names in your map file ' +
|
|
78
66
|
'when targeting Azure.');
|
|
79
67
|
}
|
|
80
|
-
this.normalizedNameRegistry.set(
|
|
81
|
-
return normalized;
|
|
82
|
-
}
|
|
83
|
-
// Azure Key Vault secret names: 1-127 chars, alphanumeric + hyphens, start with letter
|
|
84
|
-
normalizeSecretName(name) {
|
|
85
|
-
// Remove leading slashes
|
|
86
|
-
let normalized = name.replace(/^\/+/, '');
|
|
87
|
-
// Replace slashes and underscores with hyphens
|
|
88
|
-
normalized = normalized.replace(/[/_]/g, '-');
|
|
89
|
-
// Lowercase to match Azure Key Vault case-insensitivity
|
|
90
|
-
normalized = normalized.toLowerCase();
|
|
91
|
-
// Remove invalid characters
|
|
92
|
-
normalized = normalized.replace(/[^a-zA-Z0-9-]/g, '');
|
|
93
|
-
// Remove consecutive hyphens
|
|
94
|
-
normalized = normalized.replace(/-+/g, '-');
|
|
95
|
-
// Remove leading/trailing hyphens
|
|
96
|
-
normalized = normalized.replace(/^-+|-+$/g, '');
|
|
97
|
-
// Ensure starts with a letter
|
|
98
|
-
if (normalized.length > 0 && !/^[a-zA-Z]/.test(normalized)) {
|
|
99
|
-
normalized = `secret-${normalized}`;
|
|
100
|
-
}
|
|
101
|
-
// Default name if empty
|
|
102
|
-
if (normalized.length === 0) {
|
|
103
|
-
normalized = 'secret';
|
|
104
|
-
}
|
|
68
|
+
this.normalizedNameRegistry.set(registryKey, originalName);
|
|
105
69
|
return normalized;
|
|
106
70
|
}
|
|
107
71
|
};
|
|
@@ -110,4 +74,15 @@ AzureKeyVaultSecretProvider = __decorate([
|
|
|
110
74
|
__metadata("design:paramtypes", [Function])
|
|
111
75
|
], AzureKeyVaultSecretProvider);
|
|
112
76
|
export { AzureKeyVaultSecretProvider };
|
|
77
|
+
/**
|
|
78
|
+
* The only translation between a map-file reference and a Key Vault secret
|
|
79
|
+
* name, shared with every SDK: `/` becomes `-`, ignoring leading slashes, so
|
|
80
|
+
* a path-style reference such as `/myapp/db/password` reads
|
|
81
|
+
* `myapp-db-password`. Anything else reaches Key Vault as written, and a
|
|
82
|
+
* name it does not accept fails with Key Vault's own error.
|
|
83
|
+
* @see https://learn.microsoft.com/azure/key-vault/general/about-keys-secrets-certificates#objects-identifiers-and-versioning
|
|
84
|
+
*/
|
|
85
|
+
export function toAzureSecretName(name) {
|
|
86
|
+
return name.replace(/^\/+/, '').replace(/\//g, '-');
|
|
87
|
+
}
|
|
113
88
|
//# sourceMappingURL=AzureKeyVaultSecretProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureKeyVaultSecretProvider.js","sourceRoot":"","sources":["../../../../../src/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG7C,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAItC,YAAY,MAAoB;QAFxB,2BAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;QAGzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,SAAS,CAAC,IAAY;;;YAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAChD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;gBACvD,aAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,mCAAI,SAAS,CAAC;YACpC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IACE,OAAO,KAAK,KAAK,QAAQ;oBACzB,KAAK,KAAK,IAAI;oBACd,YAAY,IAAI,KAAK;oBACrB,KAAK,CAAC,UAAU,KAAK,GAAG,EACxB,CAAC;oBACD,OAAO,SAAS,CAAC;gBACnB,CAAC;gBACD,MAAM,IAAI,oBAAoB,CAC5B,GAAG,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,aAAa,CAAC,KAAK,CAAC,EAAE,CACvE,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IAEK,SAAS,CAAC,IAAY,EAAE,KAAa;;YACzC,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAChD,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;KAAA;
|
|
1
|
+
{"version":3,"file":"AzureKeyVaultSecretProvider.js","sourceRoot":"","sources":["../../../../../src/envilder/core/infrastructure/azure/AzureKeyVaultSecretProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG7C,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAItC,YAAY,MAAoB;QAFxB,2BAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;QAGzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,SAAS,CAAC,IAAY;;;YAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAChD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;gBACvD,aAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,mCAAI,SAAS,CAAC;YACpC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IACE,OAAO,KAAK,KAAK,QAAQ;oBACzB,KAAK,KAAK,IAAI;oBACd,YAAY,IAAI,KAAK;oBACrB,KAAK,CAAC,UAAU,KAAK,GAAG,EACxB,CAAC;oBACD,OAAO,SAAS,CAAC;gBACnB,CAAC;gBACD,MAAM,IAAI,oBAAoB,CAC5B,GAAG,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,KA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