@jjrawlins/cdk-iam-policy-builder-helper 0.0.52 → 0.0.54
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/.jsii +3 -3
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +13439 -13574
- package/node_modules/@aws-sdk/client-iam/package.json +6 -6
- package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +478 -596
- package/node_modules/@aws-sdk/client-sso/package.json +5 -5
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +1969 -6
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +48 -88
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +35 -74
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +273 -365
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1581 -1863
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +2 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/XmlCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +38 -73
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +194 -259
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +72 -132
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +71 -107
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +176 -249
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-CVy8iqsZ.js +14 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +16 -25
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +170 -203
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +583 -858
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +795 -928
- package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +147 -222
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/README.md +22 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/createUserAgentStringParsingProvider.js +57 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.js +39 -8
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/createUserAgentStringParsingProvider.js +20 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.js +37 -6
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/createUserAgentStringParsingProvider.d.ts +14 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.d.ts +14 -4
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.native.d.ts +4 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/createUserAgentStringParsingProvider.d.ts +9 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/index.d.ts +5 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +1 -1
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +50 -94
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/crt-availability.d.ts +1 -2
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/defaultUserAgent.d.ts +10 -5
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +5 -3
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +32 -30
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +133 -202
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +126 -34
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +5 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +3 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +19 -17
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js +5 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +82 -176
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +22 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js +110 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +4 -26
- package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/package.json +3 -3
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-base64/dist-cjs/constants.browser.js +9 -32
- package/node_modules/@smithy/util-base64/dist-es/constants.browser.js +9 -28
- package/node_modules/@smithy/util-base64/dist-types/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/dist-types/ts3.4/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/package.json +1 -1
- package/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +8 -6
- package/node_modules/@smithy/util-body-length-node/dist-es/calculateBodyLength.js +8 -6
- package/node_modules/@smithy/util-body-length-node/package.json +1 -1
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.js +11 -9
- package/node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js +11 -8
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -3
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/dist-cjs/index.js +3 -5
- package/node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js +3 -5
- package/node_modules/@smithy/util-stream/dist-types/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/dist-types/ts3.4/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/package.json +3 -3
- package/package.json +3 -3
|
@@ -1,391 +1,299 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/submodules/httpAuthSchemes/index.ts
|
|
22
|
-
var index_exports = {};
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
AWSSDKSigV4Signer: () => AWSSDKSigV4Signer,
|
|
25
|
-
AwsSdkSigV4ASigner: () => AwsSdkSigV4ASigner,
|
|
26
|
-
AwsSdkSigV4Signer: () => AwsSdkSigV4Signer,
|
|
27
|
-
NODE_AUTH_SCHEME_PREFERENCE_OPTIONS: () => NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,
|
|
28
|
-
NODE_SIGV4A_CONFIG_OPTIONS: () => NODE_SIGV4A_CONFIG_OPTIONS,
|
|
29
|
-
getBearerTokenEnvKey: () => getBearerTokenEnvKey,
|
|
30
|
-
resolveAWSSDKSigV4Config: () => resolveAWSSDKSigV4Config,
|
|
31
|
-
resolveAwsSdkSigV4AConfig: () => resolveAwsSdkSigV4AConfig,
|
|
32
|
-
resolveAwsSdkSigV4Config: () => resolveAwsSdkSigV4Config,
|
|
33
|
-
validateSigningProperties: () => validateSigningProperties
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(index_exports);
|
|
1
|
+
'use strict';
|
|
36
2
|
|
|
37
|
-
|
|
38
|
-
var
|
|
3
|
+
var protocolHttp = require('@smithy/protocol-http');
|
|
4
|
+
var core = require('@smithy/core');
|
|
5
|
+
var propertyProvider = require('@smithy/property-provider');
|
|
6
|
+
var client = require('@aws-sdk/core/client');
|
|
7
|
+
var signatureV4 = require('@smithy/signature-v4');
|
|
39
8
|
|
|
40
|
-
|
|
41
|
-
var import_protocol_http = require("@smithy/protocol-http");
|
|
42
|
-
var getDateHeader = /* @__PURE__ */ __name((response) => import_protocol_http.HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : void 0, "getDateHeader");
|
|
9
|
+
const getDateHeader = (response) => protocolHttp.HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
|
|
43
10
|
|
|
44
|
-
|
|
45
|
-
var getSkewCorrectedDate = /* @__PURE__ */ __name((systemClockOffset) => new Date(Date.now() + systemClockOffset), "getSkewCorrectedDate");
|
|
11
|
+
const getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
|
|
46
12
|
|
|
47
|
-
|
|
48
|
-
var isClockSkewed = /* @__PURE__ */ __name((clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5, "isClockSkewed");
|
|
13
|
+
const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000;
|
|
49
14
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, "getUpdatedSystemClockOffset");
|
|
15
|
+
const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
|
|
16
|
+
const clockTimeInMs = Date.parse(clockTime);
|
|
17
|
+
if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
|
|
18
|
+
return clockTimeInMs - Date.now();
|
|
19
|
+
}
|
|
20
|
+
return currentSystemClockOffset;
|
|
21
|
+
};
|
|
58
22
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
23
|
+
const throwSigningPropertyError = (name, property) => {
|
|
24
|
+
if (!property) {
|
|
25
|
+
throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`);
|
|
26
|
+
}
|
|
27
|
+
return property;
|
|
28
|
+
};
|
|
29
|
+
const validateSigningProperties = async (signingProperties) => {
|
|
30
|
+
const context = throwSigningPropertyError("context", signingProperties.context);
|
|
31
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
32
|
+
const authScheme = context.endpointV2?.properties?.authSchemes?.[0];
|
|
33
|
+
const signerFunction = throwSigningPropertyError("signer", config.signer);
|
|
34
|
+
const signer = await signerFunction(authScheme);
|
|
35
|
+
const signingRegion = signingProperties?.signingRegion;
|
|
36
|
+
const signingRegionSet = signingProperties?.signingRegionSet;
|
|
37
|
+
const signingName = signingProperties?.signingName;
|
|
38
|
+
return {
|
|
39
|
+
config,
|
|
40
|
+
signer,
|
|
41
|
+
signingRegion,
|
|
42
|
+
signingRegionSet,
|
|
43
|
+
signingName,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
class AwsSdkSigV4Signer {
|
|
47
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
48
|
+
if (!protocolHttp.HttpRequest.isInstance(httpRequest)) {
|
|
49
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
50
|
+
}
|
|
51
|
+
const validatedProps = await validateSigningProperties(signingProperties);
|
|
52
|
+
const { config, signer } = validatedProps;
|
|
53
|
+
let { signingRegion, signingName } = validatedProps;
|
|
54
|
+
const handlerExecutionContext = signingProperties.context;
|
|
55
|
+
if (handlerExecutionContext?.authSchemes?.length ?? 0 > 1) {
|
|
56
|
+
const [first, second] = handlerExecutionContext.authSchemes;
|
|
57
|
+
if (first?.name === "sigv4a" && second?.name === "sigv4") {
|
|
58
|
+
signingRegion = second?.signingRegion ?? signingRegion;
|
|
59
|
+
signingName = second?.signingName ?? signingName;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
63
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
64
|
+
signingRegion: signingRegion,
|
|
65
|
+
signingService: signingName,
|
|
66
|
+
});
|
|
67
|
+
return signedRequest;
|
|
96
68
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
69
|
+
errorHandler(signingProperties) {
|
|
70
|
+
return (error) => {
|
|
71
|
+
const serverTime = error.ServerTime ?? getDateHeader(error.$response);
|
|
72
|
+
if (serverTime) {
|
|
73
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
74
|
+
const initialSystemClockOffset = config.systemClockOffset;
|
|
75
|
+
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
76
|
+
const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
|
|
77
|
+
if (clockSkewCorrected && error.$metadata) {
|
|
78
|
+
error.$metadata.clockSkewCorrected = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
throw error;
|
|
82
|
+
};
|
|
107
83
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return signedRequest;
|
|
114
|
-
}
|
|
115
|
-
errorHandler(signingProperties) {
|
|
116
|
-
return (error) => {
|
|
117
|
-
const serverTime = error.ServerTime ?? getDateHeader(error.$response);
|
|
118
|
-
if (serverTime) {
|
|
119
|
-
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
120
|
-
const initialSystemClockOffset = config.systemClockOffset;
|
|
121
|
-
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
122
|
-
const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
|
|
123
|
-
if (clockSkewCorrected && error.$metadata) {
|
|
124
|
-
error.$metadata.clockSkewCorrected = true;
|
|
84
|
+
successHandler(httpResponse, signingProperties) {
|
|
85
|
+
const dateHeader = getDateHeader(httpResponse);
|
|
86
|
+
if (dateHeader) {
|
|
87
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
88
|
+
config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
|
|
125
89
|
}
|
|
126
|
-
}
|
|
127
|
-
throw error;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
successHandler(httpResponse, signingProperties) {
|
|
131
|
-
const dateHeader = getDateHeader(httpResponse);
|
|
132
|
-
if (dateHeader) {
|
|
133
|
-
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
134
|
-
config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
|
|
135
90
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var AWSSDKSigV4Signer = AwsSdkSigV4Signer;
|
|
91
|
+
}
|
|
92
|
+
const AWSSDKSigV4Signer = AwsSdkSigV4Signer;
|
|
139
93
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
94
|
+
class AwsSdkSigV4ASigner extends AwsSdkSigV4Signer {
|
|
95
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
96
|
+
if (!protocolHttp.HttpRequest.isInstance(httpRequest)) {
|
|
97
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
98
|
+
}
|
|
99
|
+
const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties);
|
|
100
|
+
const configResolvedSigningRegionSet = await config.sigv4aSigningRegionSet?.();
|
|
101
|
+
const multiRegionOverride = (configResolvedSigningRegionSet ??
|
|
102
|
+
signingRegionSet ?? [signingRegion]).join(",");
|
|
103
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
104
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
105
|
+
signingRegion: multiRegionOverride,
|
|
106
|
+
signingService: signingName,
|
|
107
|
+
});
|
|
108
|
+
return signedRequest;
|
|
149
109
|
}
|
|
150
|
-
|
|
151
|
-
signingProperties
|
|
152
|
-
);
|
|
153
|
-
const configResolvedSigningRegionSet = await config.sigv4aSigningRegionSet?.();
|
|
154
|
-
const multiRegionOverride = (configResolvedSigningRegionSet ?? signingRegionSet ?? [signingRegion]).join(",");
|
|
155
|
-
const signedRequest = await signer.sign(httpRequest, {
|
|
156
|
-
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
157
|
-
signingRegion: multiRegionOverride,
|
|
158
|
-
signingService: signingName
|
|
159
|
-
});
|
|
160
|
-
return signedRequest;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
110
|
+
}
|
|
163
111
|
|
|
164
|
-
|
|
165
|
-
var getArrayForCommaSeparatedString = /* @__PURE__ */ __name((str) => typeof str === "string" && str.length > 0 ? str.split(",").map((item) => item.trim()) : [], "getArrayForCommaSeparatedString");
|
|
112
|
+
const getArrayForCommaSeparatedString = (str) => typeof str === "string" && str.length > 0 ? str.split(",").map((item) => item.trim()) : [];
|
|
166
113
|
|
|
167
|
-
|
|
168
|
-
var getBearerTokenEnvKey = /* @__PURE__ */ __name((signingName) => `AWS_BEARER_TOKEN_${signingName.replace(/[\s-]/g, "_").toUpperCase()}`, "getBearerTokenEnvKey");
|
|
114
|
+
const getBearerTokenEnvKey = (signingName) => `AWS_BEARER_TOKEN_${signingName.replace(/[\s-]/g, "_").toUpperCase()}`;
|
|
169
115
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* @param profile - Config profile object
|
|
190
|
-
* @returns Array of auth scheme strings if preference is set, undefined otherwise
|
|
191
|
-
*/
|
|
192
|
-
configFileSelector: /* @__PURE__ */ __name((profile) => {
|
|
193
|
-
if (!(NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY in profile)) return void 0;
|
|
194
|
-
return getArrayForCommaSeparatedString(profile[NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY]);
|
|
195
|
-
}, "configFileSelector"),
|
|
196
|
-
/**
|
|
197
|
-
* Default auth scheme preference if not specified in environment or config
|
|
198
|
-
*/
|
|
199
|
-
default: []
|
|
116
|
+
const NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY = "AWS_AUTH_SCHEME_PREFERENCE";
|
|
117
|
+
const NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY = "auth_scheme_preference";
|
|
118
|
+
const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = {
|
|
119
|
+
environmentVariableSelector: (env, options) => {
|
|
120
|
+
if (options?.signingName) {
|
|
121
|
+
const bearerTokenKey = getBearerTokenEnvKey(options.signingName);
|
|
122
|
+
if (bearerTokenKey in env)
|
|
123
|
+
return ["httpBearerAuth"];
|
|
124
|
+
}
|
|
125
|
+
if (!(NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY in env))
|
|
126
|
+
return undefined;
|
|
127
|
+
return getArrayForCommaSeparatedString(env[NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY]);
|
|
128
|
+
},
|
|
129
|
+
configFileSelector: (profile) => {
|
|
130
|
+
if (!(NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY in profile))
|
|
131
|
+
return undefined;
|
|
132
|
+
return getArrayForCommaSeparatedString(profile[NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY]);
|
|
133
|
+
},
|
|
134
|
+
default: [],
|
|
200
135
|
};
|
|
201
136
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
var resolveAwsSdkSigV4AConfig = /* @__PURE__ */ __name((config) => {
|
|
206
|
-
config.sigv4aSigningRegionSet = (0, import_core.normalizeProvider)(config.sigv4aSigningRegionSet);
|
|
207
|
-
return config;
|
|
208
|
-
}, "resolveAwsSdkSigV4AConfig");
|
|
209
|
-
var NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
210
|
-
environmentVariableSelector(env) {
|
|
211
|
-
if (env.AWS_SIGV4A_SIGNING_REGION_SET) {
|
|
212
|
-
return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim());
|
|
213
|
-
}
|
|
214
|
-
throw new import_property_provider.ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
|
|
215
|
-
tryNextLink: true
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
configFileSelector(profile) {
|
|
219
|
-
if (profile.sigv4a_signing_region_set) {
|
|
220
|
-
return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim());
|
|
221
|
-
}
|
|
222
|
-
throw new import_property_provider.ProviderError("sigv4a_signing_region_set not set in profile.", {
|
|
223
|
-
tryNextLink: true
|
|
224
|
-
});
|
|
225
|
-
},
|
|
226
|
-
default: void 0
|
|
137
|
+
const resolveAwsSdkSigV4AConfig = (config) => {
|
|
138
|
+
config.sigv4aSigningRegionSet = core.normalizeProvider(config.sigv4aSigningRegionSet);
|
|
139
|
+
return config;
|
|
227
140
|
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
let resolvedCredentials = void 0;
|
|
237
|
-
Object.defineProperty(config, "credentials", {
|
|
238
|
-
set(credentials) {
|
|
239
|
-
if (credentials && credentials !== inputCredentials && credentials !== resolvedCredentials) {
|
|
240
|
-
isUserSupplied = true;
|
|
241
|
-
}
|
|
242
|
-
inputCredentials = credentials;
|
|
243
|
-
const memoizedProvider = normalizeCredentialProvider(config, {
|
|
244
|
-
credentials: inputCredentials,
|
|
245
|
-
credentialDefaultProvider: config.credentialDefaultProvider
|
|
246
|
-
});
|
|
247
|
-
const boundProvider = bindCallerConfig(config, memoizedProvider);
|
|
248
|
-
if (isUserSupplied && !boundProvider.attributed) {
|
|
249
|
-
resolvedCredentials = /* @__PURE__ */ __name(async (options) => boundProvider(options).then(
|
|
250
|
-
(creds) => (0, import_client.setCredentialFeature)(creds, "CREDENTIALS_CODE", "e")
|
|
251
|
-
), "resolvedCredentials");
|
|
252
|
-
resolvedCredentials.memoized = boundProvider.memoized;
|
|
253
|
-
resolvedCredentials.configBound = boundProvider.configBound;
|
|
254
|
-
resolvedCredentials.attributed = true;
|
|
255
|
-
} else {
|
|
256
|
-
resolvedCredentials = boundProvider;
|
|
257
|
-
}
|
|
141
|
+
const NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
142
|
+
environmentVariableSelector(env) {
|
|
143
|
+
if (env.AWS_SIGV4A_SIGNING_REGION_SET) {
|
|
144
|
+
return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim());
|
|
145
|
+
}
|
|
146
|
+
throw new propertyProvider.ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
|
|
147
|
+
tryNextLink: true,
|
|
148
|
+
});
|
|
258
149
|
},
|
|
259
|
-
|
|
260
|
-
|
|
150
|
+
configFileSelector(profile) {
|
|
151
|
+
if (profile.sigv4a_signing_region_set) {
|
|
152
|
+
return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim());
|
|
153
|
+
}
|
|
154
|
+
throw new propertyProvider.ProviderError("sigv4a_signing_region_set not set in profile.", {
|
|
155
|
+
tryNextLink: true,
|
|
156
|
+
});
|
|
261
157
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
credentials: config.credentials,
|
|
293
|
-
region: config.signingRegion,
|
|
294
|
-
service: config.signingName,
|
|
295
|
-
sha256,
|
|
296
|
-
uriEscapePath: signingEscapePath
|
|
297
|
-
};
|
|
298
|
-
const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4;
|
|
299
|
-
return new SignerCtor(params);
|
|
300
|
-
}), "signer");
|
|
301
|
-
} else {
|
|
302
|
-
signer = /* @__PURE__ */ __name(async (authScheme) => {
|
|
303
|
-
authScheme = Object.assign(
|
|
304
|
-
{},
|
|
305
|
-
{
|
|
306
|
-
name: "sigv4",
|
|
307
|
-
signingName: config.signingName || config.defaultSigningName,
|
|
308
|
-
signingRegion: await (0, import_core2.normalizeProvider)(config.region)(),
|
|
309
|
-
properties: {}
|
|
158
|
+
default: undefined,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const resolveAwsSdkSigV4Config = (config) => {
|
|
162
|
+
let inputCredentials = config.credentials;
|
|
163
|
+
let isUserSupplied = !!config.credentials;
|
|
164
|
+
let resolvedCredentials = undefined;
|
|
165
|
+
Object.defineProperty(config, "credentials", {
|
|
166
|
+
set(credentials) {
|
|
167
|
+
if (credentials && credentials !== inputCredentials && credentials !== resolvedCredentials) {
|
|
168
|
+
isUserSupplied = true;
|
|
169
|
+
}
|
|
170
|
+
inputCredentials = credentials;
|
|
171
|
+
const memoizedProvider = normalizeCredentialProvider(config, {
|
|
172
|
+
credentials: inputCredentials,
|
|
173
|
+
credentialDefaultProvider: config.credentialDefaultProvider,
|
|
174
|
+
});
|
|
175
|
+
const boundProvider = bindCallerConfig(config, memoizedProvider);
|
|
176
|
+
if (isUserSupplied && !boundProvider.attributed) {
|
|
177
|
+
resolvedCredentials = async (options) => boundProvider(options).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_CODE", "e"));
|
|
178
|
+
resolvedCredentials.memoized = boundProvider.memoized;
|
|
179
|
+
resolvedCredentials.configBound = boundProvider.configBound;
|
|
180
|
+
resolvedCredentials.attributed = true;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
resolvedCredentials = boundProvider;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
get() {
|
|
187
|
+
return resolvedCredentials;
|
|
310
188
|
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
credentialsProvider = (0, import_core2.memoizeIdentityProvider)(credentials, import_core2.isIdentityExpired, import_core2.doesIdentityRequireRefresh);
|
|
345
|
-
} else {
|
|
346
|
-
credentialsProvider = credentials;
|
|
189
|
+
enumerable: true,
|
|
190
|
+
configurable: true,
|
|
191
|
+
});
|
|
192
|
+
config.credentials = inputCredentials;
|
|
193
|
+
const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256, } = config;
|
|
194
|
+
let signer;
|
|
195
|
+
if (config.signer) {
|
|
196
|
+
signer = core.normalizeProvider(config.signer);
|
|
197
|
+
}
|
|
198
|
+
else if (config.regionInfoProvider) {
|
|
199
|
+
signer = () => core.normalizeProvider(config.region)()
|
|
200
|
+
.then(async (region) => [
|
|
201
|
+
(await config.regionInfoProvider(region, {
|
|
202
|
+
useFipsEndpoint: await config.useFipsEndpoint(),
|
|
203
|
+
useDualstackEndpoint: await config.useDualstackEndpoint(),
|
|
204
|
+
})) || {},
|
|
205
|
+
region,
|
|
206
|
+
])
|
|
207
|
+
.then(([regionInfo, region]) => {
|
|
208
|
+
const { signingRegion, signingService } = regionInfo;
|
|
209
|
+
config.signingRegion = config.signingRegion || signingRegion || region;
|
|
210
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
211
|
+
const params = {
|
|
212
|
+
...config,
|
|
213
|
+
credentials: config.credentials,
|
|
214
|
+
region: config.signingRegion,
|
|
215
|
+
service: config.signingName,
|
|
216
|
+
sha256,
|
|
217
|
+
uriEscapePath: signingEscapePath,
|
|
218
|
+
};
|
|
219
|
+
const SignerCtor = config.signerConstructor || signatureV4.SignatureV4;
|
|
220
|
+
return new SignerCtor(params);
|
|
221
|
+
});
|
|
347
222
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
223
|
+
else {
|
|
224
|
+
signer = async (authScheme) => {
|
|
225
|
+
authScheme = Object.assign({}, {
|
|
226
|
+
name: "sigv4",
|
|
227
|
+
signingName: config.signingName || config.defaultSigningName,
|
|
228
|
+
signingRegion: await core.normalizeProvider(config.region)(),
|
|
229
|
+
properties: {},
|
|
230
|
+
}, authScheme);
|
|
231
|
+
const signingRegion = authScheme.signingRegion;
|
|
232
|
+
const signingService = authScheme.signingName;
|
|
233
|
+
config.signingRegion = config.signingRegion || signingRegion;
|
|
234
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
235
|
+
const params = {
|
|
236
|
+
...config,
|
|
237
|
+
credentials: config.credentials,
|
|
238
|
+
region: config.signingRegion,
|
|
239
|
+
service: config.signingName,
|
|
240
|
+
sha256,
|
|
241
|
+
uriEscapePath: signingEscapePath,
|
|
242
|
+
};
|
|
243
|
+
const SignerCtor = config.signerConstructor || signatureV4.SignatureV4;
|
|
244
|
+
return new SignerCtor(params);
|
|
245
|
+
};
|
|
363
246
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
247
|
+
const resolvedConfig = Object.assign(config, {
|
|
248
|
+
systemClockOffset,
|
|
249
|
+
signingEscapePath,
|
|
250
|
+
signer,
|
|
251
|
+
});
|
|
252
|
+
return resolvedConfig;
|
|
253
|
+
};
|
|
254
|
+
const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config;
|
|
255
|
+
function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider, }) {
|
|
256
|
+
let credentialsProvider;
|
|
257
|
+
if (credentials) {
|
|
258
|
+
if (!credentials?.memoized) {
|
|
259
|
+
credentialsProvider = core.memoizeIdentityProvider(credentials, core.isIdentityExpired, core.doesIdentityRequireRefresh);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
credentialsProvider = credentials;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
if (credentialDefaultProvider) {
|
|
267
|
+
credentialsProvider = core.normalizeProvider(credentialDefaultProvider(Object.assign({}, config, {
|
|
268
|
+
parentClientConfig: config,
|
|
269
|
+
})));
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
credentialsProvider = async () => {
|
|
273
|
+
throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.");
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
credentialsProvider.memoized = true;
|
|
278
|
+
return credentialsProvider;
|
|
367
279
|
}
|
|
368
|
-
__name(normalizeCredentialProvider, "normalizeCredentialProvider");
|
|
369
280
|
function bindCallerConfig(config, credentialsProvider) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
281
|
+
if (credentialsProvider.configBound) {
|
|
282
|
+
return credentialsProvider;
|
|
283
|
+
}
|
|
284
|
+
const fn = async (options) => credentialsProvider({ ...options, callerClientConfig: config });
|
|
285
|
+
fn.memoized = credentialsProvider.memoized;
|
|
286
|
+
fn.configBound = true;
|
|
287
|
+
return fn;
|
|
377
288
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
resolveAwsSdkSigV4Config,
|
|
390
|
-
validateSigningProperties
|
|
391
|
-
});
|
|
289
|
+
|
|
290
|
+
exports.AWSSDKSigV4Signer = AWSSDKSigV4Signer;
|
|
291
|
+
exports.AwsSdkSigV4ASigner = AwsSdkSigV4ASigner;
|
|
292
|
+
exports.AwsSdkSigV4Signer = AwsSdkSigV4Signer;
|
|
293
|
+
exports.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = NODE_AUTH_SCHEME_PREFERENCE_OPTIONS;
|
|
294
|
+
exports.NODE_SIGV4A_CONFIG_OPTIONS = NODE_SIGV4A_CONFIG_OPTIONS;
|
|
295
|
+
exports.getBearerTokenEnvKey = getBearerTokenEnvKey;
|
|
296
|
+
exports.resolveAWSSDKSigV4Config = resolveAWSSDKSigV4Config;
|
|
297
|
+
exports.resolveAwsSdkSigV4AConfig = resolveAwsSdkSigV4AConfig;
|
|
298
|
+
exports.resolveAwsSdkSigV4Config = resolveAwsSdkSigV4Config;
|
|
299
|
+
exports.validateSigningProperties = validateSigningProperties;
|