cdk-cost-analyzer 0.1.47 → 0.1.49
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/.cdk-cost-analyzer-cache/metadata.json +8 -8
- package/dist/action/136.index.js +1027 -160
- package/dist/action/443.index.js +89 -115
- package/dist/action/579.index.js +16 -8
- package/dist/action/762.index.js +100 -143
- package/dist/action/998.index.js +90 -116
- package/dist/action/index.js +3 -3
- package/dist/releasetag.txt +1 -1
- package/package.json +2 -2
package/dist/action/136.index.js
CHANGED
|
@@ -3,6 +3,610 @@ exports.id = 136;
|
|
|
3
3
|
exports.ids = [136];
|
|
4
4
|
exports.modules = {
|
|
5
5
|
|
|
6
|
+
/***/ 7445:
|
|
7
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var protocolHttp = __webpack_require__(2356);
|
|
12
|
+
var smithyClient = __webpack_require__(1411);
|
|
13
|
+
var utilStream = __webpack_require__(4252);
|
|
14
|
+
var utilArnParser = __webpack_require__(6369);
|
|
15
|
+
var protocols = __webpack_require__(7288);
|
|
16
|
+
var schema = __webpack_require__(6890);
|
|
17
|
+
var signatureV4 = __webpack_require__(5118);
|
|
18
|
+
var utilConfigProvider = __webpack_require__(6716);
|
|
19
|
+
var client = __webpack_require__(5152);
|
|
20
|
+
var core = __webpack_require__(402);
|
|
21
|
+
var utilMiddleware = __webpack_require__(6324);
|
|
22
|
+
|
|
23
|
+
const CONTENT_LENGTH_HEADER = "content-length";
|
|
24
|
+
const DECODED_CONTENT_LENGTH_HEADER = "x-amz-decoded-content-length";
|
|
25
|
+
function checkContentLengthHeader() {
|
|
26
|
+
return (next, context) => async (args) => {
|
|
27
|
+
const { request } = args;
|
|
28
|
+
if (protocolHttp.HttpRequest.isInstance(request)) {
|
|
29
|
+
if (!(CONTENT_LENGTH_HEADER in request.headers) && !(DECODED_CONTENT_LENGTH_HEADER in request.headers)) {
|
|
30
|
+
const message = `Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.`;
|
|
31
|
+
if (typeof context?.logger?.warn === "function" && !(context.logger instanceof smithyClient.NoOpLogger)) {
|
|
32
|
+
context.logger.warn(message);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.warn(message);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return next({ ...args });
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const checkContentLengthHeaderMiddlewareOptions = {
|
|
43
|
+
step: "finalizeRequest",
|
|
44
|
+
tags: ["CHECK_CONTENT_LENGTH_HEADER"],
|
|
45
|
+
name: "getCheckContentLengthHeaderPlugin",
|
|
46
|
+
override: true,
|
|
47
|
+
};
|
|
48
|
+
const getCheckContentLengthHeaderPlugin = (unused) => ({
|
|
49
|
+
applyToStack: (clientStack) => {
|
|
50
|
+
clientStack.add(checkContentLengthHeader(), checkContentLengthHeaderMiddlewareOptions);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const regionRedirectEndpointMiddleware = (config) => {
|
|
55
|
+
return (next, context) => async (args) => {
|
|
56
|
+
const originalRegion = await config.region();
|
|
57
|
+
const regionProviderRef = config.region;
|
|
58
|
+
let unlock = () => { };
|
|
59
|
+
if (context.__s3RegionRedirect) {
|
|
60
|
+
Object.defineProperty(config, "region", {
|
|
61
|
+
writable: false,
|
|
62
|
+
value: async () => {
|
|
63
|
+
return context.__s3RegionRedirect;
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
unlock = () => Object.defineProperty(config, "region", {
|
|
67
|
+
writable: true,
|
|
68
|
+
value: regionProviderRef,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
const result = await next(args);
|
|
73
|
+
if (context.__s3RegionRedirect) {
|
|
74
|
+
unlock();
|
|
75
|
+
const region = await config.region();
|
|
76
|
+
if (originalRegion !== region) {
|
|
77
|
+
throw new Error("Region was not restored following S3 region redirect.");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
unlock();
|
|
84
|
+
throw e;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
const regionRedirectEndpointMiddlewareOptions = {
|
|
89
|
+
tags: ["REGION_REDIRECT", "S3"],
|
|
90
|
+
name: "regionRedirectEndpointMiddleware",
|
|
91
|
+
override: true,
|
|
92
|
+
relation: "before",
|
|
93
|
+
toMiddleware: "endpointV2Middleware",
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
function regionRedirectMiddleware(clientConfig) {
|
|
97
|
+
return (next, context) => async (args) => {
|
|
98
|
+
try {
|
|
99
|
+
return await next(args);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
if (clientConfig.followRegionRedirects) {
|
|
103
|
+
const statusCode = err?.$metadata?.httpStatusCode;
|
|
104
|
+
const isHeadBucket = context.commandName === "HeadBucketCommand";
|
|
105
|
+
const bucketRegionHeader = err?.$response?.headers?.["x-amz-bucket-region"];
|
|
106
|
+
if (bucketRegionHeader) {
|
|
107
|
+
if (statusCode === 301 ||
|
|
108
|
+
(statusCode === 400 && (err?.name === "IllegalLocationConstraintException" || isHeadBucket))) {
|
|
109
|
+
try {
|
|
110
|
+
const actualRegion = bucketRegionHeader;
|
|
111
|
+
context.logger?.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`);
|
|
112
|
+
context.__s3RegionRedirect = actualRegion;
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
throw new Error("Region redirect failed: " + e);
|
|
116
|
+
}
|
|
117
|
+
return next(args);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const regionRedirectMiddlewareOptions = {
|
|
126
|
+
step: "initialize",
|
|
127
|
+
tags: ["REGION_REDIRECT", "S3"],
|
|
128
|
+
name: "regionRedirectMiddleware",
|
|
129
|
+
override: true,
|
|
130
|
+
};
|
|
131
|
+
const getRegionRedirectMiddlewarePlugin = (clientConfig) => ({
|
|
132
|
+
applyToStack: (clientStack) => {
|
|
133
|
+
clientStack.add(regionRedirectMiddleware(clientConfig), regionRedirectMiddlewareOptions);
|
|
134
|
+
clientStack.addRelativeTo(regionRedirectEndpointMiddleware(clientConfig), regionRedirectEndpointMiddlewareOptions);
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const s3ExpiresMiddleware = (config) => {
|
|
139
|
+
return (next, context) => async (args) => {
|
|
140
|
+
const result = await next(args);
|
|
141
|
+
const { response } = result;
|
|
142
|
+
if (protocolHttp.HttpResponse.isInstance(response)) {
|
|
143
|
+
if (response.headers.expires) {
|
|
144
|
+
response.headers.expiresstring = response.headers.expires;
|
|
145
|
+
try {
|
|
146
|
+
smithyClient.parseRfc7231DateTime(response.headers.expires);
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
context.logger?.warn(`AWS SDK Warning for ${context.clientName}::${context.commandName} response parsing (${response.headers.expires}): ${e}`);
|
|
150
|
+
delete response.headers.expires;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
const s3ExpiresMiddlewareOptions = {
|
|
158
|
+
tags: ["S3"],
|
|
159
|
+
name: "s3ExpiresMiddleware",
|
|
160
|
+
override: true,
|
|
161
|
+
relation: "after",
|
|
162
|
+
toMiddleware: "deserializerMiddleware",
|
|
163
|
+
};
|
|
164
|
+
const getS3ExpiresMiddlewarePlugin = (clientConfig) => ({
|
|
165
|
+
applyToStack: (clientStack) => {
|
|
166
|
+
clientStack.addRelativeTo(s3ExpiresMiddleware(), s3ExpiresMiddlewareOptions);
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
class S3ExpressIdentityCache {
|
|
171
|
+
data;
|
|
172
|
+
lastPurgeTime = Date.now();
|
|
173
|
+
static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 30_000;
|
|
174
|
+
constructor(data = {}) {
|
|
175
|
+
this.data = data;
|
|
176
|
+
}
|
|
177
|
+
get(key) {
|
|
178
|
+
const entry = this.data[key];
|
|
179
|
+
if (!entry) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
return entry;
|
|
183
|
+
}
|
|
184
|
+
set(key, entry) {
|
|
185
|
+
this.data[key] = entry;
|
|
186
|
+
return entry;
|
|
187
|
+
}
|
|
188
|
+
delete(key) {
|
|
189
|
+
delete this.data[key];
|
|
190
|
+
}
|
|
191
|
+
async purgeExpired() {
|
|
192
|
+
const now = Date.now();
|
|
193
|
+
if (this.lastPurgeTime + S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS > now) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
for (const key in this.data) {
|
|
197
|
+
const entry = this.data[key];
|
|
198
|
+
if (!entry.isRefreshing) {
|
|
199
|
+
const credential = await entry.identity;
|
|
200
|
+
if (credential.expiration) {
|
|
201
|
+
if (credential.expiration.getTime() < now) {
|
|
202
|
+
delete this.data[key];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
class S3ExpressIdentityCacheEntry {
|
|
211
|
+
_identity;
|
|
212
|
+
isRefreshing;
|
|
213
|
+
accessed;
|
|
214
|
+
constructor(_identity, isRefreshing = false, accessed = Date.now()) {
|
|
215
|
+
this._identity = _identity;
|
|
216
|
+
this.isRefreshing = isRefreshing;
|
|
217
|
+
this.accessed = accessed;
|
|
218
|
+
}
|
|
219
|
+
get identity() {
|
|
220
|
+
this.accessed = Date.now();
|
|
221
|
+
return this._identity;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
class S3ExpressIdentityProviderImpl {
|
|
226
|
+
createSessionFn;
|
|
227
|
+
cache;
|
|
228
|
+
static REFRESH_WINDOW_MS = 60_000;
|
|
229
|
+
constructor(createSessionFn, cache = new S3ExpressIdentityCache()) {
|
|
230
|
+
this.createSessionFn = createSessionFn;
|
|
231
|
+
this.cache = cache;
|
|
232
|
+
}
|
|
233
|
+
async getS3ExpressIdentity(awsIdentity, identityProperties) {
|
|
234
|
+
const key = identityProperties.Bucket;
|
|
235
|
+
const { cache } = this;
|
|
236
|
+
const entry = cache.get(key);
|
|
237
|
+
if (entry) {
|
|
238
|
+
return entry.identity.then((identity) => {
|
|
239
|
+
const isExpired = (identity.expiration?.getTime() ?? 0) < Date.now();
|
|
240
|
+
if (isExpired) {
|
|
241
|
+
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
|
242
|
+
}
|
|
243
|
+
const isExpiringSoon = (identity.expiration?.getTime() ?? 0) < Date.now() + S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS;
|
|
244
|
+
if (isExpiringSoon && !entry.isRefreshing) {
|
|
245
|
+
entry.isRefreshing = true;
|
|
246
|
+
this.getIdentity(key).then((id) => {
|
|
247
|
+
cache.set(key, new S3ExpressIdentityCacheEntry(Promise.resolve(id)));
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return identity;
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
|
254
|
+
}
|
|
255
|
+
async getIdentity(key) {
|
|
256
|
+
await this.cache.purgeExpired().catch((error) => {
|
|
257
|
+
console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n" + error);
|
|
258
|
+
});
|
|
259
|
+
const session = await this.createSessionFn(key);
|
|
260
|
+
if (!session.Credentials?.AccessKeyId || !session.Credentials?.SecretAccessKey) {
|
|
261
|
+
throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");
|
|
262
|
+
}
|
|
263
|
+
const identity = {
|
|
264
|
+
accessKeyId: session.Credentials.AccessKeyId,
|
|
265
|
+
secretAccessKey: session.Credentials.SecretAccessKey,
|
|
266
|
+
sessionToken: session.Credentials.SessionToken,
|
|
267
|
+
expiration: session.Credentials.Expiration ? new Date(session.Credentials.Expiration) : undefined,
|
|
268
|
+
};
|
|
269
|
+
return identity;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const S3_EXPRESS_BUCKET_TYPE = "Directory";
|
|
274
|
+
const S3_EXPRESS_BACKEND = "S3Express";
|
|
275
|
+
const S3_EXPRESS_AUTH_SCHEME = "sigv4-s3express";
|
|
276
|
+
const SESSION_TOKEN_QUERY_PARAM = "X-Amz-S3session-Token";
|
|
277
|
+
const SESSION_TOKEN_HEADER = SESSION_TOKEN_QUERY_PARAM.toLowerCase();
|
|
278
|
+
const NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME = "AWS_S3_DISABLE_EXPRESS_SESSION_AUTH";
|
|
279
|
+
const NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME = "s3_disable_express_session_auth";
|
|
280
|
+
const NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS = {
|
|
281
|
+
environmentVariableSelector: (env) => utilConfigProvider.booleanSelector(env, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME, utilConfigProvider.SelectorType.ENV),
|
|
282
|
+
configFileSelector: (profile) => utilConfigProvider.booleanSelector(profile, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME, utilConfigProvider.SelectorType.CONFIG),
|
|
283
|
+
default: false,
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
class SignatureV4S3Express extends signatureV4.SignatureV4 {
|
|
287
|
+
async signWithCredentials(requestToSign, credentials, options) {
|
|
288
|
+
const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
|
|
289
|
+
requestToSign.headers[SESSION_TOKEN_HEADER] = credentials.sessionToken;
|
|
290
|
+
const privateAccess = this;
|
|
291
|
+
setSingleOverride(privateAccess, credentialsWithoutSessionToken);
|
|
292
|
+
return privateAccess.signRequest(requestToSign, options ?? {});
|
|
293
|
+
}
|
|
294
|
+
async presignWithCredentials(requestToSign, credentials, options) {
|
|
295
|
+
const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
|
|
296
|
+
delete requestToSign.headers[SESSION_TOKEN_HEADER];
|
|
297
|
+
requestToSign.headers[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
|
298
|
+
requestToSign.query = requestToSign.query ?? {};
|
|
299
|
+
requestToSign.query[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
|
300
|
+
const privateAccess = this;
|
|
301
|
+
setSingleOverride(privateAccess, credentialsWithoutSessionToken);
|
|
302
|
+
return this.presign(requestToSign, options);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
function getCredentialsWithoutSessionToken(credentials) {
|
|
306
|
+
const credentialsWithoutSessionToken = {
|
|
307
|
+
accessKeyId: credentials.accessKeyId,
|
|
308
|
+
secretAccessKey: credentials.secretAccessKey,
|
|
309
|
+
expiration: credentials.expiration,
|
|
310
|
+
};
|
|
311
|
+
return credentialsWithoutSessionToken;
|
|
312
|
+
}
|
|
313
|
+
function setSingleOverride(privateAccess, credentialsWithoutSessionToken) {
|
|
314
|
+
const id = setTimeout(() => {
|
|
315
|
+
throw new Error("SignatureV4S3Express credential override was created but not called.");
|
|
316
|
+
}, 10);
|
|
317
|
+
const currentCredentialProvider = privateAccess.credentialProvider;
|
|
318
|
+
const overrideCredentialsProviderOnce = () => {
|
|
319
|
+
clearTimeout(id);
|
|
320
|
+
privateAccess.credentialProvider = currentCredentialProvider;
|
|
321
|
+
return Promise.resolve(credentialsWithoutSessionToken);
|
|
322
|
+
};
|
|
323
|
+
privateAccess.credentialProvider = overrideCredentialsProviderOnce;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const s3ExpressMiddleware = (options) => {
|
|
327
|
+
return (next, context) => async (args) => {
|
|
328
|
+
if (context.endpointV2) {
|
|
329
|
+
const endpoint = context.endpointV2;
|
|
330
|
+
const isS3ExpressAuth = endpoint.properties?.authSchemes?.[0]?.name === S3_EXPRESS_AUTH_SCHEME;
|
|
331
|
+
const isS3ExpressBucket = endpoint.properties?.backend === S3_EXPRESS_BACKEND ||
|
|
332
|
+
endpoint.properties?.bucketType === S3_EXPRESS_BUCKET_TYPE;
|
|
333
|
+
if (isS3ExpressBucket) {
|
|
334
|
+
client.setFeature(context, "S3_EXPRESS_BUCKET", "J");
|
|
335
|
+
context.isS3ExpressBucket = true;
|
|
336
|
+
}
|
|
337
|
+
if (isS3ExpressAuth) {
|
|
338
|
+
const requestBucket = args.input.Bucket;
|
|
339
|
+
if (requestBucket) {
|
|
340
|
+
const s3ExpressIdentity = await options.s3ExpressIdentityProvider.getS3ExpressIdentity(await options.credentials(), {
|
|
341
|
+
Bucket: requestBucket,
|
|
342
|
+
});
|
|
343
|
+
context.s3ExpressIdentity = s3ExpressIdentity;
|
|
344
|
+
if (protocolHttp.HttpRequest.isInstance(args.request) && s3ExpressIdentity.sessionToken) {
|
|
345
|
+
args.request.headers[SESSION_TOKEN_HEADER] = s3ExpressIdentity.sessionToken;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return next(args);
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
const s3ExpressMiddlewareOptions = {
|
|
354
|
+
name: "s3ExpressMiddleware",
|
|
355
|
+
step: "build",
|
|
356
|
+
tags: ["S3", "S3_EXPRESS"],
|
|
357
|
+
override: true,
|
|
358
|
+
};
|
|
359
|
+
const getS3ExpressPlugin = (options) => ({
|
|
360
|
+
applyToStack: (clientStack) => {
|
|
361
|
+
clientStack.add(s3ExpressMiddleware(options), s3ExpressMiddlewareOptions);
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
const signS3Express = async (s3ExpressIdentity, signingOptions, request, sigV4MultiRegionSigner) => {
|
|
366
|
+
const signedRequest = await sigV4MultiRegionSigner.signWithCredentials(request, s3ExpressIdentity, {});
|
|
367
|
+
if (signedRequest.headers["X-Amz-Security-Token"] || signedRequest.headers["x-amz-security-token"]) {
|
|
368
|
+
throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");
|
|
369
|
+
}
|
|
370
|
+
return signedRequest;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const defaultErrorHandler = (signingProperties) => (error) => {
|
|
374
|
+
throw error;
|
|
375
|
+
};
|
|
376
|
+
const defaultSuccessHandler = (httpResponse, signingProperties) => { };
|
|
377
|
+
const s3ExpressHttpSigningMiddlewareOptions = core.httpSigningMiddlewareOptions;
|
|
378
|
+
const s3ExpressHttpSigningMiddleware = (config) => (next, context) => async (args) => {
|
|
379
|
+
if (!protocolHttp.HttpRequest.isInstance(args.request)) {
|
|
380
|
+
return next(args);
|
|
381
|
+
}
|
|
382
|
+
const smithyContext = utilMiddleware.getSmithyContext(context);
|
|
383
|
+
const scheme = smithyContext.selectedHttpAuthScheme;
|
|
384
|
+
if (!scheme) {
|
|
385
|
+
throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
|
|
386
|
+
}
|
|
387
|
+
const { httpAuthOption: { signingProperties = {} }, identity, signer, } = scheme;
|
|
388
|
+
let request;
|
|
389
|
+
if (context.s3ExpressIdentity) {
|
|
390
|
+
request = await signS3Express(context.s3ExpressIdentity, signingProperties, args.request, await config.signer());
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
request = await signer.sign(args.request, identity, signingProperties);
|
|
394
|
+
}
|
|
395
|
+
const output = await next({
|
|
396
|
+
...args,
|
|
397
|
+
request,
|
|
398
|
+
}).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
|
|
399
|
+
(signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
|
|
400
|
+
return output;
|
|
401
|
+
};
|
|
402
|
+
const getS3ExpressHttpSigningPlugin = (config) => ({
|
|
403
|
+
applyToStack: (clientStack) => {
|
|
404
|
+
clientStack.addRelativeTo(s3ExpressHttpSigningMiddleware(config), core.httpSigningMiddlewareOptions);
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
const resolveS3Config = (input, { session, }) => {
|
|
409
|
+
const [s3ClientProvider, CreateSessionCommandCtor] = session;
|
|
410
|
+
const { forcePathStyle, useAccelerateEndpoint, disableMultiregionAccessPoints, followRegionRedirects, s3ExpressIdentityProvider, bucketEndpoint, expectContinueHeader, } = input;
|
|
411
|
+
return Object.assign(input, {
|
|
412
|
+
forcePathStyle: forcePathStyle ?? false,
|
|
413
|
+
useAccelerateEndpoint: useAccelerateEndpoint ?? false,
|
|
414
|
+
disableMultiregionAccessPoints: disableMultiregionAccessPoints ?? false,
|
|
415
|
+
followRegionRedirects: followRegionRedirects ?? false,
|
|
416
|
+
s3ExpressIdentityProvider: s3ExpressIdentityProvider ??
|
|
417
|
+
new S3ExpressIdentityProviderImpl(async (key) => s3ClientProvider().send(new CreateSessionCommandCtor({
|
|
418
|
+
Bucket: key,
|
|
419
|
+
}))),
|
|
420
|
+
bucketEndpoint: bucketEndpoint ?? false,
|
|
421
|
+
expectContinueHeader: expectContinueHeader ?? 2_097_152,
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const THROW_IF_EMPTY_BODY = {
|
|
426
|
+
CopyObjectCommand: true,
|
|
427
|
+
UploadPartCopyCommand: true,
|
|
428
|
+
CompleteMultipartUploadCommand: true,
|
|
429
|
+
};
|
|
430
|
+
const MAX_BYTES_TO_INSPECT = 3000;
|
|
431
|
+
const throw200ExceptionsMiddleware = (config) => (next, context) => async (args) => {
|
|
432
|
+
const result = await next(args);
|
|
433
|
+
const { response } = result;
|
|
434
|
+
if (!protocolHttp.HttpResponse.isInstance(response)) {
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
const { statusCode, body: sourceBody } = response;
|
|
438
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
const isSplittableStream = typeof sourceBody?.stream === "function" ||
|
|
442
|
+
typeof sourceBody?.pipe === "function" ||
|
|
443
|
+
typeof sourceBody?.tee === "function";
|
|
444
|
+
if (!isSplittableStream) {
|
|
445
|
+
return result;
|
|
446
|
+
}
|
|
447
|
+
let bodyCopy = sourceBody;
|
|
448
|
+
let body = sourceBody;
|
|
449
|
+
if (sourceBody && typeof sourceBody === "object" && !(sourceBody instanceof Uint8Array)) {
|
|
450
|
+
[bodyCopy, body] = await utilStream.splitStream(sourceBody);
|
|
451
|
+
}
|
|
452
|
+
response.body = body;
|
|
453
|
+
const bodyBytes = await collectBody(bodyCopy, {
|
|
454
|
+
streamCollector: async (stream) => {
|
|
455
|
+
return utilStream.headStream(stream, MAX_BYTES_TO_INSPECT);
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
if (typeof bodyCopy?.destroy === "function") {
|
|
459
|
+
bodyCopy.destroy();
|
|
460
|
+
}
|
|
461
|
+
const bodyStringTail = config.utf8Encoder(bodyBytes.subarray(bodyBytes.length - 16));
|
|
462
|
+
if (bodyBytes.length === 0 && THROW_IF_EMPTY_BODY[context.commandName]) {
|
|
463
|
+
const err = new Error("S3 aborted request");
|
|
464
|
+
err.name = "InternalError";
|
|
465
|
+
throw err;
|
|
466
|
+
}
|
|
467
|
+
if (bodyStringTail && bodyStringTail.endsWith("</Error>")) {
|
|
468
|
+
response.statusCode = 400;
|
|
469
|
+
}
|
|
470
|
+
return result;
|
|
471
|
+
};
|
|
472
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
473
|
+
if (streamBody instanceof Uint8Array) {
|
|
474
|
+
return Promise.resolve(streamBody);
|
|
475
|
+
}
|
|
476
|
+
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
477
|
+
};
|
|
478
|
+
const throw200ExceptionsMiddlewareOptions = {
|
|
479
|
+
relation: "after",
|
|
480
|
+
toMiddleware: "deserializerMiddleware",
|
|
481
|
+
tags: ["THROW_200_EXCEPTIONS", "S3"],
|
|
482
|
+
name: "throw200ExceptionsMiddleware",
|
|
483
|
+
override: true,
|
|
484
|
+
};
|
|
485
|
+
const getThrow200ExceptionsPlugin = (config) => ({
|
|
486
|
+
applyToStack: (clientStack) => {
|
|
487
|
+
clientStack.addRelativeTo(throw200ExceptionsMiddleware(config), throw200ExceptionsMiddlewareOptions);
|
|
488
|
+
},
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
function bucketEndpointMiddleware(options) {
|
|
492
|
+
return (next, context) => async (args) => {
|
|
493
|
+
if (options.bucketEndpoint) {
|
|
494
|
+
const endpoint = context.endpointV2;
|
|
495
|
+
if (endpoint) {
|
|
496
|
+
const bucket = args.input.Bucket;
|
|
497
|
+
if (typeof bucket === "string") {
|
|
498
|
+
try {
|
|
499
|
+
const bucketEndpointUrl = new URL(bucket);
|
|
500
|
+
context.endpointV2 = {
|
|
501
|
+
...endpoint,
|
|
502
|
+
url: bucketEndpointUrl,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
catch (e) {
|
|
506
|
+
const warning = `@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${bucket} could not be parsed as URL.`;
|
|
507
|
+
if (context.logger?.constructor?.name === "NoOpLogger") {
|
|
508
|
+
console.warn(warning);
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
context.logger?.warn?.(warning);
|
|
512
|
+
}
|
|
513
|
+
throw e;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return next(args);
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
const bucketEndpointMiddlewareOptions = {
|
|
522
|
+
name: "bucketEndpointMiddleware",
|
|
523
|
+
override: true,
|
|
524
|
+
relation: "after",
|
|
525
|
+
toMiddleware: "endpointV2Middleware",
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
function validateBucketNameMiddleware({ bucketEndpoint }) {
|
|
529
|
+
return (next) => async (args) => {
|
|
530
|
+
const { input: { Bucket }, } = args;
|
|
531
|
+
if (!bucketEndpoint && typeof Bucket === "string" && !utilArnParser.validate(Bucket) && Bucket.indexOf("/") >= 0) {
|
|
532
|
+
const err = new Error(`Bucket name shouldn't contain '/', received '${Bucket}'`);
|
|
533
|
+
err.name = "InvalidBucketName";
|
|
534
|
+
throw err;
|
|
535
|
+
}
|
|
536
|
+
return next({ ...args });
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
const validateBucketNameMiddlewareOptions = {
|
|
540
|
+
step: "initialize",
|
|
541
|
+
tags: ["VALIDATE_BUCKET_NAME"],
|
|
542
|
+
name: "validateBucketNameMiddleware",
|
|
543
|
+
override: true,
|
|
544
|
+
};
|
|
545
|
+
const getValidateBucketNamePlugin = (options) => ({
|
|
546
|
+
applyToStack: (clientStack) => {
|
|
547
|
+
clientStack.add(validateBucketNameMiddleware(options), validateBucketNameMiddlewareOptions);
|
|
548
|
+
clientStack.addRelativeTo(bucketEndpointMiddleware(options), bucketEndpointMiddlewareOptions);
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
class S3RestXmlProtocol extends protocols.AwsRestXmlProtocol {
|
|
553
|
+
async serializeRequest(operationSchema, input, context) {
|
|
554
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
555
|
+
const ns = schema.NormalizedSchema.of(operationSchema.input);
|
|
556
|
+
const staticStructureSchema = ns.getSchema();
|
|
557
|
+
let bucketMemberIndex = 0;
|
|
558
|
+
const requiredMemberCount = staticStructureSchema[6] ?? 0;
|
|
559
|
+
if (input && typeof input === "object") {
|
|
560
|
+
for (const [memberName, memberNs] of ns.structIterator()) {
|
|
561
|
+
if (++bucketMemberIndex > requiredMemberCount) {
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
if (memberName === "Bucket") {
|
|
565
|
+
if (!input.Bucket && memberNs.getMergedTraits().httpLabel) {
|
|
566
|
+
throw new Error(`No value provided for input HTTP label: Bucket.`);
|
|
567
|
+
}
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return request;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
exports.NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS = NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS;
|
|
577
|
+
exports.S3ExpressIdentityCache = S3ExpressIdentityCache;
|
|
578
|
+
exports.S3ExpressIdentityCacheEntry = S3ExpressIdentityCacheEntry;
|
|
579
|
+
exports.S3ExpressIdentityProviderImpl = S3ExpressIdentityProviderImpl;
|
|
580
|
+
exports.S3RestXmlProtocol = S3RestXmlProtocol;
|
|
581
|
+
exports.SignatureV4S3Express = SignatureV4S3Express;
|
|
582
|
+
exports.checkContentLengthHeader = checkContentLengthHeader;
|
|
583
|
+
exports.checkContentLengthHeaderMiddlewareOptions = checkContentLengthHeaderMiddlewareOptions;
|
|
584
|
+
exports.getCheckContentLengthHeaderPlugin = getCheckContentLengthHeaderPlugin;
|
|
585
|
+
exports.getRegionRedirectMiddlewarePlugin = getRegionRedirectMiddlewarePlugin;
|
|
586
|
+
exports.getS3ExpiresMiddlewarePlugin = getS3ExpiresMiddlewarePlugin;
|
|
587
|
+
exports.getS3ExpressHttpSigningPlugin = getS3ExpressHttpSigningPlugin;
|
|
588
|
+
exports.getS3ExpressPlugin = getS3ExpressPlugin;
|
|
589
|
+
exports.getThrow200ExceptionsPlugin = getThrow200ExceptionsPlugin;
|
|
590
|
+
exports.getValidateBucketNamePlugin = getValidateBucketNamePlugin;
|
|
591
|
+
exports.regionRedirectEndpointMiddleware = regionRedirectEndpointMiddleware;
|
|
592
|
+
exports.regionRedirectEndpointMiddlewareOptions = regionRedirectEndpointMiddlewareOptions;
|
|
593
|
+
exports.regionRedirectMiddleware = regionRedirectMiddleware;
|
|
594
|
+
exports.regionRedirectMiddlewareOptions = regionRedirectMiddlewareOptions;
|
|
595
|
+
exports.resolveS3Config = resolveS3Config;
|
|
596
|
+
exports.s3ExpiresMiddleware = s3ExpiresMiddleware;
|
|
597
|
+
exports.s3ExpiresMiddlewareOptions = s3ExpiresMiddlewareOptions;
|
|
598
|
+
exports.s3ExpressHttpSigningMiddleware = s3ExpressHttpSigningMiddleware;
|
|
599
|
+
exports.s3ExpressHttpSigningMiddlewareOptions = s3ExpressHttpSigningMiddlewareOptions;
|
|
600
|
+
exports.s3ExpressMiddleware = s3ExpressMiddleware;
|
|
601
|
+
exports.s3ExpressMiddlewareOptions = s3ExpressMiddlewareOptions;
|
|
602
|
+
exports.throw200ExceptionsMiddleware = throw200ExceptionsMiddleware;
|
|
603
|
+
exports.throw200ExceptionsMiddlewareOptions = throw200ExceptionsMiddlewareOptions;
|
|
604
|
+
exports.validateBucketNameMiddleware = validateBucketNameMiddleware;
|
|
605
|
+
exports.validateBucketNameMiddlewareOptions = validateBucketNameMiddlewareOptions;
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
/***/ }),
|
|
609
|
+
|
|
6
610
|
/***/ 3723:
|
|
7
611
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8
612
|
|
|
@@ -51,6 +655,7 @@ class STSClient extends smithy_client_1.Client {
|
|
|
51
655
|
httpAuthSchemeParametersProvider: httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeParametersProvider,
|
|
52
656
|
identityProviderConfigProvider: async (config) => new core_1.DefaultIdentityProviderConfig({
|
|
53
657
|
"aws.auth#sigv4": config.credentials,
|
|
658
|
+
"aws.auth#sigv4a": config.credentials,
|
|
54
659
|
}),
|
|
55
660
|
}));
|
|
56
661
|
this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config));
|
|
@@ -121,9 +726,25 @@ exports.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig;
|
|
|
121
726
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
122
727
|
exports.resolveHttpAuthSchemeConfig = exports.resolveStsAuthConfig = exports.defaultSTSHttpAuthSchemeProvider = exports.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
|
123
728
|
const httpAuthSchemes_1 = __webpack_require__(7523);
|
|
729
|
+
const signature_v4_multi_region_1 = __webpack_require__(5785);
|
|
730
|
+
const middleware_endpoint_1 = __webpack_require__(99);
|
|
124
731
|
const util_middleware_1 = __webpack_require__(6324);
|
|
732
|
+
const endpointResolver_1 = __webpack_require__(9765);
|
|
125
733
|
const STSClient_1 = __webpack_require__(3723);
|
|
126
|
-
const
|
|
734
|
+
const createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
|
|
735
|
+
if (!input) {
|
|
736
|
+
throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
|
|
737
|
+
}
|
|
738
|
+
const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
|
|
739
|
+
const instructionsFn = (0, util_middleware_1.getSmithyContext)(context)?.commandInstance?.constructor
|
|
740
|
+
?.getEndpointParameterInstructions;
|
|
741
|
+
if (!instructionsFn) {
|
|
742
|
+
throw new Error(`getEndpointParameterInstructions() is not defined on '${context.commandName}'`);
|
|
743
|
+
}
|
|
744
|
+
const endpointParameters = await (0, middleware_endpoint_1.resolveParams)(input, { getEndpointParameterInstructions: instructionsFn }, config);
|
|
745
|
+
return Object.assign(defaultParameters, endpointParameters);
|
|
746
|
+
};
|
|
747
|
+
const _defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
127
748
|
return {
|
|
128
749
|
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
|
|
129
750
|
region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
|
|
@@ -132,7 +753,7 @@ const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input
|
|
|
132
753
|
})(),
|
|
133
754
|
};
|
|
134
755
|
};
|
|
135
|
-
exports.defaultSTSHttpAuthSchemeParametersProvider =
|
|
756
|
+
exports.defaultSTSHttpAuthSchemeParametersProvider = createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSTSHttpAuthSchemeParametersProvider);
|
|
136
757
|
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
|
137
758
|
return {
|
|
138
759
|
schemeId: "aws.auth#sigv4",
|
|
@@ -148,25 +769,90 @@ function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
|
|
148
769
|
}),
|
|
149
770
|
};
|
|
150
771
|
}
|
|
772
|
+
function createAwsAuthSigv4aHttpAuthOption(authParameters) {
|
|
773
|
+
return {
|
|
774
|
+
schemeId: "aws.auth#sigv4a",
|
|
775
|
+
signingProperties: {
|
|
776
|
+
name: "sts",
|
|
777
|
+
region: authParameters.region,
|
|
778
|
+
},
|
|
779
|
+
propertiesExtractor: (config, context) => ({
|
|
780
|
+
signingProperties: {
|
|
781
|
+
config,
|
|
782
|
+
context,
|
|
783
|
+
},
|
|
784
|
+
}),
|
|
785
|
+
};
|
|
786
|
+
}
|
|
151
787
|
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
|
152
788
|
return {
|
|
153
789
|
schemeId: "smithy.api#noAuth",
|
|
154
790
|
};
|
|
155
791
|
}
|
|
156
|
-
const
|
|
792
|
+
const createEndpointRuleSetHttpAuthSchemeProvider = (defaultEndpointResolver, defaultHttpAuthSchemeResolver, createHttpAuthOptionFunctions) => {
|
|
793
|
+
const endpointRuleSetHttpAuthSchemeProvider = (authParameters) => {
|
|
794
|
+
const endpoint = defaultEndpointResolver(authParameters);
|
|
795
|
+
const authSchemes = endpoint.properties?.authSchemes;
|
|
796
|
+
if (!authSchemes) {
|
|
797
|
+
return defaultHttpAuthSchemeResolver(authParameters);
|
|
798
|
+
}
|
|
799
|
+
const options = [];
|
|
800
|
+
for (const scheme of authSchemes) {
|
|
801
|
+
const { name: resolvedName, properties = {}, ...rest } = scheme;
|
|
802
|
+
const name = resolvedName.toLowerCase();
|
|
803
|
+
if (resolvedName !== name) {
|
|
804
|
+
console.warn(`HttpAuthScheme has been normalized with lowercasing: '${resolvedName}' to '${name}'`);
|
|
805
|
+
}
|
|
806
|
+
let schemeId;
|
|
807
|
+
if (name === "sigv4a") {
|
|
808
|
+
schemeId = "aws.auth#sigv4a";
|
|
809
|
+
const sigv4Present = authSchemes.find((s) => {
|
|
810
|
+
const name = s.name.toLowerCase();
|
|
811
|
+
return name !== "sigv4a" && name.startsWith("sigv4");
|
|
812
|
+
});
|
|
813
|
+
if (signature_v4_multi_region_1.SignatureV4MultiRegion.sigv4aDependency() === "none" && sigv4Present) {
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
else if (name.startsWith("sigv4")) {
|
|
818
|
+
schemeId = "aws.auth#sigv4";
|
|
819
|
+
}
|
|
820
|
+
else {
|
|
821
|
+
throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${name}'`);
|
|
822
|
+
}
|
|
823
|
+
const createOption = createHttpAuthOptionFunctions[schemeId];
|
|
824
|
+
if (!createOption) {
|
|
825
|
+
throw new Error(`Could not find HttpAuthOption create function for '${schemeId}'`);
|
|
826
|
+
}
|
|
827
|
+
const option = createOption(authParameters);
|
|
828
|
+
option.schemeId = schemeId;
|
|
829
|
+
option.signingProperties = { ...(option.signingProperties || {}), ...rest, ...properties };
|
|
830
|
+
options.push(option);
|
|
831
|
+
}
|
|
832
|
+
return options;
|
|
833
|
+
};
|
|
834
|
+
return endpointRuleSetHttpAuthSchemeProvider;
|
|
835
|
+
};
|
|
836
|
+
const _defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
|
157
837
|
const options = [];
|
|
158
838
|
switch (authParameters.operation) {
|
|
159
839
|
case "AssumeRoleWithWebIdentity": {
|
|
160
840
|
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
|
841
|
+
options.push(createAwsAuthSigv4aHttpAuthOption(authParameters));
|
|
161
842
|
break;
|
|
162
843
|
}
|
|
163
844
|
default: {
|
|
164
845
|
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
|
846
|
+
options.push(createAwsAuthSigv4aHttpAuthOption(authParameters));
|
|
165
847
|
}
|
|
166
848
|
}
|
|
167
849
|
return options;
|
|
168
850
|
};
|
|
169
|
-
exports.defaultSTSHttpAuthSchemeProvider =
|
|
851
|
+
exports.defaultSTSHttpAuthSchemeProvider = createEndpointRuleSetHttpAuthSchemeProvider(endpointResolver_1.defaultEndpointResolver, _defaultSTSHttpAuthSchemeProvider, {
|
|
852
|
+
"aws.auth#sigv4": createAwsAuthSigv4HttpAuthOption,
|
|
853
|
+
"aws.auth#sigv4a": createAwsAuthSigv4aHttpAuthOption,
|
|
854
|
+
"smithy.api#noAuth": createSmithyApiNoAuthHttpAuthOption,
|
|
855
|
+
});
|
|
170
856
|
const resolveStsAuthConfig = (input) => Object.assign(input, {
|
|
171
857
|
stsClientCtor: STSClient_1.STSClient,
|
|
172
858
|
});
|
|
@@ -174,7 +860,8 @@ exports.resolveStsAuthConfig = resolveStsAuthConfig;
|
|
|
174
860
|
const resolveHttpAuthSchemeConfig = (config) => {
|
|
175
861
|
const config_0 = (0, exports.resolveStsAuthConfig)(config);
|
|
176
862
|
const config_1 = (0, httpAuthSchemes_1.resolveAwsSdkSigV4Config)(config_0);
|
|
177
|
-
|
|
863
|
+
const config_2 = (0, httpAuthSchemes_1.resolveAwsSdkSigV4AConfig)(config_1);
|
|
864
|
+
return Object.assign(config_2, {
|
|
178
865
|
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
|
|
179
866
|
});
|
|
180
867
|
};
|
|
@@ -207,6 +894,163 @@ exports.commonParams = {
|
|
|
207
894
|
};
|
|
208
895
|
|
|
209
896
|
|
|
897
|
+
/***/ }),
|
|
898
|
+
|
|
899
|
+
/***/ 2050:
|
|
900
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
904
|
+
exports.bdd = void 0;
|
|
905
|
+
const util_endpoints_1 = __webpack_require__(9674);
|
|
906
|
+
const q = "ref";
|
|
907
|
+
const a = -1, b = true, c = "isSet", d = "PartitionResult", e = "booleanEquals", f = "stringEquals", g = "getAttr", h = "us-east-1", i = "sigv4", j = "sts", k = "https://sts.{Region}.{PartitionResult#dnsSuffix}", l = { [q]: "Endpoint" }, m = { [q]: "Region" }, n = { [q]: d }, o = {}, p = [m];
|
|
908
|
+
const _data = {
|
|
909
|
+
conditions: [
|
|
910
|
+
[c, [l]],
|
|
911
|
+
[c, p],
|
|
912
|
+
["aws.partition", p, d],
|
|
913
|
+
[e, [{ [q]: "UseFIPS" }, b]],
|
|
914
|
+
[e, [{ [q]: "UseDualStack" }, b]],
|
|
915
|
+
[f, [m, "aws-global"]],
|
|
916
|
+
[e, [{ [q]: "UseGlobalEndpoint" }, b]],
|
|
917
|
+
[f, [m, "eu-central-1"]],
|
|
918
|
+
[e, [{ fn: g, argv: [n, "supportsDualStack"] }, b]],
|
|
919
|
+
[e, [{ fn: g, argv: [n, "supportsFIPS"] }, b]],
|
|
920
|
+
[f, [m, "ap-south-1"]],
|
|
921
|
+
[f, [m, "eu-north-1"]],
|
|
922
|
+
[f, [m, "eu-west-1"]],
|
|
923
|
+
[f, [m, "eu-west-2"]],
|
|
924
|
+
[f, [m, "eu-west-3"]],
|
|
925
|
+
[f, [m, "sa-east-1"]],
|
|
926
|
+
[f, [m, h]],
|
|
927
|
+
[f, [m, "us-east-2"]],
|
|
928
|
+
[f, [m, "us-west-2"]],
|
|
929
|
+
[f, [m, "us-west-1"]],
|
|
930
|
+
[f, [m, "ca-central-1"]],
|
|
931
|
+
[f, [m, "ap-southeast-1"]],
|
|
932
|
+
[f, [m, "ap-northeast-1"]],
|
|
933
|
+
[f, [m, "ap-southeast-2"]],
|
|
934
|
+
[f, [{ fn: g, argv: [n, "name"] }, "aws-us-gov"]],
|
|
935
|
+
],
|
|
936
|
+
results: [
|
|
937
|
+
[a],
|
|
938
|
+
["https://sts.amazonaws.com", { authSchemes: [{ name: i, signingName: j, signingRegion: h }] }],
|
|
939
|
+
[k, { authSchemes: [{ name: i, signingName: j, signingRegion: "{Region}" }] }],
|
|
940
|
+
[a, "Invalid Configuration: FIPS and custom endpoint are not supported"],
|
|
941
|
+
[a, "Invalid Configuration: Dualstack and custom endpoint are not supported"],
|
|
942
|
+
[l, o],
|
|
943
|
+
["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", o],
|
|
944
|
+
[a, "FIPS and DualStack are enabled, but this partition does not support one or both"],
|
|
945
|
+
["https://sts.{Region}.amazonaws.com", o],
|
|
946
|
+
["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", o],
|
|
947
|
+
[a, "FIPS is enabled but this partition does not support FIPS"],
|
|
948
|
+
["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", o],
|
|
949
|
+
[a, "DualStack is enabled but this partition does not support DualStack"],
|
|
950
|
+
[k, o],
|
|
951
|
+
[a, "Invalid Configuration: Missing Region"],
|
|
952
|
+
],
|
|
953
|
+
};
|
|
954
|
+
const root = 2;
|
|
955
|
+
const r = 100_000_000;
|
|
956
|
+
const nodes = new Int32Array([
|
|
957
|
+
-1,
|
|
958
|
+
1,
|
|
959
|
+
-1,
|
|
960
|
+
0,
|
|
961
|
+
30,
|
|
962
|
+
3,
|
|
963
|
+
1,
|
|
964
|
+
4,
|
|
965
|
+
r + 14,
|
|
966
|
+
2,
|
|
967
|
+
5,
|
|
968
|
+
r + 14,
|
|
969
|
+
3,
|
|
970
|
+
25,
|
|
971
|
+
6,
|
|
972
|
+
4,
|
|
973
|
+
24,
|
|
974
|
+
7,
|
|
975
|
+
5,
|
|
976
|
+
r + 1,
|
|
977
|
+
8,
|
|
978
|
+
6,
|
|
979
|
+
9,
|
|
980
|
+
r + 13,
|
|
981
|
+
7,
|
|
982
|
+
r + 1,
|
|
983
|
+
10,
|
|
984
|
+
10,
|
|
985
|
+
r + 1,
|
|
986
|
+
11,
|
|
987
|
+
11,
|
|
988
|
+
r + 1,
|
|
989
|
+
12,
|
|
990
|
+
12,
|
|
991
|
+
r + 1,
|
|
992
|
+
13,
|
|
993
|
+
13,
|
|
994
|
+
r + 1,
|
|
995
|
+
14,
|
|
996
|
+
14,
|
|
997
|
+
r + 1,
|
|
998
|
+
15,
|
|
999
|
+
15,
|
|
1000
|
+
r + 1,
|
|
1001
|
+
16,
|
|
1002
|
+
16,
|
|
1003
|
+
r + 1,
|
|
1004
|
+
17,
|
|
1005
|
+
17,
|
|
1006
|
+
r + 1,
|
|
1007
|
+
18,
|
|
1008
|
+
18,
|
|
1009
|
+
r + 1,
|
|
1010
|
+
19,
|
|
1011
|
+
19,
|
|
1012
|
+
r + 1,
|
|
1013
|
+
20,
|
|
1014
|
+
20,
|
|
1015
|
+
r + 1,
|
|
1016
|
+
21,
|
|
1017
|
+
21,
|
|
1018
|
+
r + 1,
|
|
1019
|
+
22,
|
|
1020
|
+
22,
|
|
1021
|
+
r + 1,
|
|
1022
|
+
23,
|
|
1023
|
+
23,
|
|
1024
|
+
r + 1,
|
|
1025
|
+
r + 2,
|
|
1026
|
+
8,
|
|
1027
|
+
r + 11,
|
|
1028
|
+
r + 12,
|
|
1029
|
+
4,
|
|
1030
|
+
28,
|
|
1031
|
+
26,
|
|
1032
|
+
9,
|
|
1033
|
+
27,
|
|
1034
|
+
r + 10,
|
|
1035
|
+
24,
|
|
1036
|
+
r + 8,
|
|
1037
|
+
r + 9,
|
|
1038
|
+
8,
|
|
1039
|
+
29,
|
|
1040
|
+
r + 7,
|
|
1041
|
+
9,
|
|
1042
|
+
r + 6,
|
|
1043
|
+
r + 7,
|
|
1044
|
+
3,
|
|
1045
|
+
r + 3,
|
|
1046
|
+
31,
|
|
1047
|
+
4,
|
|
1048
|
+
r + 4,
|
|
1049
|
+
r + 5,
|
|
1050
|
+
]);
|
|
1051
|
+
exports.bdd = util_endpoints_1.BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
|
|
1052
|
+
|
|
1053
|
+
|
|
210
1054
|
/***/ }),
|
|
211
1055
|
|
|
212
1056
|
/***/ 9765:
|
|
@@ -217,13 +1061,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
217
1061
|
exports.defaultEndpointResolver = void 0;
|
|
218
1062
|
const util_endpoints_1 = __webpack_require__(3068);
|
|
219
1063
|
const util_endpoints_2 = __webpack_require__(9674);
|
|
220
|
-
const
|
|
1064
|
+
const bdd_1 = __webpack_require__(2050);
|
|
221
1065
|
const cache = new util_endpoints_2.EndpointCache({
|
|
222
1066
|
size: 50,
|
|
223
1067
|
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
|
|
224
1068
|
});
|
|
225
1069
|
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
|
226
|
-
return cache.get(endpointParams, () => (0, util_endpoints_2.
|
|
1070
|
+
return cache.get(endpointParams, () => (0, util_endpoints_2.decideEndpoint)(bdd_1.bdd, {
|
|
227
1071
|
endpointParams: endpointParams,
|
|
228
1072
|
logger: context.logger,
|
|
229
1073
|
}));
|
|
@@ -232,158 +1076,6 @@ exports.defaultEndpointResolver = defaultEndpointResolver;
|
|
|
232
1076
|
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;
|
|
233
1077
|
|
|
234
1078
|
|
|
235
|
-
/***/ }),
|
|
236
|
-
|
|
237
|
-
/***/ 1670:
|
|
238
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
242
|
-
exports.ruleSet = void 0;
|
|
243
|
-
const F = "required", G = "type", H = "fn", I = "argv", J = "ref";
|
|
244
|
-
const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4", f = "sts", g = "us-east-1", h = "endpoint", i = "https://sts.{Region}.{PartitionResult#dnsSuffix}", j = "tree", k = "error", l = "getAttr", m = { [F]: false, [G]: "string" }, n = { [F]: true, default: false, [G]: "boolean" }, o = { [J]: "Endpoint" }, p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }, q = { [J]: "Region" }, r = { [H]: "aws.partition", [I]: [q], assign: "PartitionResult" }, s = { [J]: "UseFIPS" }, t = { [J]: "UseDualStack" }, u = {
|
|
245
|
-
url: "https://sts.amazonaws.com",
|
|
246
|
-
properties: { authSchemes: [{ name: e, signingName: f, signingRegion: g }] },
|
|
247
|
-
headers: {},
|
|
248
|
-
}, v = {}, w = { conditions: [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }, x = { [H]: c, [I]: [s, true] }, y = { [H]: c, [I]: [t, true] }, z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }, A = { [J]: "PartitionResult" }, B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }, C = [{ [H]: "isSet", [I]: [o] }], D = [x], E = [y];
|
|
249
|
-
const _data = {
|
|
250
|
-
version: "1.0",
|
|
251
|
-
parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n },
|
|
252
|
-
rules: [
|
|
253
|
-
{
|
|
254
|
-
conditions: [
|
|
255
|
-
{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] },
|
|
256
|
-
{ [H]: "not", [I]: C },
|
|
257
|
-
p,
|
|
258
|
-
r,
|
|
259
|
-
{ [H]: c, [I]: [s, a] },
|
|
260
|
-
{ [H]: c, [I]: [t, a] },
|
|
261
|
-
],
|
|
262
|
-
rules: [
|
|
263
|
-
{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h },
|
|
264
|
-
{ conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h },
|
|
265
|
-
{ conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h },
|
|
266
|
-
{ conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h },
|
|
267
|
-
w,
|
|
268
|
-
{ conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h },
|
|
269
|
-
{ conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h },
|
|
270
|
-
{ conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h },
|
|
271
|
-
{ conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h },
|
|
272
|
-
{ conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h },
|
|
273
|
-
{ conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h },
|
|
274
|
-
{ conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h },
|
|
275
|
-
{ conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h },
|
|
276
|
-
{ conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h },
|
|
277
|
-
{ conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h },
|
|
278
|
-
{ conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h },
|
|
279
|
-
{
|
|
280
|
-
endpoint: {
|
|
281
|
-
url: i,
|
|
282
|
-
properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] },
|
|
283
|
-
headers: v,
|
|
284
|
-
},
|
|
285
|
-
[G]: h,
|
|
286
|
-
},
|
|
287
|
-
],
|
|
288
|
-
[G]: j,
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
conditions: C,
|
|
292
|
-
rules: [
|
|
293
|
-
{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k },
|
|
294
|
-
{ conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k },
|
|
295
|
-
{ endpoint: { url: o, properties: v, headers: v }, [G]: h },
|
|
296
|
-
],
|
|
297
|
-
[G]: j,
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
conditions: [p],
|
|
301
|
-
rules: [
|
|
302
|
-
{
|
|
303
|
-
conditions: [r],
|
|
304
|
-
rules: [
|
|
305
|
-
{
|
|
306
|
-
conditions: [x, y],
|
|
307
|
-
rules: [
|
|
308
|
-
{
|
|
309
|
-
conditions: [{ [H]: c, [I]: [b, z] }, B],
|
|
310
|
-
rules: [
|
|
311
|
-
{
|
|
312
|
-
endpoint: {
|
|
313
|
-
url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
|
|
314
|
-
properties: v,
|
|
315
|
-
headers: v,
|
|
316
|
-
},
|
|
317
|
-
[G]: h,
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
[G]: j,
|
|
321
|
-
},
|
|
322
|
-
{ error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k },
|
|
323
|
-
],
|
|
324
|
-
[G]: j,
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
conditions: D,
|
|
328
|
-
rules: [
|
|
329
|
-
{
|
|
330
|
-
conditions: [{ [H]: c, [I]: [z, b] }],
|
|
331
|
-
rules: [
|
|
332
|
-
{
|
|
333
|
-
conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }],
|
|
334
|
-
endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v },
|
|
335
|
-
[G]: h,
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
endpoint: {
|
|
339
|
-
url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",
|
|
340
|
-
properties: v,
|
|
341
|
-
headers: v,
|
|
342
|
-
},
|
|
343
|
-
[G]: h,
|
|
344
|
-
},
|
|
345
|
-
],
|
|
346
|
-
[G]: j,
|
|
347
|
-
},
|
|
348
|
-
{ error: "FIPS is enabled but this partition does not support FIPS", [G]: k },
|
|
349
|
-
],
|
|
350
|
-
[G]: j,
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
conditions: E,
|
|
354
|
-
rules: [
|
|
355
|
-
{
|
|
356
|
-
conditions: [B],
|
|
357
|
-
rules: [
|
|
358
|
-
{
|
|
359
|
-
endpoint: {
|
|
360
|
-
url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",
|
|
361
|
-
properties: v,
|
|
362
|
-
headers: v,
|
|
363
|
-
},
|
|
364
|
-
[G]: h,
|
|
365
|
-
},
|
|
366
|
-
],
|
|
367
|
-
[G]: j,
|
|
368
|
-
},
|
|
369
|
-
{ error: "DualStack is enabled but this partition does not support DualStack", [G]: k },
|
|
370
|
-
],
|
|
371
|
-
[G]: j,
|
|
372
|
-
},
|
|
373
|
-
w,
|
|
374
|
-
{ endpoint: { url: i, properties: v, headers: v }, [G]: h },
|
|
375
|
-
],
|
|
376
|
-
[G]: j,
|
|
377
|
-
},
|
|
378
|
-
],
|
|
379
|
-
[G]: j,
|
|
380
|
-
},
|
|
381
|
-
{ error: "Invalid Configuration: Missing Region", [G]: k },
|
|
382
|
-
],
|
|
383
|
-
};
|
|
384
|
-
exports.ruleSet = _data;
|
|
385
|
-
|
|
386
|
-
|
|
387
1079
|
/***/ }),
|
|
388
1080
|
|
|
389
1081
|
/***/ 1136:
|
|
@@ -764,6 +1456,11 @@ const getRuntimeConfig = (config) => {
|
|
|
764
1456
|
(async (idProps) => await config.credentialDefaultProvider(idProps?.__config || {})()),
|
|
765
1457
|
signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
|
|
766
1458
|
},
|
|
1459
|
+
{
|
|
1460
|
+
schemeId: "aws.auth#sigv4a",
|
|
1461
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4a"),
|
|
1462
|
+
signer: new httpAuthSchemes_1.AwsSdkSigV4ASigner(),
|
|
1463
|
+
},
|
|
767
1464
|
{
|
|
768
1465
|
schemeId: "smithy.api#noAuth",
|
|
769
1466
|
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
@@ -780,6 +1477,7 @@ const getRuntimeConfig = (config) => {
|
|
|
780
1477
|
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
|
781
1478
|
}, config),
|
|
782
1479
|
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
|
|
1480
|
+
sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? (0, node_config_provider_1.loadConfig)(httpAuthSchemes_1.NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
|
|
783
1481
|
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
|
784
1482
|
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
785
1483
|
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
@@ -799,6 +1497,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
799
1497
|
exports.getRuntimeConfig = void 0;
|
|
800
1498
|
const httpAuthSchemes_1 = __webpack_require__(7523);
|
|
801
1499
|
const protocols_1 = __webpack_require__(7288);
|
|
1500
|
+
const signature_v4_multi_region_1 = __webpack_require__(5785);
|
|
802
1501
|
const core_1 = __webpack_require__(402);
|
|
803
1502
|
const smithy_client_1 = __webpack_require__(1411);
|
|
804
1503
|
const url_parser_1 = __webpack_require__(4494);
|
|
@@ -822,6 +1521,11 @@ const getRuntimeConfig = (config) => {
|
|
|
822
1521
|
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
823
1522
|
signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
|
|
824
1523
|
},
|
|
1524
|
+
{
|
|
1525
|
+
schemeId: "aws.auth#sigv4a",
|
|
1526
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4a"),
|
|
1527
|
+
signer: new httpAuthSchemes_1.AwsSdkSigV4ASigner(),
|
|
1528
|
+
},
|
|
825
1529
|
{
|
|
826
1530
|
schemeId: "smithy.api#noAuth",
|
|
827
1531
|
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
@@ -838,6 +1542,7 @@ const getRuntimeConfig = (config) => {
|
|
|
838
1542
|
serviceTarget: "AWSSecurityTokenServiceV20110615",
|
|
839
1543
|
},
|
|
840
1544
|
serviceId: config?.serviceId ?? "STS",
|
|
1545
|
+
signerConstructor: config?.signerConstructor ?? signature_v4_multi_region_1.SignatureV4MultiRegion,
|
|
841
1546
|
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
|
842
1547
|
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
|
|
843
1548
|
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
|
|
@@ -1068,12 +1773,174 @@ exports.AssumeRoleWithWebIdentity$ = [
|
|
|
1068
1773
|
];
|
|
1069
1774
|
|
|
1070
1775
|
|
|
1776
|
+
/***/ }),
|
|
1777
|
+
|
|
1778
|
+
/***/ 5785:
|
|
1779
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
var middlewareSdkS3 = __webpack_require__(7445);
|
|
1784
|
+
var signatureV4 = __webpack_require__(5118);
|
|
1785
|
+
|
|
1786
|
+
const signatureV4CrtContainer = {
|
|
1787
|
+
CrtSignerV4: null,
|
|
1788
|
+
};
|
|
1789
|
+
|
|
1790
|
+
class SignatureV4MultiRegion {
|
|
1791
|
+
sigv4aSigner;
|
|
1792
|
+
sigv4Signer;
|
|
1793
|
+
signerOptions;
|
|
1794
|
+
static sigv4aDependency() {
|
|
1795
|
+
if (typeof signatureV4CrtContainer.CrtSignerV4 === "function") {
|
|
1796
|
+
return "crt";
|
|
1797
|
+
}
|
|
1798
|
+
else if (typeof signatureV4.signatureV4aContainer.SignatureV4a === "function") {
|
|
1799
|
+
return "js";
|
|
1800
|
+
}
|
|
1801
|
+
return "none";
|
|
1802
|
+
}
|
|
1803
|
+
constructor(options) {
|
|
1804
|
+
this.sigv4Signer = new middlewareSdkS3.SignatureV4S3Express(options);
|
|
1805
|
+
this.signerOptions = options;
|
|
1806
|
+
}
|
|
1807
|
+
async sign(requestToSign, options = {}) {
|
|
1808
|
+
if (options.signingRegion === "*") {
|
|
1809
|
+
return this.getSigv4aSigner().sign(requestToSign, options);
|
|
1810
|
+
}
|
|
1811
|
+
return this.sigv4Signer.sign(requestToSign, options);
|
|
1812
|
+
}
|
|
1813
|
+
async signWithCredentials(requestToSign, credentials, options = {}) {
|
|
1814
|
+
if (options.signingRegion === "*") {
|
|
1815
|
+
const signer = this.getSigv4aSigner();
|
|
1816
|
+
const CrtSignerV4 = signatureV4CrtContainer.CrtSignerV4;
|
|
1817
|
+
if (CrtSignerV4 && signer instanceof CrtSignerV4) {
|
|
1818
|
+
return signer.signWithCredentials(requestToSign, credentials, options);
|
|
1819
|
+
}
|
|
1820
|
+
else {
|
|
1821
|
+
throw new Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. ` +
|
|
1822
|
+
`Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. ` +
|
|
1823
|
+
`You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] ` +
|
|
1824
|
+
`or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. ` +
|
|
1825
|
+
`For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
return this.sigv4Signer.signWithCredentials(requestToSign, credentials, options);
|
|
1829
|
+
}
|
|
1830
|
+
async presign(originalRequest, options = {}) {
|
|
1831
|
+
if (options.signingRegion === "*") {
|
|
1832
|
+
const signer = this.getSigv4aSigner();
|
|
1833
|
+
const CrtSignerV4 = signatureV4CrtContainer.CrtSignerV4;
|
|
1834
|
+
if (CrtSignerV4 && signer instanceof CrtSignerV4) {
|
|
1835
|
+
return signer.presign(originalRequest, options);
|
|
1836
|
+
}
|
|
1837
|
+
else {
|
|
1838
|
+
throw new Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. ` +
|
|
1839
|
+
`Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. ` +
|
|
1840
|
+
`You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] ` +
|
|
1841
|
+
`or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. ` +
|
|
1842
|
+
`For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
return this.sigv4Signer.presign(originalRequest, options);
|
|
1846
|
+
}
|
|
1847
|
+
async presignWithCredentials(originalRequest, credentials, options = {}) {
|
|
1848
|
+
if (options.signingRegion === "*") {
|
|
1849
|
+
throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");
|
|
1850
|
+
}
|
|
1851
|
+
return this.sigv4Signer.presignWithCredentials(originalRequest, credentials, options);
|
|
1852
|
+
}
|
|
1853
|
+
getSigv4aSigner() {
|
|
1854
|
+
if (!this.sigv4aSigner) {
|
|
1855
|
+
const CrtSignerV4 = signatureV4CrtContainer.CrtSignerV4;
|
|
1856
|
+
const JsSigV4aSigner = signatureV4.signatureV4aContainer.SignatureV4a;
|
|
1857
|
+
if (this.signerOptions.runtime === "node") {
|
|
1858
|
+
if (!CrtSignerV4 && !JsSigV4aSigner) {
|
|
1859
|
+
throw new Error("Neither CRT nor JS SigV4a implementation is available. " +
|
|
1860
|
+
"Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. " +
|
|
1861
|
+
"For more information please go to " +
|
|
1862
|
+
"https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");
|
|
1863
|
+
}
|
|
1864
|
+
if (CrtSignerV4 && typeof CrtSignerV4 === "function") {
|
|
1865
|
+
this.sigv4aSigner = new CrtSignerV4({
|
|
1866
|
+
...this.signerOptions,
|
|
1867
|
+
signingAlgorithm: 1,
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
else if (JsSigV4aSigner && typeof JsSigV4aSigner === "function") {
|
|
1871
|
+
this.sigv4aSigner = new JsSigV4aSigner({
|
|
1872
|
+
...this.signerOptions,
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
else {
|
|
1876
|
+
throw new Error("Available SigV4a implementation is not a valid constructor. " +
|
|
1877
|
+
"Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a." +
|
|
1878
|
+
"For more information please go to " +
|
|
1879
|
+
"https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
else {
|
|
1883
|
+
if (!JsSigV4aSigner || typeof JsSigV4aSigner !== "function") {
|
|
1884
|
+
throw new Error("JS SigV4a implementation is not available or not a valid constructor. " +
|
|
1885
|
+
"Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. " +
|
|
1886
|
+
"You must also register the package by calling [require('@aws-sdk/signature-v4a');] " +
|
|
1887
|
+
"or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. " +
|
|
1888
|
+
"For more information please go to " +
|
|
1889
|
+
"https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");
|
|
1890
|
+
}
|
|
1891
|
+
this.sigv4aSigner = new JsSigV4aSigner({
|
|
1892
|
+
...this.signerOptions,
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
return this.sigv4aSigner;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
exports.SignatureV4MultiRegion = SignatureV4MultiRegion;
|
|
1901
|
+
exports.signatureV4CrtContainer = signatureV4CrtContainer;
|
|
1902
|
+
|
|
1903
|
+
|
|
1904
|
+
/***/ }),
|
|
1905
|
+
|
|
1906
|
+
/***/ 6369:
|
|
1907
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1908
|
+
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
const validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
|
|
1912
|
+
const parse = (arn) => {
|
|
1913
|
+
const segments = arn.split(":");
|
|
1914
|
+
if (segments.length < 6 || segments[0] !== "arn")
|
|
1915
|
+
throw new Error("Malformed ARN");
|
|
1916
|
+
const [, partition, service, region, accountId, ...resource] = segments;
|
|
1917
|
+
return {
|
|
1918
|
+
partition,
|
|
1919
|
+
service,
|
|
1920
|
+
region,
|
|
1921
|
+
accountId,
|
|
1922
|
+
resource: resource.join(":"),
|
|
1923
|
+
};
|
|
1924
|
+
};
|
|
1925
|
+
const build = (arnObject) => {
|
|
1926
|
+
const { partition = "aws", service, region, accountId, resource } = arnObject;
|
|
1927
|
+
if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
|
|
1928
|
+
throw new Error("Input ARN object is invalid");
|
|
1929
|
+
}
|
|
1930
|
+
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
1931
|
+
};
|
|
1932
|
+
|
|
1933
|
+
exports.build = build;
|
|
1934
|
+
exports.parse = parse;
|
|
1935
|
+
exports.validate = validate;
|
|
1936
|
+
|
|
1937
|
+
|
|
1071
1938
|
/***/ }),
|
|
1072
1939
|
|
|
1073
1940
|
/***/ 9955:
|
|
1074
1941
|
/***/ ((module) => {
|
|
1075
1942
|
|
|
1076
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","version":"3.
|
|
1943
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","version":"3.997.0","description":"Nested clients for AWS SDK packages.","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"yarn lint && concurrently \'yarn:build:types\' \'yarn:build:es\' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":"yarn g:turbo run build -F=\\"$npm_package_name\\"","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo","lint":"node ../../scripts/validation/submodules-linter.js --pkg nested-clients","test":"yarn g:vitest run","test:watch":"yarn g:vitest watch"},"engines":{"node":">=20.0.0"},"sideEffects":false,"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.974.2","@aws-sdk/middleware-host-header":"^3.972.10","@aws-sdk/middleware-logger":"^3.972.10","@aws-sdk/middleware-recursion-detection":"^3.972.11","@aws-sdk/middleware-user-agent":"^3.972.32","@aws-sdk/region-config-resolver":"^3.972.12","@aws-sdk/signature-v4-multi-region":"^3.996.19","@aws-sdk/types":"^3.973.8","@aws-sdk/util-endpoints":"^3.996.7","@aws-sdk/util-user-agent-browser":"^3.972.10","@aws-sdk/util-user-agent-node":"^3.973.18","@smithy/config-resolver":"^4.4.16","@smithy/core":"^3.23.15","@smithy/fetch-http-handler":"^5.3.17","@smithy/hash-node":"^4.2.14","@smithy/invalid-dependency":"^4.2.14","@smithy/middleware-content-length":"^4.2.14","@smithy/middleware-endpoint":"^4.4.30","@smithy/middleware-retry":"^4.5.3","@smithy/middleware-serde":"^4.2.18","@smithy/middleware-stack":"^4.2.14","@smithy/node-config-provider":"^4.3.14","@smithy/node-http-handler":"^4.5.3","@smithy/protocol-http":"^5.3.14","@smithy/smithy-client":"^4.12.11","@smithy/types":"^4.14.1","@smithy/url-parser":"^4.2.14","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.47","@smithy/util-defaults-mode-node":"^4.2.52","@smithy/util-endpoints":"^3.4.1","@smithy/util-middleware":"^4.2.14","@smithy/util-retry":"^4.3.2","@smithy/util-utf8":"^4.2.2","tslib":"^2.6.2"},"devDependencies":{"concurrently":"7.0.0","downlevel-dts":"0.10.1","premove":"4.0.0","typescript":"~5.8.3"},"typesVersions":{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["./cognito-identity.d.ts","./cognito-identity.js","./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sso.d.ts","./sso.js","./sts.d.ts","./sts.js","dist-*/**"],"browser":{"./dist-es/submodules/cognito-identity/runtimeConfig":"./dist-es/submodules/cognito-identity/runtimeConfig.browser","./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sso/runtimeConfig":"./dist-es/submodules/sso/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"packages/nested-clients"},"exports":{"./package.json":"./package.json","./sso-oidc":{"types":"./dist-types/submodules/sso-oidc/index.d.ts","module":"./dist-es/submodules/sso-oidc/index.js","node":"./dist-cjs/submodules/sso-oidc/index.js","import":"./dist-es/submodules/sso-oidc/index.js","require":"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{"types":"./dist-types/submodules/sts/index.d.ts","module":"./dist-es/submodules/sts/index.js","node":"./dist-cjs/submodules/sts/index.js","import":"./dist-es/submodules/sts/index.js","require":"./dist-cjs/submodules/sts/index.js"},"./signin":{"types":"./dist-types/submodules/signin/index.d.ts","module":"./dist-es/submodules/signin/index.js","node":"./dist-cjs/submodules/signin/index.js","import":"./dist-es/submodules/signin/index.js","require":"./dist-cjs/submodules/signin/index.js"},"./cognito-identity":{"types":"./dist-types/submodules/cognito-identity/index.d.ts","module":"./dist-es/submodules/cognito-identity/index.js","node":"./dist-cjs/submodules/cognito-identity/index.js","import":"./dist-es/submodules/cognito-identity/index.js","require":"./dist-cjs/submodules/cognito-identity/index.js"},"./sso":{"types":"./dist-types/submodules/sso/index.d.ts","module":"./dist-es/submodules/sso/index.js","node":"./dist-cjs/submodules/sso/index.js","import":"./dist-es/submodules/sso/index.js","require":"./dist-cjs/submodules/sso/index.js"}}}');
|
|
1077
1944
|
|
|
1078
1945
|
/***/ })
|
|
1079
1946
|
|