@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,83 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ var __webpack_modules__ = ({
|
|
4
|
+
|
|
5
|
+
/***/ "@aws/cloudformation-validate"
|
|
6
|
+
(module) {
|
|
7
|
+
|
|
8
|
+
module.exports = require("@aws/cloudformation-validate");
|
|
9
|
+
|
|
10
|
+
/***/ },
|
|
11
|
+
|
|
12
|
+
/***/ "worker_threads"
|
|
13
|
+
(module) {
|
|
14
|
+
|
|
15
|
+
module.exports = require("worker_threads");
|
|
16
|
+
|
|
17
|
+
/***/ }
|
|
18
|
+
|
|
19
|
+
/******/ });
|
|
20
|
+
/************************************************************************/
|
|
21
|
+
/******/ // The module cache
|
|
22
|
+
/******/ const __webpack_module_cache__ = {};
|
|
23
|
+
/******/
|
|
24
|
+
/******/ // The require function
|
|
25
|
+
/******/ function __webpack_require__(moduleId) {
|
|
26
|
+
/******/ // Check if module is in cache
|
|
27
|
+
/******/ const cachedModule = __webpack_module_cache__[moduleId];
|
|
28
|
+
/******/ if (cachedModule !== undefined) {
|
|
29
|
+
/******/ return cachedModule.exports;
|
|
30
|
+
/******/ }
|
|
31
|
+
/******/ // Create a new module (and put it into the cache)
|
|
32
|
+
/******/ const module = __webpack_module_cache__[moduleId] = {
|
|
33
|
+
/******/ // no module.id needed
|
|
34
|
+
/******/ // no module.loaded needed
|
|
35
|
+
/******/ exports: {}
|
|
36
|
+
/******/ };
|
|
37
|
+
/******/
|
|
38
|
+
/******/ // Execute the module function
|
|
39
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
40
|
+
/******/
|
|
41
|
+
/******/ // Return the exports of the module
|
|
42
|
+
/******/ return module.exports;
|
|
43
|
+
/******/ }
|
|
44
|
+
/******/
|
|
45
|
+
/************************************************************************/
|
|
46
|
+
let __webpack_exports__ = {};
|
|
47
|
+
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
|
|
48
|
+
(() => {
|
|
49
|
+
let exports = __webpack_exports__;
|
|
50
|
+
|
|
51
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52
|
+
const worker_threads_1 = __webpack_require__("worker_threads");
|
|
53
|
+
const cloudformation_validate_1 = __webpack_require__("@aws/cloudformation-validate");
|
|
54
|
+
const engine = new cloudformation_validate_1.CompositeEngine();
|
|
55
|
+
function post(message) {
|
|
56
|
+
worker_threads_1.parentPort?.postMessage(message);
|
|
57
|
+
}
|
|
58
|
+
worker_threads_1.parentPort?.on('message', ({ id, content, path, severityLevel }) => {
|
|
59
|
+
try {
|
|
60
|
+
const report = engine.validateTemplate(new cloudformation_validate_1.TemplateContent(content, path), {
|
|
61
|
+
detailLevel: 'STANDARD',
|
|
62
|
+
severityLevel,
|
|
63
|
+
});
|
|
64
|
+
post({ id, report });
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// postMessage would clone a WebAssembly.RuntimeError as a plain Error and lose its name
|
|
68
|
+
post({
|
|
69
|
+
id,
|
|
70
|
+
error: error instanceof Error
|
|
71
|
+
? { name: error.name, message: error.message, stack: error.stack }
|
|
72
|
+
: { name: typeof error, message: String(error) },
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
post({ ready: (0, cloudformation_validate_1.version)() });
|
|
77
|
+
|
|
78
|
+
})();
|
|
79
|
+
|
|
80
|
+
module.exports = __webpack_exports__;
|
|
81
|
+
/******/ })()
|
|
82
|
+
;
|
|
83
|
+
//# sourceMappingURL=cfn-validate-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cfn-validate-worker.js","mappings":";;;;;;;AAAA,yD;;;;;;;ACAA,2C;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;;ACtBA,+DAA4C;AAC5C,sFAAyF;AAGzF,MAAM,MAAM,GAAG,IAAI,yCAAe,EAAE,CAAC;AAErC,SAAS,IAAI,CAAC,OAA4B;IACtC,2BAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AAED,2BAAU,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAsB,EAAE,EAAE;IACnF,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,yCAAe,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;YACvE,WAAW,EAAE,UAAU;YACvB,aAAa;SAChB,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,wFAAwF;QACxF,IAAI,CAAC;YACD,EAAE;YACF,KAAK,EACD,KAAK,YAAY,KAAK;gBAClB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;gBAClE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;SAC3D,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,EAAE,KAAK,EAAE,qCAAO,GAAE,EAAE,CAAC,CAAC","sources":["webpack://@aws/cloudformation-languageserver/external commonjs2 \"@aws/cloudformation-validate\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"worker_threads\"","webpack://@aws/cloudformation-languageserver/webpack/bootstrap","webpack://@aws/cloudformation-languageserver/./src/services/cfnValidate/cfn-validate-worker.ts"],"sourcesContent":["module.exports = require(\"@aws/cloudformation-validate\");","module.exports = require(\"worker_threads\");","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import { parentPort } from 'worker_threads';\nimport { CompositeEngine, TemplateContent, version } from '@aws/cloudformation-validate';\nimport type { CfnValidateRequest, CfnValidateResponse } from './CfnValidateProtocol';\n\nconst engine = new CompositeEngine();\n\nfunction post(message: CfnValidateResponse): void {\n parentPort?.postMessage(message);\n}\n\nparentPort?.on('message', ({ id, content, path, severityLevel }: CfnValidateRequest) => {\n try {\n const report = engine.validateTemplate(new TemplateContent(content, path), {\n detailLevel: 'STANDARD',\n severityLevel,\n });\n post({ id, report });\n } catch (error) {\n // postMessage would clone a WebAssembly.RuntimeError as a plain Error and lose its name\n post({\n id,\n error:\n error instanceof Error\n ? { name: error.name, message: error.message, stack: error.stack }\n : { name: typeof error, message: String(error) },\n });\n }\n});\n\npost({ ready: version() });\n"],"names":[],"sourceRoot":""}
|
package/guard_bg.wasm
ADDED
|
Binary file
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_aws-sdk_credential-provider-http_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_aws-sdk_credential-provider-http_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@aws-sdk/credential-provider-http/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
fromHttp: () => (/* reexport */ fromHttp)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// EXTERNAL MODULE: ./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js + 35 modules
|
|
16
|
+
var client = __webpack_require__("./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js");
|
|
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
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/node-http-handler/dist-es/index.js + 16 modules
|
|
20
|
+
var dist_es = __webpack_require__("./node_modules/@smithy/node-http-handler/dist-es/index.js");
|
|
21
|
+
// EXTERNAL MODULE: external "node:fs/promises"
|
|
22
|
+
var promises_ = __webpack_require__("node:fs/promises");
|
|
23
|
+
var promises_default = /*#__PURE__*/__webpack_require__.n(promises_);
|
|
24
|
+
;// ./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
|
|
25
|
+
|
|
26
|
+
const LOOPBACK_CIDR_IPv4 = "127.0.0.0/8";
|
|
27
|
+
const LOOPBACK_CIDR_IPv6 = "::1/128";
|
|
28
|
+
const ECS_CONTAINER_HOST = "169.254.170.2";
|
|
29
|
+
const EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
|
30
|
+
const EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
|
31
|
+
const checkUrl = (url, logger) => {
|
|
32
|
+
if (url.protocol === "https:") {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (url.hostname === ECS_CONTAINER_HOST ||
|
|
36
|
+
url.hostname === EKS_CONTAINER_HOST_IPv4 ||
|
|
37
|
+
url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (url.hostname.includes("[")) {
|
|
41
|
+
if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (url.hostname === "localhost") {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const ipComponents = url.hostname.split(".");
|
|
50
|
+
const inRange = (component) => {
|
|
51
|
+
const num = parseInt(component, 10);
|
|
52
|
+
return 0 <= num && num <= 255;
|
|
53
|
+
};
|
|
54
|
+
if (ipComponents[0] === "127" &&
|
|
55
|
+
inRange(ipComponents[1]) &&
|
|
56
|
+
inRange(ipComponents[2]) &&
|
|
57
|
+
inRange(ipComponents[3]) &&
|
|
58
|
+
ipComponents.length === 4) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
throw new config/* CredentialsProviderError */.C1(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
63
|
+
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
64
|
+
- ECS container host 169.254.170.2
|
|
65
|
+
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/protocols/index.js + 20 modules
|
|
69
|
+
var protocols = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/protocols/index.js");
|
|
70
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/serde/index.js + 47 modules
|
|
71
|
+
var serde = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/serde/index.js");
|
|
72
|
+
;// ./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
function createGetRequest(url) {
|
|
78
|
+
return new protocols/* HttpRequest */.Kd({
|
|
79
|
+
protocol: url.protocol,
|
|
80
|
+
hostname: url.hostname,
|
|
81
|
+
port: Number(url.port),
|
|
82
|
+
path: url.pathname,
|
|
83
|
+
query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
|
|
84
|
+
acc[k] = v;
|
|
85
|
+
return acc;
|
|
86
|
+
}, {}),
|
|
87
|
+
fragment: url.hash,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async function getCredentials(response, logger) {
|
|
91
|
+
const stream = (0,serde/* sdkStreamMixin */.c9)(response.body);
|
|
92
|
+
const str = await stream.transformToString();
|
|
93
|
+
if (response.statusCode === 200) {
|
|
94
|
+
const parsed = JSON.parse(str);
|
|
95
|
+
if (typeof parsed.AccessKeyId !== "string" ||
|
|
96
|
+
typeof parsed.SecretAccessKey !== "string" ||
|
|
97
|
+
typeof parsed.Token !== "string" ||
|
|
98
|
+
typeof parsed.Expiration !== "string") {
|
|
99
|
+
throw new config/* CredentialsProviderError */.C1("HTTP credential provider response not of the required format, an object matching: " +
|
|
100
|
+
"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
accessKeyId: parsed.AccessKeyId,
|
|
104
|
+
secretAccessKey: parsed.SecretAccessKey,
|
|
105
|
+
sessionToken: parsed.Token,
|
|
106
|
+
expiration: (0,serde/* parseRfc3339DateTime */.EI)(parsed.Expiration),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (response.statusCode >= 400 && response.statusCode < 500) {
|
|
110
|
+
let parsedBody = {};
|
|
111
|
+
try {
|
|
112
|
+
parsedBody = JSON.parse(str);
|
|
113
|
+
}
|
|
114
|
+
catch (e) { }
|
|
115
|
+
throw Object.assign(new config/* CredentialsProviderError */.C1(`Server responded with status: ${response.statusCode}`, { logger }), {
|
|
116
|
+
Code: parsedBody.Code,
|
|
117
|
+
Message: parsedBody.Message,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
throw new config/* CredentialsProviderError */.C1(`Server responded with status: ${response.statusCode}`, { logger });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
;// ./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js
|
|
124
|
+
const retryWrapper = (toRetry, maxRetries, delayMs) => {
|
|
125
|
+
return async () => {
|
|
126
|
+
for (let i = 0; i < maxRetries; ++i) {
|
|
127
|
+
try {
|
|
128
|
+
return await toRetry();
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return await toRetry();
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
;// ./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
const AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
|
147
|
+
const DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
|
|
148
|
+
const AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
|
149
|
+
const AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
|
|
150
|
+
const AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
|
151
|
+
const fromHttp = (options = {}) => {
|
|
152
|
+
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
|
153
|
+
let host;
|
|
154
|
+
const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
|
155
|
+
const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
|
156
|
+
const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
|
157
|
+
const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
|
158
|
+
const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn
|
|
159
|
+
? console.warn
|
|
160
|
+
: options.logger.warn.bind(options.logger);
|
|
161
|
+
if (relative && full) {
|
|
162
|
+
warn("@aws-sdk/credential-provider-http: " +
|
|
163
|
+
"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
|
164
|
+
warn("awsContainerCredentialsRelativeUri will take precedence.");
|
|
165
|
+
}
|
|
166
|
+
if (token && tokenFile) {
|
|
167
|
+
warn("@aws-sdk/credential-provider-http: " +
|
|
168
|
+
"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
|
169
|
+
warn("awsContainerAuthorizationTokenFile will take precedence.");
|
|
170
|
+
}
|
|
171
|
+
if (relative) {
|
|
172
|
+
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
|
173
|
+
}
|
|
174
|
+
else if (full) {
|
|
175
|
+
host = full;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
throw new config/* CredentialsProviderError */.C1(`No HTTP credential provider host provided.
|
|
179
|
+
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
|
180
|
+
}
|
|
181
|
+
const url = new URL(host);
|
|
182
|
+
checkUrl(url, options.logger);
|
|
183
|
+
const requestHandler = dist_es/* NodeHttpHandler */.$c.create({ connectionTimeout: options.timeout ?? 1000 });
|
|
184
|
+
const requestTimeout = options.timeout ?? 1000;
|
|
185
|
+
const provider = retryWrapper(async () => {
|
|
186
|
+
const request = createGetRequest(url);
|
|
187
|
+
if (tokenFile) {
|
|
188
|
+
request.headers.Authorization = validateToken((await promises_default().readFile(tokenFile)).toString());
|
|
189
|
+
}
|
|
190
|
+
else if (token) {
|
|
191
|
+
request.headers.Authorization = validateToken(token);
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
const result = await requestHandler.handle(request, { requestTimeout });
|
|
195
|
+
return getCredentials(result.response).then((creds) => (0,client/* setCredentialFeature */.gD)(creds, "CREDENTIALS_HTTP", "z"));
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
throw new config/* CredentialsProviderError */.C1(String(e), { logger: options.logger });
|
|
199
|
+
}
|
|
200
|
+
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
|
201
|
+
return async () => {
|
|
202
|
+
try {
|
|
203
|
+
return await provider();
|
|
204
|
+
}
|
|
205
|
+
finally {
|
|
206
|
+
requestHandler.destroy?.();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
const validateToken = (token) => {
|
|
211
|
+
if (token.includes("\r\n")) {
|
|
212
|
+
throw new config/* CredentialsProviderError */.C1("Authorization token contains invalid \\r\\n sequence.");
|
|
213
|
+
}
|
|
214
|
+
return token;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
;// ./node_modules/@aws-sdk/credential-provider-http/dist-es/index.js
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
/***/ }
|
|
222
|
+
|
|
223
|
+
};
|
|
224
|
+
;
|
|
225
|
+
//# sourceMappingURL=node_modules_aws-sdk_credential-provider-http_dist-es_index_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_aws-sdk_credential-provider-http_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAA+D;AAC/D;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,uCAAwB;AACtC;AACA;AACA,4DAA4D,QAAQ;AACpE;;;;;;;ACzC+D;AACV;AACK;AACN;AAC7C;AACP,eAAe,6BAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;AACb;AACA,KAAK;AACL;AACO;AACP,mBAAmB,gCAAc;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uCAAwB;AAC9C,mBAAmB,0FAA0F,KAAK,QAAQ;AAC1H;AACA;AACA;AACA;AACA;AACA,wBAAwB,sCAAoB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,uCAAwB,kCAAkC,oBAAoB,KAAK,QAAQ;AAC3H;AACA;AACA,SAAS;AACT;AACA,cAAc,uCAAwB,kCAAkC,oBAAoB,KAAK,QAAQ;AACzG;;;AChDO;AACP;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACZ4D;AACG;AACH;AAC1B;AACI;AAC8B;AACrB;AAC/C;AACA;AACA;AACA;AACA;AACO,8BAA8B;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,wBAAwB,EAAE,SAAS;AACrD;AACA;AACA;AACA;AACA;AACA,kBAAkB,uCAAwB;AAC1C,sFAAsF,wBAAwB;AAC9G;AACA;AACA,IAAI,QAAQ;AACZ,2BAA2B,+BAAe,UAAU,4CAA4C;AAChG;AACA,qBAAqB,YAAY;AACjC,wBAAwB,gBAAgB;AACxC;AACA,iEAAiE,2BAAW;AAC5E;AACA;AACA;AACA;AACA;AACA,kEAAkE,gBAAgB;AAClF,mBAAmB,cAAc,kCAAkC,uCAAoB;AACvF;AACA;AACA,sBAAsB,uCAAwB,cAAc,wBAAwB;AACpF;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uCAAwB;AAC1C;AACA;AACA;;;AC5E+C","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-http/dist-es/index.js"],"sourcesContent":["import { CredentialsProviderError } from \"@smithy/core/config\";\nconst LOOPBACK_CIDR_IPv4 = \"127.0.0.0/8\";\nconst LOOPBACK_CIDR_IPv6 = \"::1/128\";\nconst ECS_CONTAINER_HOST = \"169.254.170.2\";\nconst EKS_CONTAINER_HOST_IPv4 = \"169.254.170.23\";\nconst EKS_CONTAINER_HOST_IPv6 = \"[fd00:ec2::23]\";\nexport const checkUrl = (url, logger) => {\n if (url.protocol === \"https:\") {\n return;\n }\n if (url.hostname === ECS_CONTAINER_HOST ||\n url.hostname === EKS_CONTAINER_HOST_IPv4 ||\n url.hostname === EKS_CONTAINER_HOST_IPv6) {\n return;\n }\n if (url.hostname.includes(\"[\")) {\n if (url.hostname === \"[::1]\" || url.hostname === \"[0000:0000:0000:0000:0000:0000:0000:0001]\") {\n return;\n }\n }\n else {\n if (url.hostname === \"localhost\") {\n return;\n }\n const ipComponents = url.hostname.split(\".\");\n const inRange = (component) => {\n const num = parseInt(component, 10);\n return 0 <= num && num <= 255;\n };\n if (ipComponents[0] === \"127\" &&\n inRange(ipComponents[1]) &&\n inRange(ipComponents[2]) &&\n inRange(ipComponents[3]) &&\n ipComponents.length === 4) {\n return;\n }\n }\n throw new CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:\n - loopback CIDR 127.0.0.0/8 or [::1/128]\n - ECS container host 169.254.170.2\n - EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });\n};\n","import { CredentialsProviderError } from \"@smithy/core/config\";\nimport { HttpRequest } from \"@smithy/core/protocols\";\nimport { parseRfc3339DateTime } from \"@smithy/core/serde\";\nimport { sdkStreamMixin } from \"@smithy/core/serde\";\nexport function createGetRequest(url) {\n return new HttpRequest({\n protocol: url.protocol,\n hostname: url.hostname,\n port: Number(url.port),\n path: url.pathname,\n query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {\n acc[k] = v;\n return acc;\n }, {}),\n fragment: url.hash,\n });\n}\nexport async function getCredentials(response, logger) {\n const stream = sdkStreamMixin(response.body);\n const str = await stream.transformToString();\n if (response.statusCode === 200) {\n const parsed = JSON.parse(str);\n if (typeof parsed.AccessKeyId !== \"string\" ||\n typeof parsed.SecretAccessKey !== \"string\" ||\n typeof parsed.Token !== \"string\" ||\n typeof parsed.Expiration !== \"string\") {\n throw new CredentialsProviderError(\"HTTP credential provider response not of the required format, an object matching: \" +\n \"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }\", { logger });\n }\n return {\n accessKeyId: parsed.AccessKeyId,\n secretAccessKey: parsed.SecretAccessKey,\n sessionToken: parsed.Token,\n expiration: parseRfc3339DateTime(parsed.Expiration),\n };\n }\n if (response.statusCode >= 400 && response.statusCode < 500) {\n let parsedBody = {};\n try {\n parsedBody = JSON.parse(str);\n }\n catch (e) { }\n throw Object.assign(new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {\n Code: parsedBody.Code,\n Message: parsedBody.Message,\n });\n }\n throw new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });\n}\n","export const retryWrapper = (toRetry, maxRetries, delayMs) => {\n return async () => {\n for (let i = 0; i < maxRetries; ++i) {\n try {\n return await toRetry();\n }\n catch (e) {\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n }\n }\n return await toRetry();\n };\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { CredentialsProviderError } from \"@smithy/core/config\";\nimport { NodeHttpHandler } from \"@smithy/node-http-handler\";\nimport fs from \"node:fs/promises\";\nimport { checkUrl } from \"./checkUrl\";\nimport { createGetRequest, getCredentials } from \"./requestHelpers\";\nimport { retryWrapper } from \"./retry-wrapper\";\nconst AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = \"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\";\nconst DEFAULT_LINK_LOCAL_HOST = \"http://169.254.170.2\";\nconst AWS_CONTAINER_CREDENTIALS_FULL_URI = \"AWS_CONTAINER_CREDENTIALS_FULL_URI\";\nconst AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = \"AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE\";\nconst AWS_CONTAINER_AUTHORIZATION_TOKEN = \"AWS_CONTAINER_AUTHORIZATION_TOKEN\";\nexport const fromHttp = (options = {}) => {\n options.logger?.debug(\"@aws-sdk/credential-provider-http - fromHttp\");\n let host;\n const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];\n const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];\n const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];\n const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];\n const warn = options.logger?.constructor?.name === \"NoOpLogger\" || !options.logger?.warn\n ? console.warn\n : options.logger.warn.bind(options.logger);\n if (relative && full) {\n warn(\"@aws-sdk/credential-provider-http: \" +\n \"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.\");\n warn(\"awsContainerCredentialsRelativeUri will take precedence.\");\n }\n if (token && tokenFile) {\n warn(\"@aws-sdk/credential-provider-http: \" +\n \"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.\");\n warn(\"awsContainerAuthorizationTokenFile will take precedence.\");\n }\n if (relative) {\n host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;\n }\n else if (full) {\n host = full;\n }\n else {\n throw new CredentialsProviderError(`No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });\n }\n const url = new URL(host);\n checkUrl(url, options.logger);\n const requestHandler = NodeHttpHandler.create({ connectionTimeout: options.timeout ?? 1000 });\n const requestTimeout = options.timeout ?? 1000;\n const provider = retryWrapper(async () => {\n const request = createGetRequest(url);\n if (tokenFile) {\n request.headers.Authorization = validateToken((await fs.readFile(tokenFile)).toString());\n }\n else if (token) {\n request.headers.Authorization = validateToken(token);\n }\n try {\n const result = await requestHandler.handle(request, { requestTimeout });\n return getCredentials(result.response).then((creds) => setCredentialFeature(creds, \"CREDENTIALS_HTTP\", \"z\"));\n }\n catch (e) {\n throw new CredentialsProviderError(String(e), { logger: options.logger });\n }\n }, options.maxRetries ?? 3, options.timeout ?? 1000);\n return async () => {\n try {\n return await provider();\n }\n finally {\n requestHandler.destroy?.();\n }\n };\n};\nconst validateToken = (token) => {\n if (token.includes(\"\\r\\n\")) {\n throw new CredentialsProviderError(\"Authorization token contains invalid \\\\r\\\\n sequence.\");\n }\n return token;\n};\n","export { fromHttp } from \"./fromHttp/fromHttp\";\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_aws-sdk_credential-provider-ini_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_aws-sdk_credential-provider-ini_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@aws-sdk/credential-provider-ini/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
fromIni: () => (/* reexport */ fromIni)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/config/index.js + 49 modules
|
|
16
|
+
var config = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/config/index.js");
|
|
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
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const resolveCredentialSource = (credentialSource, profileName, logger) => {
|
|
23
|
+
const sourceProvidersMap = {
|
|
24
|
+
EcsContainer: async (options) => {
|
|
25
|
+
const { fromHttp } = await __webpack_require__.e(/* import() */ "node_modules_aws-sdk_credential-provider-http_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-http/dist-es/index.js"));
|
|
26
|
+
const { fromContainerMetadata } = await __webpack_require__.e(/* import() */ "node_modules_smithy_credential-provider-imds_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@smithy/credential-provider-imds/dist-es/index.js"));
|
|
27
|
+
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
28
|
+
return async () => (0,config/* chain */.cy)(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
|
|
29
|
+
},
|
|
30
|
+
Ec2InstanceMetadata: async (options) => {
|
|
31
|
+
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
32
|
+
const { fromInstanceMetadata } = await __webpack_require__.e(/* import() */ "node_modules_smithy_credential-provider-imds_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@smithy/credential-provider-imds/dist-es/index.js"));
|
|
33
|
+
return async () => fromInstanceMetadata(options)().then(setNamedProvider);
|
|
34
|
+
},
|
|
35
|
+
Environment: async (options) => {
|
|
36
|
+
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
|
37
|
+
const { fromEnv } = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-env/dist-es/index.js"));
|
|
38
|
+
return async () => fromEnv(options)().then(setNamedProvider);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
if (credentialSource in sourceProvidersMap) {
|
|
42
|
+
return sourceProvidersMap[credentialSource];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw new config/* CredentialsProviderError */.C1(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, ` +
|
|
46
|
+
`expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const setNamedProvider = (creds) => (0,client/* setCredentialFeature */.gD)(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
50
|
+
|
|
51
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
|
56
|
+
return (Boolean(arg) &&
|
|
57
|
+
typeof arg === "object" &&
|
|
58
|
+
typeof arg.role_arn === "string" &&
|
|
59
|
+
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 &&
|
|
60
|
+
["undefined", "string"].indexOf(typeof arg.external_id) > -1 &&
|
|
61
|
+
["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 &&
|
|
62
|
+
(isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })));
|
|
63
|
+
};
|
|
64
|
+
const isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
|
|
65
|
+
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
66
|
+
if (withSourceProfile) {
|
|
67
|
+
logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
|
|
68
|
+
}
|
|
69
|
+
return withSourceProfile;
|
|
70
|
+
};
|
|
71
|
+
const isCredentialSourceProfile = (arg, { profile, logger }) => {
|
|
72
|
+
const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
|
73
|
+
if (withProviderProfile) {
|
|
74
|
+
logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
|
|
75
|
+
}
|
|
76
|
+
return withProviderProfile;
|
|
77
|
+
};
|
|
78
|
+
const resolveAssumeRoleCredentials = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, resolveProfileData) => {
|
|
79
|
+
options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
|
|
80
|
+
const profileData = profiles[profileName];
|
|
81
|
+
const { source_profile, region } = profileData;
|
|
82
|
+
if (!options.roleAssumer) {
|
|
83
|
+
const { getDefaultRoleAssumer } = 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"));
|
|
84
|
+
options.roleAssumer = getDefaultRoleAssumer({
|
|
85
|
+
...options.clientConfig,
|
|
86
|
+
credentialProviderLogger: options.logger,
|
|
87
|
+
parentClientConfig: {
|
|
88
|
+
...callerClientConfig,
|
|
89
|
+
...options?.parentClientConfig,
|
|
90
|
+
region: region ?? options?.parentClientConfig?.region ?? callerClientConfig?.region,
|
|
91
|
+
},
|
|
92
|
+
}, options.clientPlugins);
|
|
93
|
+
}
|
|
94
|
+
if (source_profile && source_profile in visitedProfiles) {
|
|
95
|
+
throw new config/* CredentialsProviderError */.C1(`Detected a cycle attempting to resolve credentials for profile` +
|
|
96
|
+
` ${(0,config/* getProfileName */.Bz)(options)}. Profiles visited: ` +
|
|
97
|
+
Object.keys(visitedProfiles).join(", "), { logger: options.logger });
|
|
98
|
+
}
|
|
99
|
+
options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
|
|
100
|
+
const sourceCredsProvider = source_profile
|
|
101
|
+
? resolveProfileData(source_profile, profiles, options, callerClientConfig, {
|
|
102
|
+
...visitedProfiles,
|
|
103
|
+
[source_profile]: true,
|
|
104
|
+
}, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {}))
|
|
105
|
+
: (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
|
|
106
|
+
if (isCredentialSourceWithoutRoleArn(profileData)) {
|
|
107
|
+
return sourceCredsProvider.then((creds) => (0,client/* setCredentialFeature */.gD)(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const params = {
|
|
111
|
+
RoleArn: profileData.role_arn,
|
|
112
|
+
RoleSessionName: profileData.role_session_name || `aws-sdk-js-${Date.now()}`,
|
|
113
|
+
ExternalId: profileData.external_id,
|
|
114
|
+
DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10),
|
|
115
|
+
};
|
|
116
|
+
const { mfa_serial } = profileData;
|
|
117
|
+
if (mfa_serial) {
|
|
118
|
+
if (!options.mfaCodeProvider) {
|
|
119
|
+
throw new config/* CredentialsProviderError */.C1(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
|
|
120
|
+
}
|
|
121
|
+
params.SerialNumber = mfa_serial;
|
|
122
|
+
params.TokenCode = await options.mfaCodeProvider(mfa_serial);
|
|
123
|
+
}
|
|
124
|
+
const sourceCreds = await sourceCredsProvider;
|
|
125
|
+
return options.roleAssumer(sourceCreds, params).then((creds) => (0,client/* setCredentialFeature */.gD)(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const isCredentialSourceWithoutRoleArn = (section) => {
|
|
129
|
+
return !section.role_arn && !!section.credential_source;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveLoginCredentials.js
|
|
133
|
+
|
|
134
|
+
const isLoginProfile = (data) => {
|
|
135
|
+
return Boolean(data && data.login_session);
|
|
136
|
+
};
|
|
137
|
+
const resolveLoginCredentials = async (profileName, options, callerClientConfig) => {
|
|
138
|
+
const { fromLoginCredentials } = await __webpack_require__.e(/* import() */ "node_modules_aws-sdk_credential-provider-login_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-login/dist-es/index.js"));
|
|
139
|
+
const credentials = await fromLoginCredentials({
|
|
140
|
+
...options,
|
|
141
|
+
profile: profileName,
|
|
142
|
+
})({ callerClientConfig });
|
|
143
|
+
return (0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js
|
|
147
|
+
|
|
148
|
+
const isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
|
|
149
|
+
const resolveProcessCredentials = async (options, profile) => {
|
|
150
|
+
const { fromProcess } = await __webpack_require__.e(/* import() */ "node_modules_aws-sdk_credential-provider-process_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-process/dist-es/index.js"));
|
|
151
|
+
const credentials = await fromProcess({
|
|
152
|
+
...options,
|
|
153
|
+
profile,
|
|
154
|
+
})();
|
|
155
|
+
return (0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_PROFILE_PROCESS", "v");
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveSsoCredentials.js
|
|
159
|
+
|
|
160
|
+
const resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {
|
|
161
|
+
const { fromSSO } = await __webpack_require__.e(/* import() */ "node_modules_aws-sdk_credential-provider-sso_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js"));
|
|
162
|
+
return fromSSO({
|
|
163
|
+
profile,
|
|
164
|
+
logger: options.logger,
|
|
165
|
+
parentClientConfig: options.parentClientConfig,
|
|
166
|
+
clientConfig: options.clientConfig,
|
|
167
|
+
})({
|
|
168
|
+
callerClientConfig,
|
|
169
|
+
}).then((creds) => {
|
|
170
|
+
if (profileData.sso_session) {
|
|
171
|
+
return (0,client/* setCredentialFeature */.gD)(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return (0,client/* setCredentialFeature */.gD)(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
const isSsoProfile = (arg) => arg &&
|
|
179
|
+
(typeof arg.sso_start_url === "string" ||
|
|
180
|
+
typeof arg.sso_account_id === "string" ||
|
|
181
|
+
typeof arg.sso_session === "string" ||
|
|
182
|
+
typeof arg.sso_region === "string" ||
|
|
183
|
+
typeof arg.sso_role_name === "string");
|
|
184
|
+
|
|
185
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveStaticCredentials.js
|
|
186
|
+
|
|
187
|
+
const isStaticCredsProfile = (arg) => Boolean(arg) &&
|
|
188
|
+
typeof arg === "object" &&
|
|
189
|
+
typeof arg.aws_access_key_id === "string" &&
|
|
190
|
+
typeof arg.aws_secret_access_key === "string" &&
|
|
191
|
+
["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 &&
|
|
192
|
+
["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1;
|
|
193
|
+
const resolveStaticCredentials = async (profile, options) => {
|
|
194
|
+
options?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
|
|
195
|
+
const credentials = {
|
|
196
|
+
accessKeyId: profile.aws_access_key_id,
|
|
197
|
+
secretAccessKey: profile.aws_secret_access_key,
|
|
198
|
+
sessionToken: profile.aws_session_token,
|
|
199
|
+
...(profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }),
|
|
200
|
+
...(profile.aws_account_id && { accountId: profile.aws_account_id }),
|
|
201
|
+
};
|
|
202
|
+
return (0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_PROFILE", "n");
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js
|
|
206
|
+
|
|
207
|
+
const isWebIdentityProfile = (arg) => Boolean(arg) &&
|
|
208
|
+
typeof arg === "object" &&
|
|
209
|
+
typeof arg.web_identity_token_file === "string" &&
|
|
210
|
+
typeof arg.role_arn === "string" &&
|
|
211
|
+
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
|
|
212
|
+
const resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => {
|
|
213
|
+
const { fromTokenFile } = await __webpack_require__.e(/* import() */ "node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js"));
|
|
214
|
+
const credentials = await fromTokenFile({
|
|
215
|
+
webIdentityTokenFile: profile.web_identity_token_file,
|
|
216
|
+
roleArn: profile.role_arn,
|
|
217
|
+
roleSessionName: profile.role_session_name,
|
|
218
|
+
roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
|
|
219
|
+
logger: options.logger,
|
|
220
|
+
parentClientConfig: options.parentClientConfig,
|
|
221
|
+
})({
|
|
222
|
+
callerClientConfig,
|
|
223
|
+
});
|
|
224
|
+
return (0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q");
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
const resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
|
|
236
|
+
const data = profiles[profileName];
|
|
237
|
+
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
|
238
|
+
return resolveStaticCredentials(data, options);
|
|
239
|
+
}
|
|
240
|
+
if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
|
|
241
|
+
return resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig, visitedProfiles, resolveProfileData);
|
|
242
|
+
}
|
|
243
|
+
if (isStaticCredsProfile(data)) {
|
|
244
|
+
return resolveStaticCredentials(data, options);
|
|
245
|
+
}
|
|
246
|
+
if (isWebIdentityProfile(data)) {
|
|
247
|
+
return resolveWebIdentityCredentials(data, options, callerClientConfig);
|
|
248
|
+
}
|
|
249
|
+
if (isProcessProfile(data)) {
|
|
250
|
+
return resolveProcessCredentials(options, profileName);
|
|
251
|
+
}
|
|
252
|
+
if (isSsoProfile(data)) {
|
|
253
|
+
return await resolveSsoCredentials(profileName, data, options, callerClientConfig);
|
|
254
|
+
}
|
|
255
|
+
if (isLoginProfile(data)) {
|
|
256
|
+
return resolveLoginCredentials(profileName, options, callerClientConfig);
|
|
257
|
+
}
|
|
258
|
+
throw new config/* CredentialsProviderError */.C1(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/fromIni.js
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
const fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
265
|
+
init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
|
|
266
|
+
const profiles = await (0,config/* parseKnownFiles */.YU)(init);
|
|
267
|
+
return resolveProfileData((0,config/* getProfileName */.Bz)({
|
|
268
|
+
profile: init.profile ?? callerClientConfig?.profile,
|
|
269
|
+
}), profiles, init, callerClientConfig);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
;// ./node_modules/@aws-sdk/credential-provider-ini/dist-es/index.js
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
/***/ }
|
|
277
|
+
|
|
278
|
+
};
|
|
279
|
+
;
|
|
280
|
+
//# sourceMappingURL=node_modules_aws-sdk_credential-provider-ini_dist-es_index_js.js.map
|