@fromeroc9/testform 1.0.11 → 1.0.13

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.
Files changed (70) hide show
  1. package/dist/index.js +360 -649
  2. package/package.json +13 -7
  3. package/dist/action/index.js +0 -242
  4. package/dist/action.js +0 -60
  5. package/dist/adapters/github.js +0 -467
  6. package/dist/adapters/resources.js +0 -363
  7. package/dist/cli/136.index.js +0 -990
  8. package/dist/cli/360.index.js +0 -92
  9. package/dist/cli/443.index.js +0 -724
  10. package/dist/cli/449.index.js +0 -13
  11. package/dist/cli/566.index.js +0 -385
  12. package/dist/cli/605.index.js +0 -241
  13. package/dist/cli/762.index.js +0 -583
  14. package/dist/cli/869.index.js +0 -529
  15. package/dist/cli/956.index.js +0 -117
  16. package/dist/cli/998.index.js +0 -894
  17. package/dist/cli/index.js +0 -241
  18. package/dist/commands/apply.js +0 -390
  19. package/dist/commands/destroy.js +0 -85
  20. package/dist/commands/diff.js +0 -131
  21. package/dist/commands/fmt.js +0 -166
  22. package/dist/commands/force-unlock.js +0 -55
  23. package/dist/commands/generate.js +0 -143
  24. package/dist/commands/graph.js +0 -159
  25. package/dist/commands/import.js +0 -222
  26. package/dist/commands/init.js +0 -167
  27. package/dist/commands/login.js +0 -71
  28. package/dist/commands/logout.js +0 -20
  29. package/dist/commands/plan.js +0 -250
  30. package/dist/commands/refresh.js +0 -165
  31. package/dist/commands/report.js +0 -724
  32. package/dist/commands/show.js +0 -61
  33. package/dist/commands/state.js +0 -197
  34. package/dist/commands/taint.js +0 -49
  35. package/dist/commands/validate.js +0 -128
  36. package/dist/commands/workspace.js +0 -102
  37. package/dist/const.js +0 -105
  38. package/dist/core/backends/azurerm.js +0 -201
  39. package/dist/core/backends/backend.js +0 -2
  40. package/dist/core/backends/gcs.js +0 -200
  41. package/dist/core/backends/local.js +0 -162
  42. package/dist/core/backends/s3.js +0 -224
  43. package/dist/core/command-context.js +0 -59
  44. package/dist/core/config.js +0 -131
  45. package/dist/core/credentials.js +0 -53
  46. package/dist/core/parser.js +0 -62
  47. package/dist/core/parsers/base-parser.js +0 -215
  48. package/dist/core/parsers/testcase-parser.js +0 -115
  49. package/dist/core/parsers/testplan-parser.js +0 -41
  50. package/dist/core/parsers/testrun-parser.js +0 -43
  51. package/dist/core/policy.js +0 -341
  52. package/dist/core/prompt.js +0 -109
  53. package/dist/core/state.js +0 -185
  54. package/dist/core/utils.js +0 -94
  55. package/dist/core/variables.js +0 -108
  56. package/dist/core/workspace.js +0 -56
  57. package/dist/help.js +0 -797
  58. package/dist/logger.js +0 -134
  59. package/dist/notify.js +0 -36
  60. package/dist/types.js +0 -2
  61. /package/dist/{action/136.index.js → 136.index.js} +0 -0
  62. /package/dist/{action/360.index.js → 360.index.js} +0 -0
  63. /package/dist/{action/443.index.js → 443.index.js} +0 -0
  64. /package/dist/{action/449.index.js → 449.index.js} +0 -0
  65. /package/dist/{action/566.index.js → 566.index.js} +0 -0
  66. /package/dist/{action/605.index.js → 605.index.js} +0 -0
  67. /package/dist/{action/762.index.js → 762.index.js} +0 -0
  68. /package/dist/{action/869.index.js → 869.index.js} +0 -0
  69. /package/dist/{action/956.index.js → 956.index.js} +0 -0
  70. /package/dist/{action/998.index.js → 998.index.js} +0 -0
