@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,437 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_smithy_credential-provider-imds_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_smithy_credential-provider-imds_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@smithy/credential-provider-imds/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
ENV_CMDS_FULL_URI: () => (/* reexport */ ENV_CMDS_FULL_URI),
|
|
13
|
+
ENV_CMDS_RELATIVE_URI: () => (/* reexport */ ENV_CMDS_RELATIVE_URI),
|
|
14
|
+
fromContainerMetadata: () => (/* reexport */ fromContainerMetadata),
|
|
15
|
+
fromInstanceMetadata: () => (/* reexport */ fromInstanceMetadata)
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// UNUSED EXPORTS: DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, ENV_CMDS_AUTH_TOKEN, Endpoint, getInstanceMetadataEndpoint, httpRequest, providerConfigFromInit
|
|
19
|
+
|
|
20
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/config/index.js + 49 modules
|
|
21
|
+
var config = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/config/index.js");
|
|
22
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/ImdsCredentials.js
|
|
23
|
+
const isImdsCredentials = (arg) => Boolean(arg) &&
|
|
24
|
+
typeof arg === "object" &&
|
|
25
|
+
typeof arg.AccessKeyId === "string" &&
|
|
26
|
+
typeof arg.SecretAccessKey === "string" &&
|
|
27
|
+
typeof arg.Token === "string" &&
|
|
28
|
+
typeof arg.Expiration === "string";
|
|
29
|
+
const fromImdsCredentials = (creds) => ({
|
|
30
|
+
accessKeyId: creds.AccessKeyId,
|
|
31
|
+
secretAccessKey: creds.SecretAccessKey,
|
|
32
|
+
sessionToken: creds.Token,
|
|
33
|
+
expiration: new Date(creds.Expiration),
|
|
34
|
+
...(creds.AccountId && { accountId: creds.AccountId }),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/RemoteProviderInit.js
|
|
38
|
+
const DEFAULT_TIMEOUT = 1000;
|
|
39
|
+
const DEFAULT_MAX_RETRIES = 0;
|
|
40
|
+
const providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT, }) => ({ maxRetries, timeout });
|
|
41
|
+
|
|
42
|
+
// EXTERNAL MODULE: external "node:http"
|
|
43
|
+
var external_node_http_ = __webpack_require__("node:http");
|
|
44
|
+
var external_node_http_default = /*#__PURE__*/__webpack_require__.n(external_node_http_);
|
|
45
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
function httpRequest(options) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
const req = external_node_http_default().request({
|
|
55
|
+
method: "GET",
|
|
56
|
+
...options,
|
|
57
|
+
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1"),
|
|
58
|
+
});
|
|
59
|
+
req.on("error", (err) => {
|
|
60
|
+
reject(Object.assign(new config/* ProviderError */.mZ("Unable to connect to instance metadata service"), err));
|
|
61
|
+
req.destroy();
|
|
62
|
+
});
|
|
63
|
+
req.on("timeout", () => {
|
|
64
|
+
reject(new config/* ProviderError */.mZ("TimeoutError from instance metadata service"));
|
|
65
|
+
req.destroy();
|
|
66
|
+
});
|
|
67
|
+
req.on("response", (res) => {
|
|
68
|
+
const { statusCode = 400 } = res;
|
|
69
|
+
if (statusCode < 200 || 300 <= statusCode) {
|
|
70
|
+
reject(Object.assign(new config/* ProviderError */.mZ("Error response received from instance metadata service"), { statusCode }));
|
|
71
|
+
req.destroy();
|
|
72
|
+
}
|
|
73
|
+
const chunks = [];
|
|
74
|
+
res.on("data", (chunk) => {
|
|
75
|
+
chunks.push(chunk);
|
|
76
|
+
});
|
|
77
|
+
res.on("end", () => {
|
|
78
|
+
resolve(Buffer.concat(chunks));
|
|
79
|
+
req.destroy();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
req.end();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/retry.js
|
|
87
|
+
const retry = (toRetry, maxRetries) => {
|
|
88
|
+
let promise = toRetry();
|
|
89
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
90
|
+
promise = promise.catch(toRetry);
|
|
91
|
+
}
|
|
92
|
+
return promise;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/fromContainerMetadata.js
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
const ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
|
102
|
+
const ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
|
103
|
+
const ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
|
104
|
+
const fromContainerMetadata = (init = {}) => {
|
|
105
|
+
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
106
|
+
return () => retry(async () => {
|
|
107
|
+
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
108
|
+
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
|
109
|
+
if (!isImdsCredentials(credsResponse)) {
|
|
110
|
+
throw new config/* CredentialsProviderError */.C1("Invalid response received from instance metadata service.", {
|
|
111
|
+
logger: init.logger,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return fromImdsCredentials(credsResponse);
|
|
115
|
+
}, maxRetries);
|
|
116
|
+
};
|
|
117
|
+
const requestFromEcsImds = async (timeout, options) => {
|
|
118
|
+
if (process.env[ENV_CMDS_AUTH_TOKEN]) {
|
|
119
|
+
options.headers = {
|
|
120
|
+
...options.headers,
|
|
121
|
+
Authorization: process.env[ENV_CMDS_AUTH_TOKEN],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const buffer = await httpRequest({
|
|
125
|
+
...options,
|
|
126
|
+
timeout,
|
|
127
|
+
});
|
|
128
|
+
return buffer.toString();
|
|
129
|
+
};
|
|
130
|
+
const CMDS_IP = "169.254.170.2";
|
|
131
|
+
const GREENGRASS_HOSTS = new Set(["localhost", "127.0.0.1"]);
|
|
132
|
+
const GREENGRASS_PROTOCOLS = new Set(["http:", "https:"]);
|
|
133
|
+
const getCmdsUri = async ({ logger }) => {
|
|
134
|
+
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
|
135
|
+
return {
|
|
136
|
+
hostname: CMDS_IP,
|
|
137
|
+
path: process.env[ENV_CMDS_RELATIVE_URI],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (process.env[ENV_CMDS_FULL_URI]) {
|
|
141
|
+
let parsed;
|
|
142
|
+
try {
|
|
143
|
+
parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
throw new config/* CredentialsProviderError */.C1(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
|
|
147
|
+
}
|
|
148
|
+
if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
|
|
149
|
+
throw new config/* CredentialsProviderError */.C1(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
150
|
+
tryNextLink: false,
|
|
151
|
+
logger,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
|
|
155
|
+
throw new config/* CredentialsProviderError */.C1(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
156
|
+
tryNextLink: false,
|
|
157
|
+
logger,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
protocol: parsed.protocol,
|
|
162
|
+
hostname: parsed.hostname,
|
|
163
|
+
path: parsed.pathname + parsed.search,
|
|
164
|
+
port: parsed.port ? parseInt(parsed.port, 10) : undefined,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
throw new config/* CredentialsProviderError */.C1("The container metadata credential provider cannot be used unless" +
|
|
168
|
+
` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` +
|
|
169
|
+
" variable is set", {
|
|
170
|
+
tryNextLink: false,
|
|
171
|
+
logger,
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js
|
|
176
|
+
|
|
177
|
+
class InstanceMetadataV1FallbackError extends config/* CredentialsProviderError */.C1 {
|
|
178
|
+
tryNextLink;
|
|
179
|
+
name = "InstanceMetadataV1FallbackError";
|
|
180
|
+
constructor(message, tryNextLink = true) {
|
|
181
|
+
super(message, tryNextLink);
|
|
182
|
+
this.tryNextLink = tryNextLink;
|
|
183
|
+
Object.setPrototypeOf(this, InstanceMetadataV1FallbackError.prototype);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// EXTERNAL MODULE: ./node_modules/@smithy/core/dist-es/submodules/protocols/index.js + 20 modules
|
|
188
|
+
var protocols = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/protocols/index.js");
|
|
189
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/config/Endpoint.js
|
|
190
|
+
var Endpoint;
|
|
191
|
+
(function (Endpoint) {
|
|
192
|
+
Endpoint["IPv4"] = "http://169.254.169.254";
|
|
193
|
+
Endpoint["IPv6"] = "http://[fd00:ec2::254]";
|
|
194
|
+
})(Endpoint || (Endpoint = {}));
|
|
195
|
+
|
|
196
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointConfigOptions.js
|
|
197
|
+
const ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
|
198
|
+
const CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
|
199
|
+
const ENDPOINT_CONFIG_OPTIONS = {
|
|
200
|
+
environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],
|
|
201
|
+
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
|
|
202
|
+
default: undefined,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointMode.js
|
|
206
|
+
var EndpointMode;
|
|
207
|
+
(function (EndpointMode) {
|
|
208
|
+
EndpointMode["IPv4"] = "IPv4";
|
|
209
|
+
EndpointMode["IPv6"] = "IPv6";
|
|
210
|
+
})(EndpointMode || (EndpointMode = {}));
|
|
211
|
+
|
|
212
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointModeConfigOptions.js
|
|
213
|
+
|
|
214
|
+
const ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
|
|
215
|
+
const CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
|
|
216
|
+
const ENDPOINT_MODE_CONFIG_OPTIONS = {
|
|
217
|
+
environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],
|
|
218
|
+
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
|
|
219
|
+
default: EndpointMode.IPv4,
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/utils/getInstanceMetadataEndpoint.js
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
const getInstanceMetadataEndpoint = async () => (0,protocols/* parseUrl */.Dl)((await getFromEndpointConfig()) || (await getFromEndpointModeConfig()));
|
|
230
|
+
const getFromEndpointConfig = async () => (0,config/* loadConfig */.Z9)(ENDPOINT_CONFIG_OPTIONS)();
|
|
231
|
+
const getFromEndpointModeConfig = async () => {
|
|
232
|
+
const endpointMode = await (0,config/* loadConfig */.Z9)(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
233
|
+
switch (endpointMode) {
|
|
234
|
+
case EndpointMode.IPv4:
|
|
235
|
+
return Endpoint.IPv4;
|
|
236
|
+
case EndpointMode.IPv6:
|
|
237
|
+
return Endpoint.IPv6;
|
|
238
|
+
default:
|
|
239
|
+
throw new Error(`Unsupported endpoint mode: ${endpointMode}.` + ` Select from ${Object.values(EndpointMode)}`);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/utils/getExtendedInstanceMetadataCredentials.js
|
|
244
|
+
const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
|
245
|
+
const STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
|
246
|
+
const STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
|
247
|
+
const getExtendedInstanceMetadataCredentials = (credentials, logger) => {
|
|
248
|
+
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS +
|
|
249
|
+
Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
|
250
|
+
const newExpiration = new Date(Date.now() + refreshInterval * 1000);
|
|
251
|
+
logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these " +
|
|
252
|
+
`credentials will be attempted after ${new Date(newExpiration)}.\nFor more information, please visit: ` +
|
|
253
|
+
STATIC_STABILITY_DOC_URL);
|
|
254
|
+
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
|
255
|
+
return {
|
|
256
|
+
...credentials,
|
|
257
|
+
...(originalExpiration ? { originalExpiration } : {}),
|
|
258
|
+
expiration: newExpiration,
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/utils/staticStabilityProvider.js
|
|
263
|
+
|
|
264
|
+
const staticStabilityProvider = (provider, options = {}) => {
|
|
265
|
+
const logger = options?.logger || console;
|
|
266
|
+
let pastCredentials;
|
|
267
|
+
return async () => {
|
|
268
|
+
let credentials;
|
|
269
|
+
try {
|
|
270
|
+
credentials = await provider();
|
|
271
|
+
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
|
272
|
+
credentials = getExtendedInstanceMetadataCredentials(credentials, logger);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch (e) {
|
|
276
|
+
if (pastCredentials) {
|
|
277
|
+
logger.warn("Credential renew failed: ", e);
|
|
278
|
+
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
throw e;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
pastCredentials = credentials;
|
|
285
|
+
return credentials;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/fromInstanceMetadata.js
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
const IMDS_PATH = "/latest/meta-data/iam/security-credentials/";
|
|
299
|
+
const IMDS_TOKEN_PATH = "/latest/api/token";
|
|
300
|
+
const AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED";
|
|
301
|
+
const PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled";
|
|
302
|
+
const X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
|
|
303
|
+
const fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger });
|
|
304
|
+
const getInstanceMetadataProvider = (init = {}) => {
|
|
305
|
+
let disableFetchToken = false;
|
|
306
|
+
const { logger, profile } = init;
|
|
307
|
+
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
308
|
+
const getCredentials = async (maxRetries, options) => {
|
|
309
|
+
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
|
310
|
+
if (isImdsV1Fallback) {
|
|
311
|
+
let fallbackBlockedFromProfile = false;
|
|
312
|
+
let fallbackBlockedFromProcessEnv = false;
|
|
313
|
+
const configValue = await (0,config/* loadConfig */.Z9)({
|
|
314
|
+
environmentVariableSelector: (env) => {
|
|
315
|
+
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
316
|
+
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
317
|
+
if (envValue === undefined) {
|
|
318
|
+
throw new config/* CredentialsProviderError */.C1(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
319
|
+
}
|
|
320
|
+
return fallbackBlockedFromProcessEnv;
|
|
321
|
+
},
|
|
322
|
+
configFileSelector: (profile) => {
|
|
323
|
+
const profileValue = profile[PROFILE_AWS_EC2_METADATA_V1_DISABLED];
|
|
324
|
+
fallbackBlockedFromProfile = !!profileValue && profileValue !== "false";
|
|
325
|
+
return fallbackBlockedFromProfile;
|
|
326
|
+
},
|
|
327
|
+
default: false,
|
|
328
|
+
}, {
|
|
329
|
+
profile,
|
|
330
|
+
})();
|
|
331
|
+
if (init.ec2MetadataV1Disabled || configValue) {
|
|
332
|
+
const causes = [];
|
|
333
|
+
if (init.ec2MetadataV1Disabled)
|
|
334
|
+
causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");
|
|
335
|
+
if (fallbackBlockedFromProfile)
|
|
336
|
+
causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);
|
|
337
|
+
if (fallbackBlockedFromProcessEnv)
|
|
338
|
+
causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);
|
|
339
|
+
throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(", ")}].`);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const imdsProfile = (await retry(async () => {
|
|
343
|
+
let profile;
|
|
344
|
+
try {
|
|
345
|
+
profile = await getProfile(options);
|
|
346
|
+
}
|
|
347
|
+
catch (err) {
|
|
348
|
+
if (err.statusCode === 401) {
|
|
349
|
+
disableFetchToken = false;
|
|
350
|
+
}
|
|
351
|
+
throw err;
|
|
352
|
+
}
|
|
353
|
+
return profile;
|
|
354
|
+
}, maxRetries)).trim();
|
|
355
|
+
return retry(async () => {
|
|
356
|
+
let creds;
|
|
357
|
+
try {
|
|
358
|
+
creds = await getCredentialsFromProfile(imdsProfile, options, init);
|
|
359
|
+
}
|
|
360
|
+
catch (err) {
|
|
361
|
+
if (err.statusCode === 401) {
|
|
362
|
+
disableFetchToken = false;
|
|
363
|
+
}
|
|
364
|
+
throw err;
|
|
365
|
+
}
|
|
366
|
+
return creds;
|
|
367
|
+
}, maxRetries);
|
|
368
|
+
};
|
|
369
|
+
return async () => {
|
|
370
|
+
const endpoint = await getInstanceMetadataEndpoint();
|
|
371
|
+
if (disableFetchToken) {
|
|
372
|
+
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
|
373
|
+
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
let token;
|
|
377
|
+
try {
|
|
378
|
+
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
if (error?.statusCode === 400) {
|
|
382
|
+
throw Object.assign(error, {
|
|
383
|
+
message: "EC2 Metadata token request returned error",
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
|
387
|
+
disableFetchToken = true;
|
|
388
|
+
}
|
|
389
|
+
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
390
|
+
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
391
|
+
}
|
|
392
|
+
return getCredentials(maxRetries, {
|
|
393
|
+
...endpoint,
|
|
394
|
+
headers: {
|
|
395
|
+
[X_AWS_EC2_METADATA_TOKEN]: token,
|
|
396
|
+
},
|
|
397
|
+
timeout,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
const getMetadataToken = async (options) => httpRequest({
|
|
403
|
+
...options,
|
|
404
|
+
path: IMDS_TOKEN_PATH,
|
|
405
|
+
method: "PUT",
|
|
406
|
+
headers: {
|
|
407
|
+
"x-aws-ec2-metadata-token-ttl-seconds": "21600",
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
const getProfile = async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString();
|
|
411
|
+
const getCredentialsFromProfile = async (profile, options, init) => {
|
|
412
|
+
const credentialsResponse = JSON.parse((await httpRequest({
|
|
413
|
+
...options,
|
|
414
|
+
path: IMDS_PATH + profile,
|
|
415
|
+
})).toString());
|
|
416
|
+
if (!isImdsCredentials(credentialsResponse)) {
|
|
417
|
+
throw new config/* CredentialsProviderError */.C1("Invalid response received from instance metadata service.", {
|
|
418
|
+
logger: init.logger,
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
return fromImdsCredentials(credentialsResponse);
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
;// ./node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
/***/ }
|
|
434
|
+
|
|
435
|
+
};
|
|
436
|
+
;
|
|
437
|
+
//# sourceMappingURL=node_modules_smithy_credential-provider-imds_dist-es_index_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_smithy_credential-provider-imds_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,6BAA6B,4BAA4B;AACzD,CAAC;;;ACZM;AACA;AACA,kCAAkC,8DAA8D,QAAQ,qBAAqB;;;;;;ACFlG;AACb;;;ACD+B;AACZ;AACjC;AACP;AACA,oBAAoB,4BAAS;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA,qCAAqC,4BAAa;AAClD;AACA,SAAS;AACT;AACA,uBAAuB,4BAAa;AACpC;AACA,SAAS;AACT;AACA,oBAAoB,mBAAmB;AACvC;AACA,yCAAyC,4BAAa,8DAA8D,YAAY;AAChI;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,KAAK;AACL;;;AClCO;AACP;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;;;ACN+D;AAC2B;AACb;AAClB;AACZ;AACxC;AACA;AACA;AACA,wCAAwC;AAC/C,YAAY,sBAAsB,EAAE,sBAAsB;AAC1D,iBAAiB,KAAK;AACtB,kDAAkD,qBAAqB;AACvE;AACA,aAAa,iBAAiB;AAC9B,sBAAsB,uCAAwB;AAC9C;AACA,aAAa;AACb;AACA,eAAe,mBAAmB;AAClC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,4BAA4B,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uCAAwB,IAAI,gCAAgC,kDAAkD,4BAA4B;AAChK;AACA;AACA,sBAAsB,uCAAwB,IAAI,iBAAiB;AACnE;AACA;AACA,aAAa;AACb;AACA;AACA,sBAAsB,uCAAwB,IAAI,iBAAiB;AACnE;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,uCAAwB;AACtC,gBAAgB,uBAAuB,KAAK,mBAAmB;AAC/D;AACA;AACA;AACA,KAAK;AACL;;;AC7E+D;AACxD,8CAA8C,uCAAwB;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACTO;AACP;AACA;AACA;AACA,CAAC,4BAA4B;;;ACJtB;AACA;AACA;AACP;AACA;AACA;AACA;;;ACNO;AACP;AACA;AACA;AACA,CAAC,oCAAoC;;;ACJS;AACvC;AACA;AACA;AACP;AACA;AACA,aAAa,YAAY;AACzB;;;ACPiD;AACC;AACwB;AACA;AACpB;AAC8B;AAC7E,gDAAgD,8BAAQ;AAC/D,0CAA0C,6BAAU,CAAC,uBAAuB;AAC5E;AACA,+BAA+B,6BAAU,CAAC,4BAA4B;AACtE;AACA,aAAa,YAAY;AACzB,mBAAmB,QAAwB;AAC3C,aAAa,YAAY;AACzB,mBAAmB,QAAwB;AAC3C;AACA,0DAA0D,aAAa,qBAAqB,cAAc,YAAY,EAAE;AACxH;AACA;;;AClBA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,+CAA+C,wBAAwB;AACvE;AACA;AACA;AACA;AACA,mCAAmC,qBAAqB,IAAI;AAC5D;AACA;AACA;;;AChBkG;AAC3F,uDAAuD;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,sCAAsC;AACpE;AACA;AACA;AACA;AACA;AACA,8BAA8B,sCAAsC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACxB2E;AACe;AACA;AACb;AAClB;AACZ;AACmC;AACR;AAC1E;AACA;AACA;AACA;AACA;AACO,uCAAuC,KAAK,uBAAuB,sCAAsC,qBAAqB;AACrI,8CAA8C;AAC9C;AACA,YAAY,kBAAkB;AAC9B,YAAY,sBAAsB,EAAE,sBAAsB;AAC1D;AACA;AACA;AACA;AACA;AACA,sCAAsC,6BAAU;AAChD;AACA;AACA;AACA;AACA,kCAAkC,uCAAwB,IAAI,8BAA8B,+CAA+C,qBAAqB;AAChK;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,wDAAwD,qCAAqC;AAC7F;AACA,iEAAiE,6BAA6B;AAC9F,0BAA0B,+BAA+B,8FAA8F,kBAAkB;AACzK;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,2BAA2B;AAC1D;AACA;AACA,gDAAgD,sBAAsB;AACtE;AACA;AACA;AACA;AACA,kDAAkD,sBAAsB;AACxE;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,oDAAoD,sBAAsB;AAC1E;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA,4CAA4C,WAAW;AACvD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AACD,6CAA6C,WAAW,GAAG,6BAA6B;AACxF;AACA,kDAAkD,WAAW;AAC7D;AACA;AACA,KAAK;AACL,SAAS,iBAAiB;AAC1B,kBAAkB,uCAAwB;AAC1C;AACA,SAAS;AACT;AACA,WAAW,mBAAmB;AAC9B;;;ACpIgI;AAClE;AACqD;AACxD;AACuB;AACrC","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/ImdsCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/RemoteProviderInit.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/retry.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/fromContainerMetadata.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/config/Endpoint.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointConfigOptions.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointMode.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointModeConfigOptions.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/utils/getInstanceMetadataEndpoint.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/utils/getExtendedInstanceMetadataCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/utils/staticStabilityProvider.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/fromInstanceMetadata.js","webpack://@aws/cloudformation-languageserver/./node_modules/@smithy/credential-provider-imds/dist-es/index.js"],"sourcesContent":["export const isImdsCredentials = (arg) => Boolean(arg) &&\n typeof arg === \"object\" &&\n typeof arg.AccessKeyId === \"string\" &&\n typeof arg.SecretAccessKey === \"string\" &&\n typeof arg.Token === \"string\" &&\n typeof arg.Expiration === \"string\";\nexport const fromImdsCredentials = (creds) => ({\n accessKeyId: creds.AccessKeyId,\n secretAccessKey: creds.SecretAccessKey,\n sessionToken: creds.Token,\n expiration: new Date(creds.Expiration),\n ...(creds.AccountId && { accountId: creds.AccountId }),\n});\n","export const DEFAULT_TIMEOUT = 1000;\nexport const DEFAULT_MAX_RETRIES = 0;\nexport const providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT, }) => ({ maxRetries, timeout });\n","import node_http from \"node:http\";\nexport { node_http };\n","import { ProviderError } from \"@smithy/core/config\";\nimport { node_http } from \"./node-http\";\nexport function httpRequest(options) {\n return new Promise((resolve, reject) => {\n const req = node_http.request({\n method: \"GET\",\n ...options,\n hostname: options.hostname?.replace(/^\\[(.+)\\]$/, \"$1\"),\n });\n req.on(\"error\", (err) => {\n reject(Object.assign(new ProviderError(\"Unable to connect to instance metadata service\"), err));\n req.destroy();\n });\n req.on(\"timeout\", () => {\n reject(new ProviderError(\"TimeoutError from instance metadata service\"));\n req.destroy();\n });\n req.on(\"response\", (res) => {\n const { statusCode = 400 } = res;\n if (statusCode < 200 || 300 <= statusCode) {\n reject(Object.assign(new ProviderError(\"Error response received from instance metadata service\"), { statusCode }));\n req.destroy();\n }\n const chunks = [];\n res.on(\"data\", (chunk) => {\n chunks.push(chunk);\n });\n res.on(\"end\", () => {\n resolve(Buffer.concat(chunks));\n req.destroy();\n });\n });\n req.end();\n });\n}\n","export const retry = (toRetry, maxRetries) => {\n let promise = toRetry();\n for (let i = 0; i < maxRetries; i++) {\n promise = promise.catch(toRetry);\n }\n return promise;\n};\n","import { CredentialsProviderError } from \"@smithy/core/config\";\nimport { fromImdsCredentials, isImdsCredentials } from \"./remoteProvider/ImdsCredentials\";\nimport { providerConfigFromInit } from \"./remoteProvider/RemoteProviderInit\";\nimport { httpRequest } from \"./remoteProvider/httpRequest\";\nimport { retry } from \"./remoteProvider/retry\";\nexport const ENV_CMDS_FULL_URI = \"AWS_CONTAINER_CREDENTIALS_FULL_URI\";\nexport const ENV_CMDS_RELATIVE_URI = \"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\";\nexport const ENV_CMDS_AUTH_TOKEN = \"AWS_CONTAINER_AUTHORIZATION_TOKEN\";\nexport const fromContainerMetadata = (init = {}) => {\n const { timeout, maxRetries } = providerConfigFromInit(init);\n return () => retry(async () => {\n const requestOptions = await getCmdsUri({ logger: init.logger });\n const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));\n if (!isImdsCredentials(credsResponse)) {\n throw new CredentialsProviderError(\"Invalid response received from instance metadata service.\", {\n logger: init.logger,\n });\n }\n return fromImdsCredentials(credsResponse);\n }, maxRetries);\n};\nconst requestFromEcsImds = async (timeout, options) => {\n if (process.env[ENV_CMDS_AUTH_TOKEN]) {\n options.headers = {\n ...options.headers,\n Authorization: process.env[ENV_CMDS_AUTH_TOKEN],\n };\n }\n const buffer = await httpRequest({\n ...options,\n timeout,\n });\n return buffer.toString();\n};\nconst CMDS_IP = \"169.254.170.2\";\nconst GREENGRASS_HOSTS = new Set([\"localhost\", \"127.0.0.1\"]);\nconst GREENGRASS_PROTOCOLS = new Set([\"http:\", \"https:\"]);\nconst getCmdsUri = async ({ logger }) => {\n if (process.env[ENV_CMDS_RELATIVE_URI]) {\n return {\n hostname: CMDS_IP,\n path: process.env[ENV_CMDS_RELATIVE_URI],\n };\n }\n if (process.env[ENV_CMDS_FULL_URI]) {\n let parsed;\n try {\n parsed = new URL(process.env[ENV_CMDS_FULL_URI]);\n }\n catch {\n throw new CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });\n }\n if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {\n throw new CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {\n tryNextLink: false,\n logger,\n });\n }\n if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {\n throw new CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {\n tryNextLink: false,\n logger,\n });\n }\n return {\n protocol: parsed.protocol,\n hostname: parsed.hostname,\n path: parsed.pathname + parsed.search,\n port: parsed.port ? parseInt(parsed.port, 10) : undefined,\n };\n }\n throw new CredentialsProviderError(\"The container metadata credential provider cannot be used unless\" +\n ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` +\n \" variable is set\", {\n tryNextLink: false,\n logger,\n });\n};\n","import { CredentialsProviderError } from \"@smithy/core/config\";\nexport class InstanceMetadataV1FallbackError extends CredentialsProviderError {\n tryNextLink;\n name = \"InstanceMetadataV1FallbackError\";\n constructor(message, tryNextLink = true) {\n super(message, tryNextLink);\n this.tryNextLink = tryNextLink;\n Object.setPrototypeOf(this, InstanceMetadataV1FallbackError.prototype);\n }\n}\n","export var Endpoint;\n(function (Endpoint) {\n Endpoint[\"IPv4\"] = \"http://169.254.169.254\";\n Endpoint[\"IPv6\"] = \"http://[fd00:ec2::254]\";\n})(Endpoint || (Endpoint = {}));\n","export const ENV_ENDPOINT_NAME = \"AWS_EC2_METADATA_SERVICE_ENDPOINT\";\nexport const CONFIG_ENDPOINT_NAME = \"ec2_metadata_service_endpoint\";\nexport const ENDPOINT_CONFIG_OPTIONS = {\n environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],\n configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],\n default: undefined,\n};\n","export var EndpointMode;\n(function (EndpointMode) {\n EndpointMode[\"IPv4\"] = \"IPv4\";\n EndpointMode[\"IPv6\"] = \"IPv6\";\n})(EndpointMode || (EndpointMode = {}));\n","import { EndpointMode } from \"./EndpointMode\";\nexport const ENV_ENDPOINT_MODE_NAME = \"AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE\";\nexport const CONFIG_ENDPOINT_MODE_NAME = \"ec2_metadata_service_endpoint_mode\";\nexport const ENDPOINT_MODE_CONFIG_OPTIONS = {\n environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],\n configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],\n default: EndpointMode.IPv4,\n};\n","import { loadConfig } from \"@smithy/core/config\";\nimport { parseUrl } from \"@smithy/core/protocols\";\nimport { Endpoint as InstanceMetadataEndpoint } from \"../config/Endpoint\";\nimport { ENDPOINT_CONFIG_OPTIONS } from \"../config/EndpointConfigOptions\";\nimport { EndpointMode } from \"../config/EndpointMode\";\nimport { ENDPOINT_MODE_CONFIG_OPTIONS, } from \"../config/EndpointModeConfigOptions\";\nexport const getInstanceMetadataEndpoint = async () => parseUrl((await getFromEndpointConfig()) || (await getFromEndpointModeConfig()));\nconst getFromEndpointConfig = async () => loadConfig(ENDPOINT_CONFIG_OPTIONS)();\nconst getFromEndpointModeConfig = async () => {\n const endpointMode = await loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();\n switch (endpointMode) {\n case EndpointMode.IPv4:\n return InstanceMetadataEndpoint.IPv4;\n case EndpointMode.IPv6:\n return InstanceMetadataEndpoint.IPv6;\n default:\n throw new Error(`Unsupported endpoint mode: ${endpointMode}.` + ` Select from ${Object.values(EndpointMode)}`);\n }\n};\n","const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;\nconst STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;\nconst STATIC_STABILITY_DOC_URL = \"https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html\";\nexport const getExtendedInstanceMetadataCredentials = (credentials, logger) => {\n const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS +\n Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);\n const newExpiration = new Date(Date.now() + refreshInterval * 1000);\n logger.warn(\"Attempting credential expiration extension due to a credential service availability issue. A refresh of these \" +\n `credentials will be attempted after ${new Date(newExpiration)}.\\nFor more information, please visit: ` +\n STATIC_STABILITY_DOC_URL);\n const originalExpiration = credentials.originalExpiration ?? credentials.expiration;\n return {\n ...credentials,\n ...(originalExpiration ? { originalExpiration } : {}),\n expiration: newExpiration,\n };\n};\n","import { getExtendedInstanceMetadataCredentials } from \"./getExtendedInstanceMetadataCredentials\";\nexport const staticStabilityProvider = (provider, options = {}) => {\n const logger = options?.logger || console;\n let pastCredentials;\n return async () => {\n let credentials;\n try {\n credentials = await provider();\n if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {\n credentials = getExtendedInstanceMetadataCredentials(credentials, logger);\n }\n }\n catch (e) {\n if (pastCredentials) {\n logger.warn(\"Credential renew failed: \", e);\n credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);\n }\n else {\n throw e;\n }\n }\n pastCredentials = credentials;\n return credentials;\n };\n};\n","import { CredentialsProviderError, loadConfig } from \"@smithy/core/config\";\nimport { InstanceMetadataV1FallbackError } from \"./error/InstanceMetadataV1FallbackError\";\nimport { fromImdsCredentials, isImdsCredentials } from \"./remoteProvider/ImdsCredentials\";\nimport { providerConfigFromInit } from \"./remoteProvider/RemoteProviderInit\";\nimport { httpRequest } from \"./remoteProvider/httpRequest\";\nimport { retry } from \"./remoteProvider/retry\";\nimport { getInstanceMetadataEndpoint } from \"./utils/getInstanceMetadataEndpoint\";\nimport { staticStabilityProvider } from \"./utils/staticStabilityProvider\";\nconst IMDS_PATH = \"/latest/meta-data/iam/security-credentials/\";\nconst IMDS_TOKEN_PATH = \"/latest/api/token\";\nconst AWS_EC2_METADATA_V1_DISABLED = \"AWS_EC2_METADATA_V1_DISABLED\";\nconst PROFILE_AWS_EC2_METADATA_V1_DISABLED = \"ec2_metadata_v1_disabled\";\nconst X_AWS_EC2_METADATA_TOKEN = \"x-aws-ec2-metadata-token\";\nexport const fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger });\nconst getInstanceMetadataProvider = (init = {}) => {\n let disableFetchToken = false;\n const { logger, profile } = init;\n const { timeout, maxRetries } = providerConfigFromInit(init);\n const getCredentials = async (maxRetries, options) => {\n const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;\n if (isImdsV1Fallback) {\n let fallbackBlockedFromProfile = false;\n let fallbackBlockedFromProcessEnv = false;\n const configValue = await loadConfig({\n environmentVariableSelector: (env) => {\n const envValue = env[AWS_EC2_METADATA_V1_DISABLED];\n fallbackBlockedFromProcessEnv = !!envValue && envValue !== \"false\";\n if (envValue === undefined) {\n throw new CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });\n }\n return fallbackBlockedFromProcessEnv;\n },\n configFileSelector: (profile) => {\n const profileValue = profile[PROFILE_AWS_EC2_METADATA_V1_DISABLED];\n fallbackBlockedFromProfile = !!profileValue && profileValue !== \"false\";\n return fallbackBlockedFromProfile;\n },\n default: false,\n }, {\n profile,\n })();\n if (init.ec2MetadataV1Disabled || configValue) {\n const causes = [];\n if (init.ec2MetadataV1Disabled)\n causes.push(\"credential provider initialization (runtime option ec2MetadataV1Disabled)\");\n if (fallbackBlockedFromProfile)\n causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);\n if (fallbackBlockedFromProcessEnv)\n causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);\n throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(\", \")}].`);\n }\n }\n const imdsProfile = (await retry(async () => {\n let profile;\n try {\n profile = await getProfile(options);\n }\n catch (err) {\n if (err.statusCode === 401) {\n disableFetchToken = false;\n }\n throw err;\n }\n return profile;\n }, maxRetries)).trim();\n return retry(async () => {\n let creds;\n try {\n creds = await getCredentialsFromProfile(imdsProfile, options, init);\n }\n catch (err) {\n if (err.statusCode === 401) {\n disableFetchToken = false;\n }\n throw err;\n }\n return creds;\n }, maxRetries);\n };\n return async () => {\n const endpoint = await getInstanceMetadataEndpoint();\n if (disableFetchToken) {\n logger?.debug(\"AWS SDK Instance Metadata\", \"using v1 fallback (no token fetch)\");\n return getCredentials(maxRetries, { ...endpoint, timeout });\n }\n else {\n let token;\n try {\n token = (await getMetadataToken({ ...endpoint, timeout })).toString();\n }\n catch (error) {\n if (error?.statusCode === 400) {\n throw Object.assign(error, {\n message: \"EC2 Metadata token request returned error\",\n });\n }\n else if (error.message === \"TimeoutError\" || [403, 404, 405].includes(error.statusCode)) {\n disableFetchToken = true;\n }\n logger?.debug(\"AWS SDK Instance Metadata\", \"using v1 fallback (initial)\");\n return getCredentials(maxRetries, { ...endpoint, timeout });\n }\n return getCredentials(maxRetries, {\n ...endpoint,\n headers: {\n [X_AWS_EC2_METADATA_TOKEN]: token,\n },\n timeout,\n });\n }\n };\n};\nconst getMetadataToken = async (options) => httpRequest({\n ...options,\n path: IMDS_TOKEN_PATH,\n method: \"PUT\",\n headers: {\n \"x-aws-ec2-metadata-token-ttl-seconds\": \"21600\",\n },\n});\nconst getProfile = async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString();\nconst getCredentialsFromProfile = async (profile, options, init) => {\n const credentialsResponse = JSON.parse((await httpRequest({\n ...options,\n path: IMDS_PATH + profile,\n })).toString());\n if (!isImdsCredentials(credentialsResponse)) {\n throw new CredentialsProviderError(\"Invalid response received from instance metadata service.\", {\n logger: init.logger,\n });\n }\n return fromImdsCredentials(credentialsResponse);\n};\n","export { ENV_CMDS_AUTH_TOKEN, ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, } from \"./fromContainerMetadata\";\nexport { fromInstanceMetadata } from \"./fromInstanceMetadata\";\nexport { DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, providerConfigFromInit } from \"./remoteProvider/RemoteProviderInit\";\nexport { httpRequest } from \"./remoteProvider/httpRequest\";\nexport { getInstanceMetadataEndpoint } from \"./utils/getInstanceMetadataEndpoint\";\nexport { Endpoint } from \"./config/Endpoint\";\n"],"names":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,12 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/cloudformation-languageserver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "AWS CloudFormation Language Server",
|
|
5
|
+
"publisher": "aws",
|
|
5
6
|
"license": "Apache-2.0",
|
|
6
|
-
"author": {
|
|
7
|
-
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Amazon Web Services",
|
|
9
|
+
"url": "https://aws.amazon.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/aws-cloudformation/cloudformation-languageserver"
|
|
14
|
+
},
|
|
8
15
|
"homepage": "https://github.com/aws-cloudformation/cloudformation-languageserver#readme",
|
|
9
|
-
"bugs": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/aws-cloudformation/cloudformation-languageserver/issues"
|
|
18
|
+
},
|
|
19
|
+
"main": "./cfn-lsp-server-standalone.js",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"Amazon Web Services (AWS)",
|
|
25
|
+
"Amazon",
|
|
26
|
+
"CloudFormation",
|
|
27
|
+
"Infrastructure as Code (IaC)",
|
|
28
|
+
"Language Server"
|
|
29
|
+
],
|
|
30
|
+
"bin": {
|
|
31
|
+
"cloudformation-languageserver": "./cfn-lsp-server-standalone.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"/*.js",
|
|
35
|
+
"/*.js.map",
|
|
36
|
+
"/*.wasm",
|
|
37
|
+
"/assets/",
|
|
38
|
+
"/vendor/",
|
|
39
|
+
"/NOTICE",
|
|
40
|
+
"/THIRD-PARTY-LICENSES.txt",
|
|
41
|
+
"/README.md"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"start": "node ./cfn-lsp-server-standalone.js --stdio"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@aws/cloudformation-validate": "1.14.0",
|
|
48
|
+
"@opentelemetry/api": "1.9.1",
|
|
49
|
+
"@opentelemetry/exporter-metrics-otlp-http": "0.221.0",
|
|
50
|
+
"@opentelemetry/instrumentation-runtime-node": "0.34.0",
|
|
51
|
+
"@opentelemetry/resources": "2.10.0",
|
|
52
|
+
"@opentelemetry/sdk-metrics": "2.10.0",
|
|
53
|
+
"@tree-sitter-grammars/tree-sitter-yaml": "0.7.1",
|
|
54
|
+
"debug": "4.4.3",
|
|
55
|
+
"graceful-fs": "4.2.11",
|
|
56
|
+
"lmdb": "3.5.6",
|
|
57
|
+
"pino": "10.3.1",
|
|
58
|
+
"pino-pretty": "13.1.3",
|
|
59
|
+
"proper-lockfile": "4.1.2",
|
|
60
|
+
"pyodide": "0.28.2",
|
|
61
|
+
"tree-sitter": "0.22.4",
|
|
62
|
+
"tree-sitter-json": "0.24.8",
|
|
63
|
+
"vscode-languageserver-types": "3.17.5"
|
|
64
|
+
},
|
|
65
|
+
"overrides": {
|
|
66
|
+
"tree-sitter": "0.22.4"
|
|
67
|
+
},
|
|
68
|
+
"allowScripts": {
|
|
69
|
+
"@tree-sitter-grammars/tree-sitter-yaml@0.7.1": true,
|
|
70
|
+
"esbuild@0.28.2": true,
|
|
71
|
+
"fsevents@2.3.3": true,
|
|
72
|
+
"lmdb@3.5.6": true,
|
|
73
|
+
"msgpackr-extract@3.0.4": true,
|
|
74
|
+
"protobufjs@7.6.5": true,
|
|
75
|
+
"tree-sitter@0.22.4": true,
|
|
76
|
+
"tree-sitter-json@0.24.8": true,
|
|
77
|
+
"unrs-resolver@1.12.2": true
|
|
78
|
+
}
|
|
79
|
+
}
|