@aws/cloudformation-languageserver 0.0.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +175 -0
- package/NOTICE +10 -0
- package/README.md +70 -3
- package/THIRD-PARTY-LICENSES.txt +15761 -0
- package/assets/featureFlag/alpha.json +57 -0
- package/assets/featureFlag/beta.json +56 -0
- package/assets/featureFlag/prod.json +56 -0
- package/assets/relationship_schemas.json +16282 -0
- package/assets/release-manifest.json +1115 -0
- package/assets/wheels/annotated_types-0.7.0-py3-none-any.whl +0 -0
- package/assets/wheels/attrs-26.1.0-py3-none-any.whl +0 -0
- package/assets/wheels/aws_sam_translator-1.109.0-py3-none-any.whl +0 -0
- package/assets/wheels/boto3-1.43.4-py3-none-any.whl +0 -0
- package/assets/wheels/botocore-1.43.4-py3-none-any.whl +0 -0
- package/assets/wheels/cfn_lint-1.57.0-py3-none-any.whl +0 -0
- package/assets/wheels/jmespath-1.1.0-py3-none-any.whl +0 -0
- package/assets/wheels/jsonpatch-1.33-py2.py3-none-any.whl +0 -0
- package/assets/wheels/jsonpointer-3.1.1-py3-none-any.whl +0 -0
- package/assets/wheels/jsonschema-4.26.0-py3-none-any.whl +0 -0
- package/assets/wheels/jsonschema_specifications-2025.9.1-py3-none-any.whl +0 -0
- package/assets/wheels/micropip-0.10.1-py3-none-any.whl +0 -0
- package/assets/wheels/mpmath-1.4.1-py3-none-any.whl +0 -0
- package/assets/wheels/networkx-3.6.1-py3-none-any.whl +0 -0
- package/assets/wheels/pydantic-2.10.6-py3-none-any.whl +0 -0
- package/assets/wheels/pydantic_core-2.27.2-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
- package/assets/wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl +0 -0
- package/assets/wheels/pyyaml-6.0.2-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
- package/assets/wheels/referencing-0.37.0-py3-none-any.whl +0 -0
- package/assets/wheels/regex-2024.11.6-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
- package/assets/wheels/rpds_py-0.23.1-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
- package/assets/wheels/s3transfer-0.17.0-py3-none-any.whl +0 -0
- package/assets/wheels/six-1.17.0-py2.py3-none-any.whl +0 -0
- package/assets/wheels/sympy-1.14.0-py3-none-any.whl +0 -0
- package/assets/wheels/typing_extensions-4.15.0-py3-none-any.whl +0 -0
- package/assets/wheels/urllib3-2.7.0-py3-none-any.whl +0 -0
- package/cfn-lsp-server-standalone.js +45233 -0
- package/cfn-lsp-server-standalone.js.map +1 -0
- package/cfn-validate-worker.js +83 -0
- package/cfn-validate-worker.js.map +1 -0
- package/guard_bg.wasm +0 -0
- package/node_modules_aws-sdk_credential-provider-http_dist-es_index_js.js +225 -0
- package/node_modules_aws-sdk_credential-provider-http_dist-es_index_js.js.map +1 -0
- package/node_modules_aws-sdk_credential-provider-ini_dist-es_index_js.js +280 -0
- package/node_modules_aws-sdk_credential-provider-ini_dist-es_index_js.js.map +1 -0
- package/node_modules_aws-sdk_credential-provider-login_dist-es_index_js.js +329 -0
- package/node_modules_aws-sdk_credential-provider-login_dist-es_index_js.js.map +1 -0
- package/node_modules_aws-sdk_credential-provider-process_dist-es_index_js.js +111 -0
- package/node_modules_aws-sdk_credential-provider-process_dist-es_index_js.js.map +1 -0
- package/node_modules_aws-sdk_credential-provider-sso_dist-es_index_js.js +424 -0
- package/node_modules_aws-sdk_credential-provider-sso_dist-es_index_js.js.map +1 -0
- package/node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js.js +90 -0
- package/node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js.js.map +1 -0
- package/node_modules_smithy_credential-provider-imds_dist-es_index_js.js +437 -0
- package/node_modules_smithy_credential-provider-imds_dist-es_index_js.js.map +1 -0
- package/package.json +74 -7
- package/pyodide-worker.js +1207 -0
- package/pyodide-worker.js.map +1 -0
- package/vendor/cfn-guard/guard.js +414 -0
- package/vendor/cfn-guard/guard_bg.wasm +0 -0
- package/vendor/cfn-guard/index.js +87 -0
- package/vendor/cfn-guard/package.json +39 -0
- package/vendors-node_modules_aws-sdk_client-cloudcontrol_dist-es_index_js-node_modules_aws-sdk_client-4d5eee.js +140762 -0
- package/vendors-node_modules_aws-sdk_client-cloudcontrol_dist-es_index_js-node_modules_aws-sdk_client-4d5eee.js.map +1 -0
- package/vendors-node_modules_aws-sdk_credential-provider-sso_dist-es_loadSso_js.js +577 -0
- package/vendors-node_modules_aws-sdk_credential-provider-sso_dist-es_loadSso_js.js.map +1 -0
- package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_signin_index_js.js +697 -0
- package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_signin_index_js.js.map +1 -0
- package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sso-oidc_index_js.js +769 -0
- package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sso-oidc_index_js.js.map +1 -0
- package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sts_index_js.js +990 -0
- package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sts_index_js.js.map +1 -0
- package/vendors-node_modules_base2_pretty-print-object_dist_index_js-node_modules_vscode-jsonrpc_node-9a0a8d.js +8429 -0
- package/vendors-node_modules_base2_pretty-print-object_dist_index_js-node_modules_vscode-jsonrpc_node-9a0a8d.js.map +1 -0
- package/vendors-node_modules_bowser_src_bowser_js.js +3300 -0
- package/vendors-node_modules_bowser_src_bowser_js.js.map +1 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_aws-sdk_credential-provider-sso_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_aws-sdk_credential-provider-sso_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
fromSSO: () => (/* reexport */ fromSSO)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// UNUSED EXPORTS: isSsoProfile, validateSsoProfile
|
|
16
|
+
|
|
17
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/config/index.js + 49 modules
|
|
18
|
+
var config = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/config/index.js");
|
|
19
|
+
;// ./node_modules/@aws-sdk/credential-provider-sso/dist-es/isSsoProfile.js
|
|
20
|
+
const isSsoProfile = (arg) => arg &&
|
|
21
|
+
(typeof arg.sso_start_url === "string" ||
|
|
22
|
+
typeof arg.sso_account_id === "string" ||
|
|
23
|
+
typeof arg.sso_session === "string" ||
|
|
24
|
+
typeof arg.sso_region === "string" ||
|
|
25
|
+
typeof arg.sso_role_name === "string");
|
|
26
|
+
|
|
27
|
+
// EXTERNAL MODULE: ./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js + 35 modules
|
|
28
|
+
var client = __webpack_require__("./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js");
|
|
29
|
+
// EXTERNAL MODULE: ./node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js + 15 modules
|
|
30
|
+
var httpAuthSchemes = __webpack_require__("./node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js");
|
|
31
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js
|
|
32
|
+
/* unused harmony import specifier */ var setTokenFeature;
|
|
33
|
+
/* unused harmony import specifier */ var getBearerTokenEnvKey;
|
|
34
|
+
/* unused harmony import specifier */ var TokenProviderError;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
|
|
39
|
+
logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
40
|
+
if (!signingName) {
|
|
41
|
+
throw new TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger });
|
|
42
|
+
}
|
|
43
|
+
const bearerTokenKey = getBearerTokenEnvKey(signingName);
|
|
44
|
+
if (!(bearerTokenKey in process.env)) {
|
|
45
|
+
throw new TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
|
|
46
|
+
}
|
|
47
|
+
const token = { token: process.env[bearerTokenKey] };
|
|
48
|
+
setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
49
|
+
return token;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/constants.js
|
|
53
|
+
const EXPIRE_WINDOW_MS = 5 * 60 * 1000;
|
|
54
|
+
const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
|
|
55
|
+
|
|
56
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js
|
|
57
|
+
const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
|
|
58
|
+
const { SSOOIDCClient } = await __webpack_require__.e(/* import() */ "vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sso-oidc_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/index.js"));
|
|
59
|
+
const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
|
|
60
|
+
const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
|
|
61
|
+
region: ssoRegion ?? init.clientConfig?.region,
|
|
62
|
+
logger: coalesce("logger"),
|
|
63
|
+
userAgentAppId: coalesce("userAgentAppId"),
|
|
64
|
+
}));
|
|
65
|
+
return ssoOidcClient;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js
|
|
69
|
+
|
|
70
|
+
const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
|
|
71
|
+
const { CreateTokenCommand } = await __webpack_require__.e(/* import() */ "vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sso-oidc_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/index.js"));
|
|
72
|
+
const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
|
|
73
|
+
return ssoOidcClient.send(new CreateTokenCommand({
|
|
74
|
+
clientId: ssoToken.clientId,
|
|
75
|
+
clientSecret: ssoToken.clientSecret,
|
|
76
|
+
refreshToken: ssoToken.refreshToken,
|
|
77
|
+
grantType: "refresh_token",
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
const validateTokenExpiry = (token) => {
|
|
85
|
+
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
86
|
+
throw new config/* TokenProviderError */.Jh(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
const validateTokenKey = (key, value, forRefresh = false) => {
|
|
94
|
+
if (typeof value === "undefined") {
|
|
95
|
+
throw new config/* TokenProviderError */.Jh(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// EXTERNAL MODULE: external "node:fs"
|
|
100
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
101
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
const { writeFile } = external_node_fs_.promises;
|
|
105
|
+
const writeSSOTokenToFile = (id, ssoToken) => {
|
|
106
|
+
const tokenFilepath = (0,config/* getSSOTokenFilepath */.C9)(id);
|
|
107
|
+
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
108
|
+
return writeFile(tokenFilepath, tokenString);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const lastRefreshAttemptTimes = new Map();
|
|
119
|
+
const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
120
|
+
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
121
|
+
const profiles = await (0,config/* parseKnownFiles */.YU)(init);
|
|
122
|
+
const profileName = (0,config/* getProfileName */.Bz)({
|
|
123
|
+
profile: init.profile ?? callerClientConfig?.profile,
|
|
124
|
+
});
|
|
125
|
+
const profile = profiles[profileName];
|
|
126
|
+
if (!profile) {
|
|
127
|
+
throw new config/* TokenProviderError */.Jh(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
128
|
+
}
|
|
129
|
+
else if (!profile["sso_session"]) {
|
|
130
|
+
throw new config/* TokenProviderError */.Jh(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
131
|
+
}
|
|
132
|
+
const ssoSessionName = profile["sso_session"];
|
|
133
|
+
const ssoSessions = await (0,config/* loadSsoSessionData */.qw)(init);
|
|
134
|
+
const ssoSession = ssoSessions[ssoSessionName];
|
|
135
|
+
if (!ssoSession) {
|
|
136
|
+
throw new config/* TokenProviderError */.Jh(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
137
|
+
}
|
|
138
|
+
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
139
|
+
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
140
|
+
throw new config/* TokenProviderError */.Jh(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const ssoStartUrl = ssoSession["sso_start_url"];
|
|
144
|
+
const ssoRegion = ssoSession["sso_region"];
|
|
145
|
+
let ssoToken;
|
|
146
|
+
try {
|
|
147
|
+
ssoToken = await (0,config/* getSSOTokenFromFile */.vf)(ssoSessionName);
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
throw new config/* TokenProviderError */.Jh(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
151
|
+
}
|
|
152
|
+
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
153
|
+
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
154
|
+
const { accessToken, expiresAt } = ssoToken;
|
|
155
|
+
const existingToken = {
|
|
156
|
+
token: accessToken,
|
|
157
|
+
expiration: new Date(expiresAt),
|
|
158
|
+
};
|
|
159
|
+
if (existingToken.expiration.getTime() - Date.now() > (/* inlined export .EXPIRE_WINDOW_MS */300000)) {
|
|
160
|
+
return existingToken;
|
|
161
|
+
}
|
|
162
|
+
const lastRefreshAttemptTime = lastRefreshAttemptTimes.get(ssoSessionName) ?? 0;
|
|
163
|
+
if (Date.now() - lastRefreshAttemptTime < 30 * 1000) {
|
|
164
|
+
validateTokenExpiry(existingToken);
|
|
165
|
+
return existingToken;
|
|
166
|
+
}
|
|
167
|
+
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
168
|
+
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
169
|
+
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
170
|
+
try {
|
|
171
|
+
lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
|
|
172
|
+
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
173
|
+
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
174
|
+
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
175
|
+
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
|
|
176
|
+
try {
|
|
177
|
+
await writeSSOTokenToFile(ssoSessionName, {
|
|
178
|
+
...ssoToken,
|
|
179
|
+
accessToken: newSsoOidcToken.accessToken,
|
|
180
|
+
expiresAt: newTokenExpiration.toISOString(),
|
|
181
|
+
refreshToken: newSsoOidcToken.refreshToken,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
token: newSsoOidcToken.accessToken,
|
|
188
|
+
expiration: newTokenExpiration,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
validateTokenExpiry(existingToken);
|
|
193
|
+
return existingToken;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js
|
|
198
|
+
/* unused harmony import specifier */ var fromStatic_TokenProviderError;
|
|
199
|
+
|
|
200
|
+
const fromStatic = ({ token, logger }) => async () => {
|
|
201
|
+
logger?.debug("@aws-sdk/token-providers - fromStatic");
|
|
202
|
+
if (!token || !token.token) {
|
|
203
|
+
throw new fromStatic_TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
204
|
+
}
|
|
205
|
+
return token;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js
|
|
209
|
+
/* unused harmony import specifier */ var memoize;
|
|
210
|
+
/* unused harmony import specifier */ var chain;
|
|
211
|
+
/* unused harmony import specifier */ var nodeProvider_TokenProviderError;
|
|
212
|
+
/* unused harmony import specifier */ var nodeProvider_fromSso;
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
const nodeProvider = (init = {}) => memoize(chain(nodeProvider_fromSso(init), async () => {
|
|
216
|
+
throw new nodeProvider_TokenProviderError("Could not load token from any providers", false);
|
|
217
|
+
}), (token) => token.expiration !== undefined && token.expiration.getTime() - Date.now() < 300000, (token) => token.expiration !== undefined);
|
|
218
|
+
|
|
219
|
+
;// ./node_modules/@aws-sdk/token-providers/dist-es/index.js
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
;// ./node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
const SHOULD_FAIL_CREDENTIAL_CHAIN = false;
|
|
230
|
+
const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger, }) => {
|
|
231
|
+
let token;
|
|
232
|
+
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
233
|
+
if (ssoSession) {
|
|
234
|
+
try {
|
|
235
|
+
const _token = await fromSso({
|
|
236
|
+
profile,
|
|
237
|
+
filepath,
|
|
238
|
+
configFilepath,
|
|
239
|
+
ignoreCache,
|
|
240
|
+
clientConfig,
|
|
241
|
+
parentClientConfig,
|
|
242
|
+
logger,
|
|
243
|
+
})({ callerClientConfig });
|
|
244
|
+
token = {
|
|
245
|
+
accessToken: _token.token,
|
|
246
|
+
expiresAt: new Date(_token.expiration).toISOString(),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
catch (e) {
|
|
250
|
+
throw new config/* CredentialsProviderError */.C1(e.message, {
|
|
251
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
252
|
+
logger,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
try {
|
|
258
|
+
token = await (0,config/* getSSOTokenFromFile */.vf)(ssoStartUrl);
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
throw new config/* CredentialsProviderError */.C1(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
|
|
262
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
263
|
+
logger,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
|
|
268
|
+
throw new config/* CredentialsProviderError */.C1(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
|
|
269
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
270
|
+
logger,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const { accessToken } = token;
|
|
274
|
+
const { SSOClient, GetRoleCredentialsCommand } = await __webpack_require__.e(/* import() */ "vendors-node_modules_aws-sdk_credential-provider-sso_dist-es_loadSso_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-sso/dist-es/loadSso.js"));
|
|
275
|
+
const sso = ssoClient ||
|
|
276
|
+
new SSOClient(Object.assign({}, clientConfig ?? {}, {
|
|
277
|
+
logger: clientConfig?.logger ?? callerClientConfig?.logger ?? parentClientConfig?.logger,
|
|
278
|
+
region: clientConfig?.region ?? ssoRegion,
|
|
279
|
+
userAgentAppId: clientConfig?.userAgentAppId ?? callerClientConfig?.userAgentAppId ?? parentClientConfig?.userAgentAppId,
|
|
280
|
+
}));
|
|
281
|
+
let ssoResp;
|
|
282
|
+
try {
|
|
283
|
+
ssoResp = await sso.send(new GetRoleCredentialsCommand({
|
|
284
|
+
accountId: ssoAccountId,
|
|
285
|
+
roleName: ssoRoleName,
|
|
286
|
+
accessToken,
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
catch (e) {
|
|
290
|
+
throw new config/* CredentialsProviderError */.C1(e, {
|
|
291
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
292
|
+
logger,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {}, } = ssoResp;
|
|
296
|
+
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
297
|
+
throw new config/* CredentialsProviderError */.C1("SSO returns an invalid temporary credential.", {
|
|
298
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
299
|
+
logger,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
const credentials = {
|
|
303
|
+
accessKeyId,
|
|
304
|
+
secretAccessKey,
|
|
305
|
+
sessionToken,
|
|
306
|
+
expiration: new Date(expiration),
|
|
307
|
+
...(credentialScope && { credentialScope }),
|
|
308
|
+
...(accountId && { accountId }),
|
|
309
|
+
};
|
|
310
|
+
if (ssoSession) {
|
|
311
|
+
(0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_SSO", "s");
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
(0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_SSO_LEGACY", "u");
|
|
315
|
+
}
|
|
316
|
+
return credentials;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
;// ./node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
|
|
320
|
+
|
|
321
|
+
const validateSsoProfile = (profile, logger) => {
|
|
322
|
+
const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
|
|
323
|
+
if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
|
|
324
|
+
throw new config/* CredentialsProviderError */.C1(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` +
|
|
325
|
+
`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
|
|
326
|
+
}
|
|
327
|
+
return profile;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
;// ./node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
const fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
336
|
+
init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
|
|
337
|
+
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
338
|
+
const { ssoClient } = init;
|
|
339
|
+
const profileName = (0,config/* getProfileName */.Bz)({
|
|
340
|
+
profile: init.profile ?? callerClientConfig?.profile,
|
|
341
|
+
});
|
|
342
|
+
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
343
|
+
const profiles = await (0,config/* parseKnownFiles */.YU)(init);
|
|
344
|
+
const profile = profiles[profileName];
|
|
345
|
+
if (!profile) {
|
|
346
|
+
throw new config/* CredentialsProviderError */.C1(`Profile ${profileName} was not found.`, { logger: init.logger });
|
|
347
|
+
}
|
|
348
|
+
if (!isSsoProfile(profile)) {
|
|
349
|
+
throw new config/* CredentialsProviderError */.C1(`Profile ${profileName} is not configured with SSO credentials.`, {
|
|
350
|
+
logger: init.logger,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
if (profile?.sso_session) {
|
|
354
|
+
const ssoSessions = await (0,config/* loadSsoSessionData */.qw)(init);
|
|
355
|
+
const session = ssoSessions[profile.sso_session];
|
|
356
|
+
const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
|
|
357
|
+
if (ssoRegion && ssoRegion !== session.sso_region) {
|
|
358
|
+
throw new config/* CredentialsProviderError */.C1(`Conflicting SSO region` + conflictMsg, {
|
|
359
|
+
tryNextLink: false,
|
|
360
|
+
logger: init.logger,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
|
|
364
|
+
throw new config/* CredentialsProviderError */.C1(`Conflicting SSO start_url` + conflictMsg, {
|
|
365
|
+
tryNextLink: false,
|
|
366
|
+
logger: init.logger,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
profile.sso_region = session.sso_region;
|
|
370
|
+
profile.sso_start_url = session.sso_start_url;
|
|
371
|
+
}
|
|
372
|
+
const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);
|
|
373
|
+
return resolveSSOCredentials({
|
|
374
|
+
ssoStartUrl: sso_start_url,
|
|
375
|
+
ssoSession: sso_session,
|
|
376
|
+
ssoAccountId: sso_account_id,
|
|
377
|
+
ssoRegion: sso_region,
|
|
378
|
+
ssoRoleName: sso_role_name,
|
|
379
|
+
ssoClient: ssoClient,
|
|
380
|
+
clientConfig: init.clientConfig,
|
|
381
|
+
parentClientConfig: init.parentClientConfig,
|
|
382
|
+
callerClientConfig: init.callerClientConfig,
|
|
383
|
+
profile: profileName,
|
|
384
|
+
filepath: init.filepath,
|
|
385
|
+
configFilepath: init.configFilepath,
|
|
386
|
+
ignoreCache: init.ignoreCache,
|
|
387
|
+
logger: init.logger,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
|
|
391
|
+
throw new config/* CredentialsProviderError */.C1("Incomplete configuration. The fromSSO() argument hash must include " +
|
|
392
|
+
'"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
return resolveSSOCredentials({
|
|
396
|
+
ssoStartUrl,
|
|
397
|
+
ssoSession,
|
|
398
|
+
ssoAccountId,
|
|
399
|
+
ssoRegion,
|
|
400
|
+
ssoRoleName,
|
|
401
|
+
ssoClient,
|
|
402
|
+
clientConfig: init.clientConfig,
|
|
403
|
+
parentClientConfig: init.parentClientConfig,
|
|
404
|
+
callerClientConfig: init.callerClientConfig,
|
|
405
|
+
profile: profileName,
|
|
406
|
+
filepath: init.filepath,
|
|
407
|
+
configFilepath: init.configFilepath,
|
|
408
|
+
ignoreCache: init.ignoreCache,
|
|
409
|
+
logger: init.logger,
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
;// ./node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
/***/ }
|
|
421
|
+
|
|
422
|
+
};
|
|
423
|
+
;
|
|
424
|
+
//# sourceMappingURL=node_modules_aws-sdk_credential-provider-sso_dist-es_index_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_aws-sdk_credential-provider-sso_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;AAAO;AACP;AACA;AACA;AACA;AACA;;;;;;;;;;ACLuD;AACc;AACZ;AAClD,8BAA8B,sBAAsB,IAAI;AAC/D;AACA;AACA,wGAAwG,QAAQ;AAChH;AACA;AACA;AACA,8DAA8D,eAAe,2BAA2B,QAAQ;AAChH;AACA,oBAAoB;AACpB;AACA;AACA;;;ACfO;AACA;;;ACDA,oDAAoD;AAC3D,YAAY,gBAAgB,QAAQ,2PAA0C;AAC9E;AACA,4DAA4D,yBAAyB;AACrF;AACA;AACA;AACA,KAAK;AACL;AACA;;;ACTsD;AAC/C,gEAAgE;AACvE,YAAY,qBAAqB,QAAQ,2PAA0C;AACnF,gCAAgC,gBAAgB;AAChD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;ACVyD;AACX;AACvC;AACP;AACA,kBAAkB,iCAAkB,sBAAsB,eAAe,CAAC;AAC1E;AACA;;;ACNyD;AACX;AACvC;AACP;AACA,kBAAkB,iCAAkB,2BAA2B,IAAI,gBAAgB,qCAAqC,IAAI,eAAe,CAAC;AAC5I;AACA;;;;;ACN0D;AACT;AACjD,QAAQ,YAAY,EAAE,0BAAU;AACzB;AACP,0BAA0B,sCAAmB;AAC7C;AACA;AACA;;;ACPoI;AACpE;AACN;AACE;AACN;AACM;AAC5D;AACO,0BAA0B,cAAc,qBAAqB,IAAI;AACxE;AACA,2BAA2B,kCAAe;AAC1C,wBAAwB,iCAAc;AACtC;AACA,KAAK;AACL;AACA;AACA,kBAAkB,iCAAkB,aAAa,YAAY;AAC7D;AACA;AACA,kBAAkB,iCAAkB,aAAa,YAAY;AAC7D;AACA;AACA,8BAA8B,qCAAkB;AAChD;AACA;AACA,kBAAkB,iCAAkB,iBAAiB,eAAe;AACpE;AACA;AACA;AACA,sBAAsB,iCAAkB,iBAAiB,eAAe,kCAAkC,sBAAsB;AAChI;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,sCAAmB;AAC5C;AACA;AACA,kBAAkB,iCAAkB,kDAAkD,aAAa,+BAA+B,eAAe,CAAC;AAClJ;AACA,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,YAAY,yBAAyB;AACrC;AACA;AACA;AACA;AACA,0DAA0D,8CAAgB;AAC1E;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB;AACA;AACA,sCAAsC,kBAAkB;AACxD,QAAQ,gBAAgB;AACxB,QAAQ,gBAAgB;AACxB;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;;;;ACnFyD;AAClD,sBAAsB,eAAe;AAC5C;AACA;AACA,kBAAkB,6BAAkB;AACpC;AACA;AACA;;;;;;;ACPyE;AACrC;AAC7B,+BAA+B,mBAAmB,oBAAO;AAChE,cAAc,+BAAkB;AAChC,CAAC;;;ACJyD;AACtB;AACM;AACI;;;ACHc;AACc;AACU;AACpF;AACO,uCAAuC,yLAAyL;AACvO;AACA;AACA;AACA;AACA,iCAAiC,OAAmB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,IAAI,oBAAoB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uCAAwB;AAC9C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,0BAA0B,sCAAmB;AAC7C;AACA;AACA,sBAAsB,uCAAwB,6DAA6D,eAAe;AAC1H;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,kBAAkB,uCAAwB,8DAA8D,eAAe;AACvH;AACA;AACA,SAAS;AACT;AACA,YAAY,cAAc;AAC1B,YAAY,uCAAuC,QAAQ,yOAAsB;AACjF;AACA,sCAAsC,oBAAoB;AAC1D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kBAAkB,uCAAwB;AAC1C;AACA;AACA,SAAS;AACT;AACA,YAAY,mBAAmB,qFAAqF,IAAI,IAAI;AAC5H;AACA,kBAAkB,uCAAwB;AAC1C;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD,2BAA2B,WAAW;AACtC;AACA;AACA,QAAQ,uCAAoB;AAC5B;AACA;AACA,QAAQ,uCAAoB;AAC5B;AACA;AACA;;;AC3F+D;AACxD;AACP,YAAY,2DAA2D;AACvE;AACA,kBAAkB,uCAAwB;AAC1C,mEAAmE,gCAAgC,yFAAyF,4BAA4B;AACxN;AACA;AACA;;;ACRoH;AACtE;AACkB;AACN;AACnD,0BAA0B,cAAc,qBAAqB,IAAI;AACxE;AACA,YAAY,gEAAgE;AAC5E,YAAY,YAAY;AACxB,wBAAwB,iCAAc;AACtC;AACA,KAAK;AACL;AACA,+BAA+B,kCAAe;AAC9C;AACA;AACA,sBAAsB,uCAAwB,YAAY,aAAa,mBAAmB,qBAAqB;AAC/G;AACA,aAAa,YAAY;AACzB,sBAAsB,uCAAwB,YAAY,aAAa;AACvE;AACA,aAAa;AACb;AACA;AACA,sCAAsC,qCAAkB;AACxD;AACA,8DAA8D,aAAa,kBAAkB,oBAAoB;AACjH;AACA,0BAA0B,uCAAwB;AAClD;AACA;AACA,iBAAiB;AACjB;AACA;AACA,0BAA0B,uCAAwB;AAClD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,gBAAgB,wEAAwE,EAAE,kBAAkB;AAC5G,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kBAAkB,uCAAwB;AAC1C,2EAA2E,yCAAyC;AACpH;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;ACjFoC;AACU;AACY","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-sso/dist-es/isSsoProfile.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/constants.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/fromSso.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/token-providers/dist-es/index.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js"],"sourcesContent":["export const isSsoProfile = (arg) => arg &&\n (typeof arg.sso_start_url === \"string\" ||\n typeof arg.sso_account_id === \"string\" ||\n typeof arg.sso_session === \"string\" ||\n typeof arg.sso_region === \"string\" ||\n typeof arg.sso_role_name === \"string\");\n","import { setTokenFeature } from \"@aws-sdk/core/client\";\nimport { getBearerTokenEnvKey } from \"@aws-sdk/core/httpAuthSchemes\";\nimport { TokenProviderError } from \"@smithy/core/config\";\nexport const fromEnvSigningName = ({ logger, signingName } = {}) => async () => {\n logger?.debug?.(\"@aws-sdk/token-providers - fromEnvSigningName\");\n if (!signingName) {\n throw new TokenProviderError(\"Please pass 'signingName' to compute environment variable key\", { logger });\n }\n const bearerTokenKey = getBearerTokenEnvKey(signingName);\n if (!(bearerTokenKey in process.env)) {\n throw new TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });\n }\n const token = { token: process.env[bearerTokenKey] };\n setTokenFeature(token, \"BEARER_SERVICE_ENV_VARS\", \"3\");\n return token;\n};\n","export const EXPIRE_WINDOW_MS = 5 * 60 * 1000;\nexport const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;\n","export const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {\n const { SSOOIDCClient } = await import(\"@aws-sdk/nested-clients/sso-oidc\");\n const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];\n const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {\n region: ssoRegion ?? init.clientConfig?.region,\n logger: coalesce(\"logger\"),\n userAgentAppId: coalesce(\"userAgentAppId\"),\n }));\n return ssoOidcClient;\n};\n","import { getSsoOidcClient } from \"./getSsoOidcClient\";\nexport const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {\n const { CreateTokenCommand } = await import(\"@aws-sdk/nested-clients/sso-oidc\");\n const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);\n return ssoOidcClient.send(new CreateTokenCommand({\n clientId: ssoToken.clientId,\n clientSecret: ssoToken.clientSecret,\n refreshToken: ssoToken.refreshToken,\n grantType: \"refresh_token\",\n }));\n};\n","import { TokenProviderError } from \"@smithy/core/config\";\nimport { REFRESH_MESSAGE } from \"./constants\";\nexport const validateTokenExpiry = (token) => {\n if (token.expiration && token.expiration.getTime() < Date.now()) {\n throw new TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);\n }\n};\n","import { TokenProviderError } from \"@smithy/core/config\";\nimport { REFRESH_MESSAGE } from \"./constants\";\nexport const validateTokenKey = (key, value, forRefresh = false) => {\n if (typeof value === \"undefined\") {\n throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? \". Cannot refresh\" : \"\"}. ${REFRESH_MESSAGE}`, false);\n }\n};\n","import { getSSOTokenFilepath } from \"@smithy/core/config\";\nimport { promises as fsPromises } from \"node:fs\";\nconst { writeFile } = fsPromises;\nexport const writeSSOTokenToFile = (id, ssoToken) => {\n const tokenFilepath = getSSOTokenFilepath(id);\n const tokenString = JSON.stringify(ssoToken, null, 2);\n return writeFile(tokenFilepath, tokenString);\n};\n","import { getProfileName, getSSOTokenFromFile, loadSsoSessionData, parseKnownFiles, TokenProviderError, } from \"@smithy/core/config\";\nimport { EXPIRE_WINDOW_MS, REFRESH_MESSAGE } from \"./constants\";\nimport { getNewSsoOidcToken } from \"./getNewSsoOidcToken\";\nimport { validateTokenExpiry } from \"./validateTokenExpiry\";\nimport { validateTokenKey } from \"./validateTokenKey\";\nimport { writeSSOTokenToFile } from \"./writeSSOTokenToFile\";\nconst lastRefreshAttemptTimes = new Map();\nexport const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/token-providers - fromSso\");\n const profiles = await parseKnownFiles(init);\n const profileName = getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n });\n const profile = profiles[profileName];\n if (!profile) {\n throw new TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);\n }\n else if (!profile[\"sso_session\"]) {\n throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);\n }\n const ssoSessionName = profile[\"sso_session\"];\n const ssoSessions = await loadSsoSessionData(init);\n const ssoSession = ssoSessions[ssoSessionName];\n if (!ssoSession) {\n throw new TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);\n }\n for (const ssoSessionRequiredKey of [\"sso_start_url\", \"sso_region\"]) {\n if (!ssoSession[ssoSessionRequiredKey]) {\n throw new TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);\n }\n }\n const ssoStartUrl = ssoSession[\"sso_start_url\"];\n const ssoRegion = ssoSession[\"sso_region\"];\n let ssoToken;\n try {\n ssoToken = await getSSOTokenFromFile(ssoSessionName);\n }\n catch (e) {\n throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);\n }\n validateTokenKey(\"accessToken\", ssoToken.accessToken);\n validateTokenKey(\"expiresAt\", ssoToken.expiresAt);\n const { accessToken, expiresAt } = ssoToken;\n const existingToken = {\n token: accessToken,\n expiration: new Date(expiresAt),\n };\n if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {\n return existingToken;\n }\n const lastRefreshAttemptTime = lastRefreshAttemptTimes.get(ssoSessionName) ?? 0;\n if (Date.now() - lastRefreshAttemptTime < 30 * 1000) {\n validateTokenExpiry(existingToken);\n return existingToken;\n }\n validateTokenKey(\"clientId\", ssoToken.clientId, true);\n validateTokenKey(\"clientSecret\", ssoToken.clientSecret, true);\n validateTokenKey(\"refreshToken\", ssoToken.refreshToken, true);\n try {\n lastRefreshAttemptTimes.set(ssoSessionName, Date.now());\n const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);\n validateTokenKey(\"accessToken\", newSsoOidcToken.accessToken);\n validateTokenKey(\"expiresIn\", newSsoOidcToken.expiresIn);\n const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);\n try {\n await writeSSOTokenToFile(ssoSessionName, {\n ...ssoToken,\n accessToken: newSsoOidcToken.accessToken,\n expiresAt: newTokenExpiration.toISOString(),\n refreshToken: newSsoOidcToken.refreshToken,\n });\n }\n catch (error) {\n }\n return {\n token: newSsoOidcToken.accessToken,\n expiration: newTokenExpiration,\n };\n }\n catch (error) {\n validateTokenExpiry(existingToken);\n return existingToken;\n }\n};\n","import { TokenProviderError } from \"@smithy/core/config\";\nexport const fromStatic = ({ token, logger }) => async () => {\n logger?.debug(\"@aws-sdk/token-providers - fromStatic\");\n if (!token || !token.token) {\n throw new TokenProviderError(`Please pass a valid token to fromStatic`, false);\n }\n return token;\n};\n","import { chain, memoize, TokenProviderError } from \"@smithy/core/config\";\nimport { fromSso } from \"./fromSso\";\nexport const nodeProvider = (init = {}) => memoize(chain(fromSso(init), async () => {\n throw new TokenProviderError(\"Could not load token from any providers\", false);\n}), (token) => token.expiration !== undefined && token.expiration.getTime() - Date.now() < 300000, (token) => token.expiration !== undefined);\n","export { fromEnvSigningName } from \"./fromEnvSigningName\";\nexport { fromSso } from \"./fromSso\";\nexport { fromStatic } from \"./fromStatic\";\nexport { nodeProvider } from \"./nodeProvider\";\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { fromSso as getSsoTokenProvider } from \"@aws-sdk/token-providers\";\nimport { CredentialsProviderError, getSSOTokenFromFile } from \"@smithy/core/config\";\nconst SHOULD_FAIL_CREDENTIAL_CHAIN = false;\nexport const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger, }) => {\n let token;\n const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;\n if (ssoSession) {\n try {\n const _token = await getSsoTokenProvider({\n profile,\n filepath,\n configFilepath,\n ignoreCache,\n clientConfig,\n parentClientConfig,\n logger,\n })({ callerClientConfig });\n token = {\n accessToken: _token.token,\n expiresAt: new Date(_token.expiration).toISOString(),\n };\n }\n catch (e) {\n throw new CredentialsProviderError(e.message, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n }\n else {\n try {\n token = await getSSOTokenFromFile(ssoStartUrl);\n }\n catch (e) {\n throw new CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n }\n if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {\n throw new CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n const { accessToken } = token;\n const { SSOClient, GetRoleCredentialsCommand } = await import(\"./loadSso.js\");\n const sso = ssoClient ||\n new SSOClient(Object.assign({}, clientConfig ?? {}, {\n logger: clientConfig?.logger ?? callerClientConfig?.logger ?? parentClientConfig?.logger,\n region: clientConfig?.region ?? ssoRegion,\n userAgentAppId: clientConfig?.userAgentAppId ?? callerClientConfig?.userAgentAppId ?? parentClientConfig?.userAgentAppId,\n }));\n let ssoResp;\n try {\n ssoResp = await sso.send(new GetRoleCredentialsCommand({\n accountId: ssoAccountId,\n roleName: ssoRoleName,\n accessToken,\n }));\n }\n catch (e) {\n throw new CredentialsProviderError(e, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {}, } = ssoResp;\n if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {\n throw new CredentialsProviderError(\"SSO returns an invalid temporary credential.\", {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n const credentials = {\n accessKeyId,\n secretAccessKey,\n sessionToken,\n expiration: new Date(expiration),\n ...(credentialScope && { credentialScope }),\n ...(accountId && { accountId }),\n };\n if (ssoSession) {\n setCredentialFeature(credentials, \"CREDENTIALS_SSO\", \"s\");\n }\n else {\n setCredentialFeature(credentials, \"CREDENTIALS_SSO_LEGACY\", \"u\");\n }\n return credentials;\n};\n","import { CredentialsProviderError } from \"@smithy/core/config\";\nexport const validateSsoProfile = (profile, logger) => {\n const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;\n if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {\n throw new CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters \"sso_account_id\", ` +\n `\"sso_region\", \"sso_role_name\", \"sso_start_url\". Got ${Object.keys(profile).join(\", \")}\\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });\n }\n return profile;\n};\n","import { CredentialsProviderError, getProfileName, loadSsoSessionData, parseKnownFiles } from \"@smithy/core/config\";\nimport { isSsoProfile } from \"./isSsoProfile\";\nimport { resolveSSOCredentials } from \"./resolveSSOCredentials\";\nimport { validateSsoProfile } from \"./validateSsoProfile\";\nexport const fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-sso - fromSSO\");\n const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;\n const { ssoClient } = init;\n const profileName = getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n });\n if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {\n const profiles = await parseKnownFiles(init);\n const profile = profiles[profileName];\n if (!profile) {\n throw new CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });\n }\n if (!isSsoProfile(profile)) {\n throw new CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {\n logger: init.logger,\n });\n }\n if (profile?.sso_session) {\n const ssoSessions = await loadSsoSessionData(init);\n const session = ssoSessions[profile.sso_session];\n const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;\n if (ssoRegion && ssoRegion !== session.sso_region) {\n throw new CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {\n tryNextLink: false,\n logger: init.logger,\n });\n }\n if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {\n throw new CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {\n tryNextLink: false,\n logger: init.logger,\n });\n }\n profile.sso_region = session.sso_region;\n profile.sso_start_url = session.sso_start_url;\n }\n const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);\n return resolveSSOCredentials({\n ssoStartUrl: sso_start_url,\n ssoSession: sso_session,\n ssoAccountId: sso_account_id,\n ssoRegion: sso_region,\n ssoRoleName: sso_role_name,\n ssoClient: ssoClient,\n clientConfig: init.clientConfig,\n parentClientConfig: init.parentClientConfig,\n callerClientConfig: init.callerClientConfig,\n profile: profileName,\n filepath: init.filepath,\n configFilepath: init.configFilepath,\n ignoreCache: init.ignoreCache,\n logger: init.logger,\n });\n }\n else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {\n throw new CredentialsProviderError(\"Incomplete configuration. The fromSSO() argument hash must include \" +\n '\"ssoStartUrl\", \"ssoAccountId\", \"ssoRegion\", \"ssoRoleName\"', { tryNextLink: false, logger: init.logger });\n }\n else {\n return resolveSSOCredentials({\n ssoStartUrl,\n ssoSession,\n ssoAccountId,\n ssoRegion,\n ssoRoleName,\n ssoClient,\n clientConfig: init.clientConfig,\n parentClientConfig: init.parentClientConfig,\n callerClientConfig: init.callerClientConfig,\n profile: profileName,\n filepath: init.filepath,\n configFilepath: init.configFilepath,\n ignoreCache: init.ignoreCache,\n logger: init.logger,\n });\n }\n};\n","export { fromSSO } from \"./fromSSO\";\nexport { isSsoProfile } from \"./isSsoProfile\";\nexport { validateSsoProfile } from \"./validateSsoProfile\";\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
fromTokenFile: () => (/* reexport */ fromTokenFile)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// UNUSED EXPORTS: fromWebToken
|
|
16
|
+
|
|
17
|
+
// EXTERNAL MODULE: ./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js + 35 modules
|
|
18
|
+
var client = __webpack_require__("./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js");
|
|
19
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/config/index.js + 49 modules
|
|
20
|
+
var config = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/config/index.js");
|
|
21
|
+
// EXTERNAL MODULE: external "node:fs"
|
|
22
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
23
|
+
;// ./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js
|
|
24
|
+
const fromWebToken = (init) => async (awsIdentityProperties) => {
|
|
25
|
+
init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
|
|
26
|
+
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
|
|
27
|
+
let { roleAssumerWithWebIdentity } = init;
|
|
28
|
+
if (!roleAssumerWithWebIdentity) {
|
|
29
|
+
const { getDefaultRoleAssumerWithWebIdentity } = await __webpack_require__.e(/* import() */ "vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sts_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/index.js"));
|
|
30
|
+
roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
|
|
31
|
+
...init.clientConfig,
|
|
32
|
+
credentialProviderLogger: init.logger,
|
|
33
|
+
parentClientConfig: {
|
|
34
|
+
...awsIdentityProperties?.callerClientConfig,
|
|
35
|
+
...init.parentClientConfig,
|
|
36
|
+
},
|
|
37
|
+
}, init.clientPlugins);
|
|
38
|
+
}
|
|
39
|
+
return roleAssumerWithWebIdentity({
|
|
40
|
+
RoleArn: roleArn,
|
|
41
|
+
RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,
|
|
42
|
+
WebIdentityToken: webIdentityToken,
|
|
43
|
+
ProviderId: providerId,
|
|
44
|
+
PolicyArns: policyArns,
|
|
45
|
+
Policy: policy,
|
|
46
|
+
DurationSeconds: durationSeconds,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
;// ./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
56
|
+
const ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
57
|
+
const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
|
58
|
+
const fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
|
|
59
|
+
init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
|
|
60
|
+
const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
|
|
61
|
+
const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
|
|
62
|
+
const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
|
|
63
|
+
if (!webIdentityTokenFile || !roleArn) {
|
|
64
|
+
throw new config/* CredentialsProviderError */.C1("Web identity configuration not specified", {
|
|
65
|
+
logger: init.logger,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const credentials = await fromWebToken({
|
|
69
|
+
...init,
|
|
70
|
+
webIdentityToken: config/* externalDataInterceptor */.ZY?.getTokenRecord?.()[webIdentityTokenFile] ??
|
|
71
|
+
(0,external_node_fs_.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }),
|
|
72
|
+
roleArn,
|
|
73
|
+
roleSessionName,
|
|
74
|
+
})(awsIdentityProperties);
|
|
75
|
+
if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) {
|
|
76
|
+
(0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
|
|
77
|
+
}
|
|
78
|
+
return credentials;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
;// ./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/***/ }
|
|
87
|
+
|
|
88
|
+
};
|
|
89
|
+
;
|
|
90
|
+
//# sourceMappingURL=node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAO;AACP;AACA,YAAY,8FAA8F;AAC1G,UAAU,6BAA6B;AACvC;AACA,gBAAgB,uCAAuC,QAAQ,iPAAqC;AACpG;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,kEAAkE,WAAW;AAC7E;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;ACxB4D;AAC4B;AACjD;AACO;AAC9C;AACA;AACA;AACO,gCAAgC;AACvC;AACA;AACA;AACA;AACA;AACA,kBAAkB,uCAAwB;AAC1C;AACA,SAAS;AACT;AACA,8BAA8B,YAAY;AAC1C;AACA,0BAA0B,sCAAuB;AACjD,YAAY,kCAAY,yBAAyB,mBAAmB;AACpE;AACA;AACA,KAAK;AACL;AACA,QAAQ,uCAAoB;AAC5B;AACA;AACA;;;AC5BgD;AACF","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js"],"sourcesContent":["export const fromWebToken = (init) => async (awsIdentityProperties) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-web-identity - fromWebToken\");\n const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;\n let { roleAssumerWithWebIdentity } = init;\n if (!roleAssumerWithWebIdentity) {\n const { getDefaultRoleAssumerWithWebIdentity } = await import(\"@aws-sdk/nested-clients/sts\");\n roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({\n ...init.clientConfig,\n credentialProviderLogger: init.logger,\n parentClientConfig: {\n ...awsIdentityProperties?.callerClientConfig,\n ...init.parentClientConfig,\n },\n }, init.clientPlugins);\n }\n return roleAssumerWithWebIdentity({\n RoleArn: roleArn,\n RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,\n WebIdentityToken: webIdentityToken,\n ProviderId: providerId,\n PolicyArns: policyArns,\n Policy: policy,\n DurationSeconds: durationSeconds,\n });\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { CredentialsProviderError, externalDataInterceptor } from \"@smithy/core/config\";\nimport { readFileSync } from \"node:fs\";\nimport { fromWebToken } from \"./fromWebToken\";\nconst ENV_TOKEN_FILE = \"AWS_WEB_IDENTITY_TOKEN_FILE\";\nconst ENV_ROLE_ARN = \"AWS_ROLE_ARN\";\nconst ENV_ROLE_SESSION_NAME = \"AWS_ROLE_SESSION_NAME\";\nexport const fromTokenFile = (init = {}) => async (awsIdentityProperties) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-web-identity - fromTokenFile\");\n const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];\n const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];\n const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];\n if (!webIdentityTokenFile || !roleArn) {\n throw new CredentialsProviderError(\"Web identity configuration not specified\", {\n logger: init.logger,\n });\n }\n const credentials = await fromWebToken({\n ...init,\n webIdentityToken: externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ??\n readFileSync(webIdentityTokenFile, { encoding: \"ascii\" }),\n roleArn,\n roleSessionName,\n })(awsIdentityProperties);\n if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) {\n setCredentialFeature(credentials, \"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN\", \"h\");\n }\n return credentials;\n};\n","export { fromTokenFile } from \"./fromTokenFile\";\nexport { fromWebToken } from \"./fromWebToken\";\n"],"names":[],"sourceRoot":""}
|