@@ -1,529 +0,0 @@
1
- "use strict";
2
- exports.id = 869;
3
- exports.ids = [869];
4
- exports.modules = {
5
-
6
- /***/ 75869:
7
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
8
-
9
-
10
-
11
- var config = __webpack_require__(47291);
12
- var client = __webpack_require__(5152);
13
- var credentialProviderLogin = __webpack_require__(84072);
14
-
15
- const resolveCredentialSource = (credentialSource, profileName, logger) => {
16
- const sourceProvidersMap = {
17
- EcsContainer: async (options) => {
18
- const { fromHttp } = await __webpack_require__.e(/* import() */ 605).then(__webpack_require__.t.bind(__webpack_require__, 98605, 19));
19
- const { fromContainerMetadata } = await __webpack_require__.e(/* import() */ 566).then(__webpack_require__.t.bind(__webpack_require__, 40566, 19));
20
- logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
21
- return async () => config.chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
22
- },
23
- Ec2InstanceMetadata: async (options) => {
24
- logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
25
- const { fromInstanceMetadata } = await __webpack_require__.e(/* import() */ 566).then(__webpack_require__.t.bind(__webpack_require__, 40566, 19));
26
- return async () => fromInstanceMetadata(options)().then(setNamedProvider);
27
- },
28
- Environment: async (options) => {
29
- logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
30
- const { fromEnv } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 55606, 19));
31
- return async () => fromEnv(options)().then(setNamedProvider);
32
- },
33
- };
34
- if (credentialSource in sourceProvidersMap) {
35
- return sourceProvidersMap[credentialSource];
36
- }
37
- else {
38
- throw new config.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, ` +
39
- `expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
40
- }
41
- };
42
- const setNamedProvider = (creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
43
-
44
- const isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
45
- return (Boolean(arg) &&
46
- typeof arg === "object" &&
47
- typeof arg.role_arn === "string" &&
48
- ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 &&
49
- ["undefined", "string"].indexOf(typeof arg.external_id) > -1 &&
50
- ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 &&
51
- (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })));
52
- };
53
- const isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
54
- const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
55
- if (withSourceProfile) {
56
- logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
57
- }
58
- return withSourceProfile;
59
- };
60
- const isCredentialSourceProfile = (arg, { profile, logger }) => {
61
- const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
62
- if (withProviderProfile) {
63
- logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
64
- }
65
- return withProviderProfile;
66
- };
67
- const resolveAssumeRoleCredentials = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, resolveProfileData) => {
68
- options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
69
- const profileData = profiles[profileName];
70
- const { source_profile, region } = profileData;
71
- if (!options.roleAssumer) {
72
- const { getDefaultRoleAssumer } = await __webpack_require__.e(/* import() */ 136).then(__webpack_require__.t.bind(__webpack_require__, 1136, 19));
73
- options.roleAssumer = getDefaultRoleAssumer({
74
- ...options.clientConfig,
75
- credentialProviderLogger: options.logger,
76
- parentClientConfig: {
77
- ...callerClientConfig,
78
- ...options?.parentClientConfig,
79
- region: region ?? options?.parentClientConfig?.region ?? callerClientConfig?.region,
80
- },
81
- }, options.clientPlugins);
82
- }
83
- if (source_profile && source_profile in visitedProfiles) {
84
- throw new config.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile` +
85
- ` ${config.getProfileName(options)}. Profiles visited: ` +
86
- Object.keys(visitedProfiles).join(", "), { logger: options.logger });
87
- }
88
- options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
89
- const sourceCredsProvider = source_profile
90
- ? resolveProfileData(source_profile, profiles, options, callerClientConfig, {
91
- ...visitedProfiles,
92
- [source_profile]: true,
93
- }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {}))
94
- : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
95
- if (isCredentialSourceWithoutRoleArn(profileData)) {
96
- return sourceCredsProvider.then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
97
- }
98
- else {
99
- const params = {
100
- RoleArn: profileData.role_arn,
101
- RoleSessionName: profileData.role_session_name || `aws-sdk-js-${Date.now()}`,
102
- ExternalId: profileData.external_id,
103
- DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10),
104
- };
105
- const { mfa_serial } = profileData;
106
- if (mfa_serial) {
107
- if (!options.mfaCodeProvider) {
108
- throw new config.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
109
- }
110
- params.SerialNumber = mfa_serial;
111
- params.TokenCode = await options.mfaCodeProvider(mfa_serial);
112
- }
113
- const sourceCreds = await sourceCredsProvider;
114
- return options.roleAssumer(sourceCreds, params).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
115
- }
116
- };
117
- const isCredentialSourceWithoutRoleArn = (section) => {
118
- return !section.role_arn && !!section.credential_source;
119
- };
120
-
121
- const isLoginProfile = (data) => {
122
- return Boolean(data && data.login_session);
123
- };
124
- const resolveLoginCredentials = async (profileName, options, callerClientConfig) => {
125
- const credentials = await credentialProviderLogin.fromLoginCredentials({
126
- ...options,
127
- profile: profileName,
128
- })({ callerClientConfig });
129
- return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
130
- };
131
-
132
- const isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
133
- const resolveProcessCredentials = async (options, profile) => __webpack_require__.e(/* import() */ 360).then(__webpack_require__.t.bind(__webpack_require__, 75360, 19)).then(({ fromProcess }) => fromProcess({
134
- ...options,
135
- profile,
136
- })().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v")));
137
-
138
- const resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {
139
- const { fromSSO } = await __webpack_require__.e(/* import() */ 998).then(__webpack_require__.t.bind(__webpack_require__, 60998, 19));
140
- return fromSSO({
141
- profile,
142
- logger: options.logger,
143
- parentClientConfig: options.parentClientConfig,
144
- clientConfig: options.clientConfig,
145
- })({
146
- callerClientConfig,
147
- }).then((creds) => {
148
- if (profileData.sso_session) {
149
- return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
150
- }
151
- else {
152
- return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
153
- }
154
- });
155
- };
156
- const isSsoProfile = (arg) => arg &&
157
- (typeof arg.sso_start_url === "string" ||
158
- typeof arg.sso_account_id === "string" ||
159
- typeof arg.sso_session === "string" ||
160
- typeof arg.sso_region === "string" ||
161
- typeof arg.sso_role_name === "string");
162
-
163
- const isStaticCredsProfile = (arg) => Boolean(arg) &&
164
- typeof arg === "object" &&
165
- typeof arg.aws_access_key_id === "string" &&
166
- typeof arg.aws_secret_access_key === "string" &&
167
- ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 &&
168
- ["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1;
169
- const resolveStaticCredentials = async (profile, options) => {
170
- options?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
171
- const credentials = {
172
- accessKeyId: profile.aws_access_key_id,
173
- secretAccessKey: profile.aws_secret_access_key,
174
- sessionToken: profile.aws_session_token,
175
- ...(profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }),
176
- ...(profile.aws_account_id && { accountId: profile.aws_account_id }),
177
- };
178
- return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
179
- };
180
-
181
- const isWebIdentityProfile = (arg) => Boolean(arg) &&
182
- typeof arg === "object" &&
183
- typeof arg.web_identity_token_file === "string" &&
184
- typeof arg.role_arn === "string" &&
185
- ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
186
- const resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => __webpack_require__.e(/* import() */ 956).then(__webpack_require__.t.bind(__webpack_require__, 29956, 23)).then(({ fromTokenFile }) => fromTokenFile({
187
- webIdentityTokenFile: profile.web_identity_token_file,
188
- roleArn: profile.role_arn,
189
- roleSessionName: profile.role_session_name,
190
- roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
191
- logger: options.logger,
192
- parentClientConfig: options.parentClientConfig,
193
- })({
194
- callerClientConfig,
195
- }).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q")));
196
-
197
- const resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
198
- const data = profiles[profileName];
199
- if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
200
- return resolveStaticCredentials(data, options);
201
- }
202
- if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
203
- return resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig, visitedProfiles, resolveProfileData);
204
- }
205
- if (isStaticCredsProfile(data)) {
206
- return resolveStaticCredentials(data, options);
207
- }
208
- if (isWebIdentityProfile(data)) {
209
- return resolveWebIdentityCredentials(data, options, callerClientConfig);
210
- }
211
- if (isProcessProfile(data)) {
212
- return resolveProcessCredentials(options, profileName);
213
- }
214
- if (isSsoProfile(data)) {
215
- return await resolveSsoCredentials(profileName, data, options, callerClientConfig);
216
- }
217
- if (isLoginProfile(data)) {
218
- return resolveLoginCredentials(profileName, options, callerClientConfig);
219
- }
220
- throw new config.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
221
- };
222
-
223
- const fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {
224
- init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
225
- const profiles = await config.parseKnownFiles(init);
226
- return resolveProfileData(config.getProfileName({
227
- profile: init.profile ?? callerClientConfig?.profile,
228
- }), profiles, init, callerClientConfig);
229
- };
230
-
231
- exports.fromIni = fromIni;
232
-
233
-
234
- /***/ }),
235
-
236
- /***/ 84072:
237
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
238
-
239
-
240
-
241
- var client = __webpack_require__(5152);
242
- var config = __webpack_require__(47291);
243
- var protocols = __webpack_require__(93422);
244
- var node_crypto = __webpack_require__(77598);
245
- var node_fs = __webpack_require__(73024);
246
- var node_os = __webpack_require__(48161);
247
- var node_path = __webpack_require__(76760);
248
-
249
- class LoginCredentialsFetcher {
250
- profileData;
251
- init;
252
- callerClientConfig;
253
- static REFRESH_THRESHOLD = 5 * 60 * 1000;
254
- constructor(profileData, init, callerClientConfig) {
255
- this.profileData = profileData;
256
- this.init = init;
257
- this.callerClientConfig = callerClientConfig;
258
- }
259
- async loadCredentials() {
260
- const token = await this.loadToken();
261
- if (!token) {
262
- throw new config.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
263
- }
264
- const accessToken = token.accessToken;
265
- const now = Date.now();
266
- const expiryTime = new Date(accessToken.expiresAt).getTime();
267
- const timeUntilExpiry = expiryTime - now;
268
- if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {
269
- return this.refresh(token);
270
- }
271
- return {
272
- accessKeyId: accessToken.accessKeyId,
273
- secretAccessKey: accessToken.secretAccessKey,
274
- sessionToken: accessToken.sessionToken,
275
- accountId: accessToken.accountId,
276
- expiration: new Date(accessToken.expiresAt),
277
- };
278
- }
279
- get logger() {
280
- return this.init?.logger;
281
- }
282
- get loginSession() {
283
- return this.profileData.login_session;
284
- }
285
- async refresh(token) {
286
- const { SigninClient, CreateOAuth2TokenCommand } = await __webpack_require__.e(/* import() */ 762).then(__webpack_require__.t.bind(__webpack_require__, 99762, 19));
287
- const { logger, userAgentAppId } = this.callerClientConfig ?? {};
288
- const isH2 = (requestHandler) => {
289
- return requestHandler?.metadata?.handlerProtocol === "h2";
290
- };
291
- const requestHandler = isH2(this.callerClientConfig?.requestHandler)
292
- ? undefined
293
- : this.callerClientConfig?.requestHandler;
294
- const region = this.profileData.region ?? (await this.callerClientConfig?.region?.()) ?? process.env.AWS_REGION;
295
- const client = new SigninClient({
296
- credentials: {
297
- accessKeyId: "",
298
- secretAccessKey: "",
299
- },
300
- region,
301
- requestHandler,
302
- logger,
303
- userAgentAppId,
304
- ...this.init?.clientConfig,
305
- });
306
- this.createDPoPInterceptor(client.middlewareStack);
307
- const commandInput = {
308
- tokenInput: {
309
- clientId: token.clientId,
310
- refreshToken: token.refreshToken,
311
- grantType: "refresh_token",
312
- },
313
- };
314
- try {
315
- const response = await client.send(new CreateOAuth2TokenCommand(commandInput));
316
- const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
317
- const { refreshToken, expiresIn } = response.tokenOutput ?? {};
318
- if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
319
- throw new config.CredentialsProviderError("Token refresh response missing required fields", {
320
- logger: this.logger,
321
- tryNextLink: false,
322
- });
323
- }
324
- const expiresInMs = (expiresIn ?? 900) * 1000;
325
- const expiration = new Date(Date.now() + expiresInMs);
326
- const updatedToken = {
327
- ...token,
328
- accessToken: {
329
- ...token.accessToken,
330
- accessKeyId: accessKeyId,
331
- secretAccessKey: secretAccessKey,
332
- sessionToken: sessionToken,
333
- expiresAt: expiration.toISOString(),
334
- },
335
- refreshToken: refreshToken,
336
- };
337
- await this.saveToken(updatedToken);
338
- const newAccessToken = updatedToken.accessToken;
339
- return {
340
- accessKeyId: newAccessToken.accessKeyId,
341
- secretAccessKey: newAccessToken.secretAccessKey,
342
- sessionToken: newAccessToken.sessionToken,
343
- accountId: newAccessToken.accountId,
344
- expiration,
345
- };
346
- }
347
- catch (error) {
348
- if (error.name === "AccessDeniedException") {
349
- const errorType = error.error;
350
- let message;
351
- switch (errorType) {
352
- case "TOKEN_EXPIRED":
353
- message = "Your session has expired. Please reauthenticate.";
354
- break;
355
- case "USER_CREDENTIALS_CHANGED":
356
- message =
357
- "Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";
358
- break;
359
- case "INSUFFICIENT_PERMISSIONS":
360
- message =
361
- "Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
362
- break;
363
- default:
364
- message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
365
- }
366
- throw new config.CredentialsProviderError(message, { logger: this.logger, tryNextLink: false });
367
- }
368
- throw new config.CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
369
- }
370
- }
371
- async loadToken() {
372
- const tokenFilePath = this.getTokenFilePath();
373
- try {
374
- let tokenData;
375
- try {
376
- tokenData = await config.readFile(tokenFilePath, { ignoreCache: this.init?.ignoreCache });
377
- }
378
- catch {
379
- tokenData = await node_fs.promises.readFile(tokenFilePath, "utf8");
380
- }
381
- const token = JSON.parse(tokenData);
382
- const missingFields = ["accessToken", "clientId", "refreshToken", "dpopKey"].filter((k) => !token[k]);
383
- if (!token.accessToken?.accountId) {
384
- missingFields.push("accountId");
385
- }
386
- if (missingFields.length > 0) {
387
- throw new config.CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
388
- logger: this.logger,
389
- tryNextLink: false,
390
- });
391
- }
392
- return token;
393
- }
394
- catch (error) {
395
- throw new config.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
396
- logger: this.logger,
397
- tryNextLink: false,
398
- });
399
- }
400
- }
401
- async saveToken(token) {
402
- const tokenFilePath = this.getTokenFilePath();
403
- const directory = node_path.dirname(tokenFilePath);
404
- try {
405
- await node_fs.promises.mkdir(directory, { recursive: true });
406
- }
407
- catch (error) {
408
- }
409
- await node_fs.promises.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
410
- }
411
- getTokenFilePath() {
412
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? node_path.join(node_os.homedir(), ".aws", "login", "cache");
413
- const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
414
- const loginSessionSha256 = node_crypto.createHash("sha256").update(loginSessionBytes).digest("hex");
415
- return node_path.join(directory, `${loginSessionSha256}.json`);
416
- }
417
- derToRawSignature(derSignature) {
418
- let offset = 2;
419
- if (derSignature[offset] !== 0x02) {
420
- throw new Error("Invalid DER signature");
421
- }
422
- offset++;
423
- const rLength = derSignature[offset++];
424
- let r = derSignature.subarray(offset, offset + rLength);
425
- offset += rLength;
426
- if (derSignature[offset] !== 0x02) {
427
- throw new Error("Invalid DER signature");
428
- }
429
- offset++;
430
- const sLength = derSignature[offset++];
431
- let s = derSignature.subarray(offset, offset + sLength);
432
- r = r[0] === 0x00 ? r.subarray(1) : r;
433
- s = s[0] === 0x00 ? s.subarray(1) : s;
434
- const rPadded = Buffer.concat([Buffer.alloc(32 - r.length), r]);
435
- const sPadded = Buffer.concat([Buffer.alloc(32 - s.length), s]);
436
- return Buffer.concat([rPadded, sPadded]);
437
- }
438
- createDPoPInterceptor(middlewareStack) {
439
- middlewareStack.add((next) => async (args) => {
440
- if (protocols.HttpRequest.isInstance(args.request)) {
441
- const request = args.request;
442
- const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : ""}${request.path}`;
443
- const dpop = await this.generateDpop(request.method, actualEndpoint);
444
- request.headers = {
445
- ...request.headers,
446
- DPoP: dpop,
447
- };
448
- }
449
- return next(args);
450
- }, {
451
- step: "finalizeRequest",
452
- name: "dpopInterceptor",
453
- override: true,
454
- });
455
- }
456
- async generateDpop(method = "POST", endpoint) {
457
- const token = await this.loadToken();
458
- try {
459
- const privateKey = node_crypto.createPrivateKey({
460
- key: token.dpopKey,
461
- format: "pem",
462
- type: "sec1",
463
- });
464
- const publicKey = node_crypto.createPublicKey(privateKey);
465
- const publicDer = publicKey.export({ format: "der", type: "spki" });
466
- let pointStart = -1;
467
- for (let i = 0; i < publicDer.length; i++) {
468
- if (publicDer[i] === 0x04) {
469
- pointStart = i;
470
- break;
471
- }
472
- }
473
- const x = publicDer.slice(pointStart + 1, pointStart + 33);
474
- const y = publicDer.slice(pointStart + 33, pointStart + 65);
475
- const header = {
476
- alg: "ES256",
477
- typ: "dpop+jwt",
478
- jwk: {
479
- kty: "EC",
480
- crv: "P-256",
481
- x: x.toString("base64url"),
482
- y: y.toString("base64url"),
483
- },
484
- };
485
- const payload = {
486
- jti: crypto.randomUUID(),
487
- htm: method,
488
- htu: endpoint,
489
- iat: Math.floor(Date.now() / 1000),
490
- };
491
- const headerB64 = Buffer.from(JSON.stringify(header)).toString("base64url");
492
- const payloadB64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
493
- const message = `${headerB64}.${payloadB64}`;
494
- const asn1Signature = node_crypto.sign("sha256", Buffer.from(message), privateKey);
495
- const rawSignature = this.derToRawSignature(asn1Signature);
496
- const signatureB64 = rawSignature.toString("base64url");
497
- return `${message}.${signatureB64}`;
498
- }
499
- catch (error) {
500
- throw new config.CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
501
- }
502
- }
503
- }
504
-
505
- const fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
506
- init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
507
- const profiles = await config.parseKnownFiles(init || {});
508
- const profileName = config.getProfileName({
509
- profile: init?.profile ?? callerClientConfig?.profile,
510
- });
511
- const profile = profiles[profileName];
512
- if (!profile?.login_session) {
513
- throw new config.CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
514
- tryNextLink: true,
515
- logger: init?.logger,
516
- });
517
- }
518
- const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
519
- const credentials = await fetcher.loadCredentials();
520
- return client.setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
521
- };
522
-
523
- exports.fromLoginCredentials = fromLoginCredentials;
524
-
525
-
526
- /***/ })
527
-
528
- };
529
- ;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- exports.id = 956;
3
- exports.ids = [956];
4
- exports.modules = {
5
-
6
- /***/ 88079:
7
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
8
-
9
-
10
- Object.defineProperty(exports, "__esModule", ({ value: true }));
11
- exports.fromTokenFile = void 0;
12
- const client_1 = __webpack_require__(5152);
13
- const config_1 = __webpack_require__(47291);
14
- const node_fs_1 = __webpack_require__(73024);
15
- const fromWebToken_1 = __webpack_require__(34453);
16
- const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
17
- const ENV_ROLE_ARN = "AWS_ROLE_ARN";
18
- const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
19
- const fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
20
- init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
21
- const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
22
- const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
23
- const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
24
- if (!webIdentityTokenFile || !roleArn) {
25
- throw new config_1.CredentialsProviderError("Web identity configuration not specified", {
26
- logger: init.logger,
27
- });
28
- }
29
- const credentials = await (0, fromWebToken_1.fromWebToken)({
30
- ...init,
31
- webIdentityToken: config_1.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ??
32
- (0, node_fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }),
33
- roleArn,
34
- roleSessionName,
35
- })(awsIdentityProperties);
36
- if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) {
37
- (0, client_1.setCredentialFeature)(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
38
- }
39
- return credentials;
40
- };
41
- exports.fromTokenFile = fromTokenFile;
42
-
43
-
44
- /***/ }),
45
-
46
- /***/ 34453:
47
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
48
-
49
-
50
- Object.defineProperty(exports, "__esModule", ({ value: true }));
51
- exports.fromWebToken = void 0;
52
- const fromWebToken = (init) => async (awsIdentityProperties) => {
53
- init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
54
- const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
55
- let { roleAssumerWithWebIdentity } = init;
56
- if (!roleAssumerWithWebIdentity) {
57
- const { getDefaultRoleAssumerWithWebIdentity } = await __webpack_require__.e(/* import() */ 136).then(__webpack_require__.t.bind(__webpack_require__, 1136, 19));
58
- roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
59
- ...init.clientConfig,
60
- credentialProviderLogger: init.logger,
61
- parentClientConfig: {
62
- ...awsIdentityProperties?.callerClientConfig,
63
- ...init.parentClientConfig,
64
- },
65
- }, init.clientPlugins);
66
- }
67
- return roleAssumerWithWebIdentity({
68
- RoleArn: roleArn,
69
- RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,
70
- WebIdentityToken: webIdentityToken,
71
- ProviderId: providerId,
72
- PolicyArns: policyArns,
73
- Policy: policy,
74
- DurationSeconds: durationSeconds,
75
- });
76
- };
77
- exports.fromWebToken = fromWebToken;
78
-
79
-
80
- /***/ }),
81
-
82
- /***/ 29956:
83
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
84
-
85
-
86
-
87
- var fromTokenFile = __webpack_require__(88079);
88
- var fromWebToken = __webpack_require__(34453);
89
-
90
-
91
-
92
- Object.prototype.hasOwnProperty.call(fromTokenFile, '__proto__') &&
93
- !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
94
- Object.defineProperty(exports, '__proto__', {
95
- enumerable: true,
96
- value: fromTokenFile['__proto__']
97
- });
98
-
99
- Object.keys(fromTokenFile).forEach(function (k) {
100
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = fromTokenFile[k];
101
- });
102
- Object.prototype.hasOwnProperty.call(fromWebToken, '__proto__') &&
103
- !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
104
- Object.defineProperty(exports, '__proto__', {
105
- enumerable: true,
106
- value: fromWebToken['__proto__']
107
- });
108
-
109
- Object.keys(fromWebToken).forEach(function (k) {
110
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = fromWebToken[k];
111
- });
112
-
113
-
114
- /***/ })
115
-
116
- };
117
- ;