@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 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_aws-sdk_credential-provider-ini_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;AAA4D;AACU;AAC/D;AACP;AACA;AACA,oBAAoB,WAAW,QAAQ,+NAA2C;AAClF,oBAAoB,wBAAwB,QAAQ,6NAA0C;AAC9F;AACA,+BAA+B,wBAAK,uBAAuB;AAC3D,SAAS;AACT;AACA;AACA,oBAAoB,uBAAuB,QAAQ,6NAA0C;AAC7F;AACA,SAAS;AACT;AACA;AACA,oBAAoB,UAAU,QAAQ,uJAA0C;AAChF;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,kBAAkB,uCAAwB,6CAA6C,YAAY,QAAQ,iBAAiB;AAC5H,8EAA8E,QAAQ;AACtF;AACA;AACA,oCAAoC,uCAAoB;;;AC7BI;AACmB;AACX;AAC7D,oCAAoC,8BAA8B,IAAI;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,iBAAiB,sCAAsC,iBAAiB;AACtH;AACA,8CAA8C,iBAAiB;AAC/D;AACA;AACA,+BAA+B,SAAS,+CAA+C,mBAAmB;AAC1G;AACA;AACA;AACA,0CAA0C,iBAAiB;AAC3D;AACA;AACA,+BAA+B,SAAS,8CAA8C,sBAAsB;AAC5G;AACA;AACA;AACO,oHAAoH;AAC3H;AACA;AACA,YAAY,yBAAyB;AACrC;AACA,gBAAgB,wBAAwB,QAAQ,iPAAqC;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,kBAAkB,uCAAwB;AAC1C,gBAAgB,iCAAc,UAAU;AACxC,uDAAuD,wBAAwB;AAC/E;AACA,kGAAkG,oCAAoC,eAAe,iBAAiB,YAAY,GAAG;AACrL;AACA;AACA;AACA;AACA,SAAS,iEAAiE;AAC1E,iBAAiB,uBAAuB;AACxC;AACA,mDAAmD,uCAAoB;AACvE;AACA;AACA;AACA;AACA,4EAA4E,WAAW;AACvF;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,0BAA0B,uCAAwB,YAAY,aAAa,iFAAiF,4CAA4C;AACxM;AACA;AACA;AACA;AACA;AACA,wEAAwE,uCAAoB;AAC5F;AACA;AACA;AACA;AACA;;;AC9E4D;AACrD;AACP;AACA;AACO;AACP,YAAY,uBAAuB,QAAQ,iOAA4C;AACvF;AACA;AACA;AACA,KAAK,IAAI,oBAAoB;AAC7B,WAAW,uCAAoB;AAC/B;;;ACX4D;AACrD;AACA;AACP,YAAY,cAAc,QAAQ,qOAA8C;AAChF;AACA;AACA;AACA,KAAK;AACL,WAAW,uCAAoB;AAC/B;;;ACT4D;AACrD,uEAAuE;AAC9E,YAAY,UAAU,QAAQ,6NAA0C;AACxE;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,mBAAmB,uCAAoB;AACvC;AACA;AACA,mBAAmB,uCAAoB;AACvC;AACA,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;;;ACxB4D;AACrD;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,8CAA8C,+CAA+C;AAC7F,wCAAwC,mCAAmC;AAC3E;AACA,WAAW,uCAAoB;AAC/B;;;ACjB4D;AACrD;AACP;AACA;AACA;AACA;AACO;AACP,YAAY,gBAAgB,QAAQ,+OAAmD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,WAAW,uCAAoB;AAC/B;;;ACnB+D;AACoC;AACf;AACM;AACZ;AACc;AACU;AAC/F,0GAA0G;AACjH;AACA,mDAAmD,oBAAoB;AACvE,eAAe,wBAAwB;AACvC;AACA,qCAAqC,mBAAmB,SAAS,8CAA8C;AAC/G,eAAe,4BAA4B;AAC3C;AACA,QAAQ,oBAAoB;AAC5B,eAAe,wBAAwB;AACvC;AACA,QAAQ,oBAAoB;AAC5B,eAAe,6BAA6B;AAC5C;AACA,QAAQ,gBAAgB;AACxB,eAAe,yBAAyB;AACxC;AACA,QAAQ,YAAY;AACpB,qBAAqB,qBAAqB;AAC1C;AACA,QAAQ,cAAc;AACtB,eAAe,uBAAuB;AACtC;AACA,cAAc,uCAAwB,kDAAkD,YAAY,4CAA4C,wBAAwB;AACxK;;;AC/BsE;AACZ;AACnD,0BAA0B,cAAc,qBAAqB,IAAI;AACxE;AACA,2BAA2B,kCAAe;AAC1C,WAAW,kBAAkB,CAAC,iCAAc;AAC5C;AACA,KAAK;AACL;;;ACRoC","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveLoginCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveSsoCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveStaticCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/fromIni.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-ini/dist-es/index.js"],"sourcesContent":["import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { chain, CredentialsProviderError } from \"@smithy/core/config\";\nexport const resolveCredentialSource = (credentialSource, profileName, logger) => {\n const sourceProvidersMap = {\n EcsContainer: async (options) => {\n const { fromHttp } = await import(\"@aws-sdk/credential-provider-http\");\n const { fromContainerMetadata } = await import(\"@smithy/credential-provider-imds\");\n logger?.debug(\"@aws-sdk/credential-provider-ini - credential_source is EcsContainer\");\n return async () => chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);\n },\n Ec2InstanceMetadata: async (options) => {\n logger?.debug(\"@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata\");\n const { fromInstanceMetadata } = await import(\"@smithy/credential-provider-imds\");\n return async () => fromInstanceMetadata(options)().then(setNamedProvider);\n },\n Environment: async (options) => {\n logger?.debug(\"@aws-sdk/credential-provider-ini - credential_source is Environment\");\n const { fromEnv } = await import(\"@aws-sdk/credential-provider-env\");\n return async () => fromEnv(options)().then(setNamedProvider);\n },\n };\n if (credentialSource in sourceProvidersMap) {\n return sourceProvidersMap[credentialSource];\n }\n else {\n throw new CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, ` +\n `expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });\n }\n};\nconst setNamedProvider = (creds) => setCredentialFeature(creds, \"CREDENTIALS_PROFILE_NAMED_PROVIDER\", \"p\");\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { CredentialsProviderError, getProfileName } from \"@smithy/core/config\";\nimport { resolveCredentialSource } from \"./resolveCredentialSource\";\nexport const isAssumeRoleProfile = (arg, { profile = \"default\", logger } = {}) => {\n return (Boolean(arg) &&\n typeof arg === \"object\" &&\n typeof arg.role_arn === \"string\" &&\n [\"undefined\", \"string\"].indexOf(typeof arg.role_session_name) > -1 &&\n [\"undefined\", \"string\"].indexOf(typeof arg.external_id) > -1 &&\n [\"undefined\", \"string\"].indexOf(typeof arg.mfa_serial) > -1 &&\n (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })));\n};\nconst isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {\n const withSourceProfile = typeof arg.source_profile === \"string\" && typeof arg.credential_source === \"undefined\";\n if (withSourceProfile) {\n logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);\n }\n return withSourceProfile;\n};\nconst isCredentialSourceProfile = (arg, { profile, logger }) => {\n const withProviderProfile = typeof arg.credential_source === \"string\" && typeof arg.source_profile === \"undefined\";\n if (withProviderProfile) {\n logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);\n }\n return withProviderProfile;\n};\nexport const resolveAssumeRoleCredentials = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, resolveProfileData) => {\n options.logger?.debug(\"@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)\");\n const profileData = profiles[profileName];\n const { source_profile, region } = profileData;\n if (!options.roleAssumer) {\n const { getDefaultRoleAssumer } = await import(\"@aws-sdk/nested-clients/sts\");\n options.roleAssumer = getDefaultRoleAssumer({\n ...options.clientConfig,\n credentialProviderLogger: options.logger,\n parentClientConfig: {\n ...callerClientConfig,\n ...options?.parentClientConfig,\n region: region ?? options?.parentClientConfig?.region ?? callerClientConfig?.region,\n },\n }, options.clientPlugins);\n }\n if (source_profile && source_profile in visitedProfiles) {\n throw new CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile` +\n ` ${getProfileName(options)}. Profiles visited: ` +\n Object.keys(visitedProfiles).join(\", \"), { logger: options.logger });\n }\n options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);\n const sourceCredsProvider = source_profile\n ? resolveProfileData(source_profile, profiles, options, callerClientConfig, {\n ...visitedProfiles,\n [source_profile]: true,\n }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {}))\n : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();\n if (isCredentialSourceWithoutRoleArn(profileData)) {\n return sourceCredsProvider.then((creds) => setCredentialFeature(creds, \"CREDENTIALS_PROFILE_SOURCE_PROFILE\", \"o\"));\n }\n else {\n const params = {\n RoleArn: profileData.role_arn,\n RoleSessionName: profileData.role_session_name || `aws-sdk-js-${Date.now()}`,\n ExternalId: profileData.external_id,\n DurationSeconds: parseInt(profileData.duration_seconds || \"3600\", 10),\n };\n const { mfa_serial } = profileData;\n if (mfa_serial) {\n if (!options.mfaCodeProvider) {\n throw new CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });\n }\n params.SerialNumber = mfa_serial;\n params.TokenCode = await options.mfaCodeProvider(mfa_serial);\n }\n const sourceCreds = await sourceCredsProvider;\n return options.roleAssumer(sourceCreds, params).then((creds) => setCredentialFeature(creds, \"CREDENTIALS_PROFILE_SOURCE_PROFILE\", \"o\"));\n }\n};\nconst isCredentialSourceWithoutRoleArn = (section) => {\n return !section.role_arn && !!section.credential_source;\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const isLoginProfile = (data) => {\n return Boolean(data && data.login_session);\n};\nexport const resolveLoginCredentials = async (profileName, options, callerClientConfig) => {\n const { fromLoginCredentials } = await import(\"@aws-sdk/credential-provider-login\");\n const credentials = await fromLoginCredentials({\n ...options,\n profile: profileName,\n })({ callerClientConfig });\n return setCredentialFeature(credentials, \"CREDENTIALS_PROFILE_LOGIN\", \"AC\");\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const isProcessProfile = (arg) => Boolean(arg) && typeof arg === \"object\" && typeof arg.credential_process === \"string\";\nexport const resolveProcessCredentials = async (options, profile) => {\n const { fromProcess } = await import(\"@aws-sdk/credential-provider-process\");\n const credentials = await fromProcess({\n ...options,\n profile,\n })();\n return setCredentialFeature(credentials, \"CREDENTIALS_PROFILE_PROCESS\", \"v\");\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {\n const { fromSSO } = await import(\"@aws-sdk/credential-provider-sso\");\n return fromSSO({\n profile,\n logger: options.logger,\n parentClientConfig: options.parentClientConfig,\n clientConfig: options.clientConfig,\n })({\n callerClientConfig,\n }).then((creds) => {\n if (profileData.sso_session) {\n return setCredentialFeature(creds, \"CREDENTIALS_PROFILE_SSO\", \"r\");\n }\n else {\n return setCredentialFeature(creds, \"CREDENTIALS_PROFILE_SSO_LEGACY\", \"t\");\n }\n });\n};\nexport const isSsoProfile = (arg) => arg &&\n (typeof arg.sso_start_url === \"string\" ||\n typeof arg.sso_account_id === \"string\" ||\n typeof arg.sso_session === \"string\" ||\n typeof arg.sso_region === \"string\" ||\n typeof arg.sso_role_name === \"string\");\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const isStaticCredsProfile = (arg) => Boolean(arg) &&\n typeof arg === \"object\" &&\n typeof arg.aws_access_key_id === \"string\" &&\n typeof arg.aws_secret_access_key === \"string\" &&\n [\"undefined\", \"string\"].indexOf(typeof arg.aws_session_token) > -1 &&\n [\"undefined\", \"string\"].indexOf(typeof arg.aws_account_id) > -1;\nexport const resolveStaticCredentials = async (profile, options) => {\n options?.logger?.debug(\"@aws-sdk/credential-provider-ini - resolveStaticCredentials\");\n const credentials = {\n accessKeyId: profile.aws_access_key_id,\n secretAccessKey: profile.aws_secret_access_key,\n sessionToken: profile.aws_session_token,\n ...(profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }),\n ...(profile.aws_account_id && { accountId: profile.aws_account_id }),\n };\n return setCredentialFeature(credentials, \"CREDENTIALS_PROFILE\", \"n\");\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const isWebIdentityProfile = (arg) => Boolean(arg) &&\n typeof arg === \"object\" &&\n typeof arg.web_identity_token_file === \"string\" &&\n typeof arg.role_arn === \"string\" &&\n [\"undefined\", \"string\"].indexOf(typeof arg.role_session_name) > -1;\nexport const resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => {\n const { fromTokenFile } = await import(\"@aws-sdk/credential-provider-web-identity\");\n const credentials = await fromTokenFile({\n webIdentityTokenFile: profile.web_identity_token_file,\n roleArn: profile.role_arn,\n roleSessionName: profile.role_session_name,\n roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,\n logger: options.logger,\n parentClientConfig: options.parentClientConfig,\n })({\n callerClientConfig,\n });\n return setCredentialFeature(credentials, \"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN\", \"q\");\n};\n","import { CredentialsProviderError } from \"@smithy/core/config\";\nimport { isAssumeRoleProfile, resolveAssumeRoleCredentials } from \"./resolveAssumeRoleCredentials\";\nimport { isLoginProfile, resolveLoginCredentials } from \"./resolveLoginCredentials\";\nimport { isProcessProfile, resolveProcessCredentials } from \"./resolveProcessCredentials\";\nimport { isSsoProfile, resolveSsoCredentials } from \"./resolveSsoCredentials\";\nimport { isStaticCredsProfile, resolveStaticCredentials } from \"./resolveStaticCredentials\";\nimport { isWebIdentityProfile, resolveWebIdentityCredentials } from \"./resolveWebIdentityCredentials\";\nexport const resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {\n const data = profiles[profileName];\n if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {\n return resolveStaticCredentials(data, options);\n }\n if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {\n return resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig, visitedProfiles, resolveProfileData);\n }\n if (isStaticCredsProfile(data)) {\n return resolveStaticCredentials(data, options);\n }\n if (isWebIdentityProfile(data)) {\n return resolveWebIdentityCredentials(data, options, callerClientConfig);\n }\n if (isProcessProfile(data)) {\n return resolveProcessCredentials(options, profileName);\n }\n if (isSsoProfile(data)) {\n return await resolveSsoCredentials(profileName, data, options, callerClientConfig);\n }\n if (isLoginProfile(data)) {\n return resolveLoginCredentials(profileName, options, callerClientConfig);\n }\n throw new CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });\n};\n","import { getProfileName, parseKnownFiles } from \"@smithy/core/config\";\nimport { resolveProfileData } from \"./resolveProfileData\";\nexport const fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-ini - fromIni\");\n const profiles = await parseKnownFiles(init);\n return resolveProfileData(getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n }), profiles, init, callerClientConfig);\n};\n","export { fromIni } from \"./fromIni\";\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_aws-sdk_credential-provider-login_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_aws-sdk_credential-provider-login_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@aws-sdk/credential-provider-login/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
fromLoginCredentials: () => (/* reexport */ fromLoginCredentials)
|
|
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/core/dist-es/submodules/protocols/index.js + 20 modules
|
|
20
|
+
var protocols = __webpack_require__("./node_modules/@smithy/core/dist-es/submodules/protocols/index.js");
|
|
21
|
+
// EXTERNAL MODULE: external "node:crypto"
|
|
22
|
+
var external_node_crypto_ = __webpack_require__("node:crypto");
|
|
23
|
+
// EXTERNAL MODULE: external "node:fs"
|
|
24
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
25
|
+
// EXTERNAL MODULE: external "node:os"
|
|
26
|
+
var external_node_os_ = __webpack_require__("node:os");
|
|
27
|
+
// EXTERNAL MODULE: external "node:path"
|
|
28
|
+
var external_node_path_ = __webpack_require__("node:path");
|
|
29
|
+
;// ./node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class LoginCredentialsFetcher {
|
|
37
|
+
profileData;
|
|
38
|
+
init;
|
|
39
|
+
callerClientConfig;
|
|
40
|
+
static REFRESH_THRESHOLD = 5 * 60 * 1000;
|
|
41
|
+
constructor(profileData, init, callerClientConfig) {
|
|
42
|
+
this.profileData = profileData;
|
|
43
|
+
this.init = init;
|
|
44
|
+
this.callerClientConfig = callerClientConfig;
|
|
45
|
+
}
|
|
46
|
+
async loadCredentials() {
|
|
47
|
+
const token = await this.loadToken();
|
|
48
|
+
if (!token) {
|
|
49
|
+
throw new config/* CredentialsProviderError */.C1(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
|
|
50
|
+
}
|
|
51
|
+
const accessToken = token.accessToken;
|
|
52
|
+
const now = Date.now();
|
|
53
|
+
const expiryTime = new Date(accessToken.expiresAt).getTime();
|
|
54
|
+
const timeUntilExpiry = expiryTime - now;
|
|
55
|
+
if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {
|
|
56
|
+
return this.refresh(token);
|
|
57
|
+
}
|
|
58
|
+
return this.toCredentials(token.accessToken);
|
|
59
|
+
}
|
|
60
|
+
get logger() {
|
|
61
|
+
return this.init?.logger;
|
|
62
|
+
}
|
|
63
|
+
get loginSession() {
|
|
64
|
+
return this.profileData.login_session;
|
|
65
|
+
}
|
|
66
|
+
toCredentials(token) {
|
|
67
|
+
return {
|
|
68
|
+
accessKeyId: token.accessKeyId,
|
|
69
|
+
secretAccessKey: token.secretAccessKey,
|
|
70
|
+
sessionToken: token.sessionToken,
|
|
71
|
+
accountId: token.accountId,
|
|
72
|
+
expiration: new Date(token.expiresAt),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async refresh(token) {
|
|
76
|
+
const diskToken = await this.loadToken().catch(() => token);
|
|
77
|
+
const now = Date.now();
|
|
78
|
+
const diskExpiry = new Date(diskToken.accessToken.expiresAt).getTime();
|
|
79
|
+
const tokenExpiry = new Date(token.accessToken.expiresAt).getTime();
|
|
80
|
+
const freshToken = diskExpiry <= now && tokenExpiry > now ? token : diskToken;
|
|
81
|
+
const freshExpiry = new Date(freshToken.accessToken.expiresAt).getTime();
|
|
82
|
+
if (freshExpiry - Date.now() > LoginCredentialsFetcher.REFRESH_THRESHOLD) {
|
|
83
|
+
return this.toCredentials(freshToken.accessToken);
|
|
84
|
+
}
|
|
85
|
+
const { SigninClient, CreateOAuth2TokenCommand } = await __webpack_require__.e(/* import() */ "vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_signin_index_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/index.js"));
|
|
86
|
+
const { logger, userAgentAppId } = this.callerClientConfig ?? {};
|
|
87
|
+
const isH2 = (requestHandler) => {
|
|
88
|
+
return requestHandler?.metadata?.handlerProtocol === "h2";
|
|
89
|
+
};
|
|
90
|
+
const requestHandler = isH2(this.callerClientConfig?.requestHandler)
|
|
91
|
+
? undefined
|
|
92
|
+
: this.callerClientConfig?.requestHandler;
|
|
93
|
+
const region = this.profileData.region ?? (await this.callerClientConfig?.region?.()) ?? process.env.AWS_REGION;
|
|
94
|
+
const client = new SigninClient({
|
|
95
|
+
credentials: {
|
|
96
|
+
accessKeyId: "",
|
|
97
|
+
secretAccessKey: "",
|
|
98
|
+
},
|
|
99
|
+
region,
|
|
100
|
+
requestHandler,
|
|
101
|
+
logger,
|
|
102
|
+
userAgentAppId,
|
|
103
|
+
...this.init?.clientConfig,
|
|
104
|
+
});
|
|
105
|
+
this.createDPoPInterceptor(client.middlewareStack);
|
|
106
|
+
const commandInput = {
|
|
107
|
+
tokenInput: {
|
|
108
|
+
clientId: freshToken.clientId,
|
|
109
|
+
refreshToken: freshToken.refreshToken,
|
|
110
|
+
grantType: "refresh_token",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
const response = await client.send(new CreateOAuth2TokenCommand(commandInput));
|
|
115
|
+
const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
|
|
116
|
+
const { refreshToken, expiresIn } = response.tokenOutput ?? {};
|
|
117
|
+
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
118
|
+
throw new config/* CredentialsProviderError */.C1("Token refresh response missing required fields", {
|
|
119
|
+
logger: this.logger,
|
|
120
|
+
tryNextLink: false,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const expiresInMs = (expiresIn ?? 900) * 1000;
|
|
124
|
+
const expiration = new Date(Date.now() + expiresInMs);
|
|
125
|
+
const updatedToken = {
|
|
126
|
+
...freshToken,
|
|
127
|
+
accessToken: {
|
|
128
|
+
...freshToken.accessToken,
|
|
129
|
+
accessKeyId,
|
|
130
|
+
secretAccessKey,
|
|
131
|
+
sessionToken,
|
|
132
|
+
expiresAt: expiration.toISOString(),
|
|
133
|
+
},
|
|
134
|
+
refreshToken,
|
|
135
|
+
};
|
|
136
|
+
await this.saveToken(updatedToken);
|
|
137
|
+
return this.toCredentials(updatedToken.accessToken);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (error.name === "AccessDeniedException") {
|
|
141
|
+
const errorType = error.error;
|
|
142
|
+
let message;
|
|
143
|
+
switch (errorType) {
|
|
144
|
+
case "TOKEN_EXPIRED":
|
|
145
|
+
message = "Your session has expired. Please reauthenticate.";
|
|
146
|
+
break;
|
|
147
|
+
case "USER_CREDENTIALS_CHANGED":
|
|
148
|
+
message =
|
|
149
|
+
"Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";
|
|
150
|
+
break;
|
|
151
|
+
case "INSUFFICIENT_PERMISSIONS":
|
|
152
|
+
message =
|
|
153
|
+
"Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
|
|
154
|
+
break;
|
|
155
|
+
default:
|
|
156
|
+
message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
|
|
157
|
+
}
|
|
158
|
+
throw new config/* CredentialsProviderError */.C1(message, {
|
|
159
|
+
logger: this.logger,
|
|
160
|
+
tryNextLink: false,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const tokenExpiry = new Date(freshToken.accessToken.expiresAt).getTime();
|
|
164
|
+
if (tokenExpiry > Date.now()) {
|
|
165
|
+
this.logger?.warn?.(`Failed to refresh token: ${String(error)}. Using existing token until expiry.`);
|
|
166
|
+
return this.toCredentials(freshToken.accessToken);
|
|
167
|
+
}
|
|
168
|
+
throw new config/* CredentialsProviderError */.C1(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async loadToken() {
|
|
172
|
+
const tokenFilePath = this.getTokenFilePath();
|
|
173
|
+
try {
|
|
174
|
+
const tokenData = await external_node_fs_.promises.readFile(tokenFilePath, "utf8");
|
|
175
|
+
const token = JSON.parse(tokenData);
|
|
176
|
+
const missingFields = ["accessToken", "clientId", "refreshToken", "dpopKey"].filter((k) => !token[k]);
|
|
177
|
+
if (!token.accessToken?.accountId) {
|
|
178
|
+
missingFields.push("accountId");
|
|
179
|
+
}
|
|
180
|
+
if (missingFields.length > 0) {
|
|
181
|
+
throw new config/* CredentialsProviderError */.C1(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
|
|
182
|
+
logger: this.logger,
|
|
183
|
+
tryNextLink: false,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return token;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
throw new config/* CredentialsProviderError */.C1(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
|
|
190
|
+
logger: this.logger,
|
|
191
|
+
tryNextLink: false,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async saveToken(token) {
|
|
196
|
+
const tokenFilePath = this.getTokenFilePath();
|
|
197
|
+
const directory = (0,external_node_path_.dirname)(tokenFilePath);
|
|
198
|
+
try {
|
|
199
|
+
await external_node_fs_.promises.mkdir(directory, { recursive: true });
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
}
|
|
203
|
+
await external_node_fs_.promises.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
|
|
204
|
+
}
|
|
205
|
+
getTokenFilePath() {
|
|
206
|
+
const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? (0,external_node_path_.join)((0,external_node_os_.homedir)(), ".aws", "login", "cache");
|
|
207
|
+
const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
|
|
208
|
+
const loginSessionSha256 = (0,external_node_crypto_.createHash)("sha256").update(loginSessionBytes).digest("hex");
|
|
209
|
+
return (0,external_node_path_.join)(directory, `${loginSessionSha256}.json`);
|
|
210
|
+
}
|
|
211
|
+
derToRawSignature(derSignature) {
|
|
212
|
+
let offset = 2;
|
|
213
|
+
if (derSignature[offset] !== 0x02) {
|
|
214
|
+
throw new Error("Invalid DER signature");
|
|
215
|
+
}
|
|
216
|
+
offset++;
|
|
217
|
+
const rLength = derSignature[offset++];
|
|
218
|
+
let r = derSignature.subarray(offset, offset + rLength);
|
|
219
|
+
offset += rLength;
|
|
220
|
+
if (derSignature[offset] !== 0x02) {
|
|
221
|
+
throw new Error("Invalid DER signature");
|
|
222
|
+
}
|
|
223
|
+
offset++;
|
|
224
|
+
const sLength = derSignature[offset++];
|
|
225
|
+
let s = derSignature.subarray(offset, offset + sLength);
|
|
226
|
+
r = r[0] === 0x00 ? r.subarray(1) : r;
|
|
227
|
+
s = s[0] === 0x00 ? s.subarray(1) : s;
|
|
228
|
+
const rPadded = Buffer.concat([Buffer.alloc(32 - r.length), r]);
|
|
229
|
+
const sPadded = Buffer.concat([Buffer.alloc(32 - s.length), s]);
|
|
230
|
+
return Buffer.concat([rPadded, sPadded]);
|
|
231
|
+
}
|
|
232
|
+
createDPoPInterceptor(middlewareStack) {
|
|
233
|
+
middlewareStack.add((next) => async (args) => {
|
|
234
|
+
if (protocols/* HttpRequest */.Kd.isInstance(args.request)) {
|
|
235
|
+
const request = args.request;
|
|
236
|
+
const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : ""}${request.path}`;
|
|
237
|
+
const dpop = await this.generateDpop(request.method, actualEndpoint);
|
|
238
|
+
request.headers = {
|
|
239
|
+
...request.headers,
|
|
240
|
+
DPoP: dpop,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return next(args);
|
|
244
|
+
}, {
|
|
245
|
+
step: "finalizeRequest",
|
|
246
|
+
name: "dpopInterceptor",
|
|
247
|
+
override: true,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
async generateDpop(method = "POST", endpoint) {
|
|
251
|
+
const token = await this.loadToken();
|
|
252
|
+
try {
|
|
253
|
+
const privateKey = (0,external_node_crypto_.createPrivateKey)({
|
|
254
|
+
key: token.dpopKey,
|
|
255
|
+
format: "pem",
|
|
256
|
+
type: "sec1",
|
|
257
|
+
});
|
|
258
|
+
const publicKey = (0,external_node_crypto_.createPublicKey)(privateKey);
|
|
259
|
+
const publicDer = publicKey.export({ format: "der", type: "spki" });
|
|
260
|
+
let pointStart = -1;
|
|
261
|
+
for (let i = 0; i < publicDer.length; i++) {
|
|
262
|
+
if (publicDer[i] === 0x04) {
|
|
263
|
+
pointStart = i;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const x = publicDer.slice(pointStart + 1, pointStart + 33);
|
|
268
|
+
const y = publicDer.slice(pointStart + 33, pointStart + 65);
|
|
269
|
+
const header = {
|
|
270
|
+
alg: "ES256",
|
|
271
|
+
typ: "dpop+jwt",
|
|
272
|
+
jwk: {
|
|
273
|
+
kty: "EC",
|
|
274
|
+
crv: "P-256",
|
|
275
|
+
x: x.toString("base64url"),
|
|
276
|
+
y: y.toString("base64url"),
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
const payload = {
|
|
280
|
+
jti: crypto.randomUUID(),
|
|
281
|
+
htm: method,
|
|
282
|
+
htu: endpoint,
|
|
283
|
+
iat: Math.floor(Date.now() / 1000),
|
|
284
|
+
};
|
|
285
|
+
const headerB64 = Buffer.from(JSON.stringify(header)).toString("base64url");
|
|
286
|
+
const payloadB64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
287
|
+
const message = `${headerB64}.${payloadB64}`;
|
|
288
|
+
const asn1Signature = (0,external_node_crypto_.sign)("sha256", Buffer.from(message), privateKey);
|
|
289
|
+
const rawSignature = this.derToRawSignature(asn1Signature);
|
|
290
|
+
const signatureB64 = rawSignature.toString("base64url");
|
|
291
|
+
return `${message}.${signatureB64}`;
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
throw new config/* CredentialsProviderError */.C1(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
;// ./node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
const fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
|
|
304
|
+
init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
|
|
305
|
+
const profiles = await (0,config/* parseKnownFiles */.YU)(init || {});
|
|
306
|
+
const profileName = (0,config/* getProfileName */.Bz)({
|
|
307
|
+
profile: init?.profile ?? callerClientConfig?.profile,
|
|
308
|
+
});
|
|
309
|
+
const profile = profiles[profileName];
|
|
310
|
+
if (!profile?.login_session) {
|
|
311
|
+
throw new config/* CredentialsProviderError */.C1(`Profile ${profileName} does not contain login_session.`, {
|
|
312
|
+
tryNextLink: true,
|
|
313
|
+
logger: init?.logger,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
|
|
317
|
+
const credentials = await fetcher.loadCredentials();
|
|
318
|
+
return (0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_LOGIN", "AD");
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
;// ./node_modules/@aws-sdk/credential-provider-login/dist-es/index.js
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
/***/ }
|
|
326
|
+
|
|
327
|
+
};
|
|
328
|
+
;
|
|
329
|
+
//# sourceMappingURL=node_modules_aws-sdk_credential-provider-login_dist-es_index_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_aws-sdk_credential-provider-login_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA+D;AACV;AAC6B;AACzC;AACP;AACQ;AACnC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uCAAwB,uCAAuC,kBAAkB,6CAA6C,yCAAyC;AAC7L;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;AACA;AACA;AACA;AACA;AACA,gBAAgB,yCAAyC,QAAQ,uPAAwC;AACzG,gBAAgB,yBAAyB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,oBAAoB,6CAA6C;AACjE,oBAAoB,0BAA0B;AAC9C;AACA,0BAA0B,uCAAwB;AAClD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,cAAc;AAC5E;AACA,0BAA0B,uCAAwB;AAClD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,gEAAgE,cAAc;AAC9E;AACA;AACA,sBAAsB,uCAAwB,6BAA6B,cAAc,6CAA6C,qBAAqB;AAC3J;AACA;AACA;AACA;AACA;AACA,oCAAoC,0BAAE;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uCAAwB,6CAA6C,yBAAyB;AACxH;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,sBAAsB,uCAAwB,8BAA8B,cAAc,IAAI,cAAc;AAC5G;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,0BAA0B,+BAAO;AACjC;AACA,kBAAkB,0BAAE,oBAAoB,iBAAiB;AACzD;AACA;AACA;AACA,cAAc,0BAAE;AAChB;AACA;AACA,mEAAmE,4BAAI,CAAC,6BAAO;AAC/E;AACA,mCAAmC,oCAAU;AAC7C,eAAe,4BAAI,eAAe,mBAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,6BAAW;AAC3B;AACA,0CAA0C,iBAAiB,IAAI,iBAAiB,EAAE,mBAAmB,aAAa,OAAO,EAAE,aAAa;AACxI;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,+BAA+B,0CAAgB;AAC/C;AACA;AACA;AACA,aAAa;AACb,8BAA8B,yCAAe;AAC7C,iDAAiD,6BAA6B;AAC9E;AACA,4BAA4B,sBAAsB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,UAAU,GAAG,WAAW;AACvD,kCAAkC,8BAAI;AACtC;AACA;AACA,sBAAsB,QAAQ,GAAG,aAAa;AAC9C;AACA;AACA,sBAAsB,uCAAwB,mCAAmC,uDAAuD,KAAK,yCAAyC;AACtL;AACA;AACA;;;AC3Q4D;AACoC;AAC5B;AAC7D,gDAAgD,qBAAqB,IAAI;AAChF;AACA,2BAA2B,kCAAe,WAAW;AACrD,wBAAwB,iCAAc;AACtC;AACA,KAAK;AACL;AACA;AACA,kBAAkB,uCAAwB,YAAY,aAAa;AACnE;AACA;AACA,SAAS;AACT;AACA,wBAAwB,uBAAuB;AAC/C;AACA,WAAW,uCAAoB;AAC/B;;;ACnB8D","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-login/dist-es/index.js"],"sourcesContent":["import { CredentialsProviderError } from \"@smithy/core/config\";\nimport { HttpRequest } from \"@smithy/core/protocols\";\nimport { createHash, createPrivateKey, createPublicKey, sign } from \"node:crypto\";\nimport { promises as fs } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nexport class LoginCredentialsFetcher {\n profileData;\n init;\n callerClientConfig;\n static REFRESH_THRESHOLD = 5 * 60 * 1000;\n constructor(profileData, init, callerClientConfig) {\n this.profileData = profileData;\n this.init = init;\n this.callerClientConfig = callerClientConfig;\n }\n async loadCredentials() {\n const token = await this.loadToken();\n if (!token) {\n throw new CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });\n }\n const accessToken = token.accessToken;\n const now = Date.now();\n const expiryTime = new Date(accessToken.expiresAt).getTime();\n const timeUntilExpiry = expiryTime - now;\n if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {\n return this.refresh(token);\n }\n return this.toCredentials(token.accessToken);\n }\n get logger() {\n return this.init?.logger;\n }\n get loginSession() {\n return this.profileData.login_session;\n }\n toCredentials(token) {\n return {\n accessKeyId: token.accessKeyId,\n secretAccessKey: token.secretAccessKey,\n sessionToken: token.sessionToken,\n accountId: token.accountId,\n expiration: new Date(token.expiresAt),\n };\n }\n async refresh(token) {\n const diskToken = await this.loadToken().catch(() => token);\n const now = Date.now();\n const diskExpiry = new Date(diskToken.accessToken.expiresAt).getTime();\n const tokenExpiry = new Date(token.accessToken.expiresAt).getTime();\n const freshToken = diskExpiry <= now && tokenExpiry > now ? token : diskToken;\n const freshExpiry = new Date(freshToken.accessToken.expiresAt).getTime();\n if (freshExpiry - Date.now() > LoginCredentialsFetcher.REFRESH_THRESHOLD) {\n return this.toCredentials(freshToken.accessToken);\n }\n const { SigninClient, CreateOAuth2TokenCommand } = await import(\"@aws-sdk/nested-clients/signin\");\n const { logger, userAgentAppId } = this.callerClientConfig ?? {};\n const isH2 = (requestHandler) => {\n return requestHandler?.metadata?.handlerProtocol === \"h2\";\n };\n const requestHandler = isH2(this.callerClientConfig?.requestHandler)\n ? undefined\n : this.callerClientConfig?.requestHandler;\n const region = this.profileData.region ?? (await this.callerClientConfig?.region?.()) ?? process.env.AWS_REGION;\n const client = new SigninClient({\n credentials: {\n accessKeyId: \"\",\n secretAccessKey: \"\",\n },\n region,\n requestHandler,\n logger,\n userAgentAppId,\n ...this.init?.clientConfig,\n });\n this.createDPoPInterceptor(client.middlewareStack);\n const commandInput = {\n tokenInput: {\n clientId: freshToken.clientId,\n refreshToken: freshToken.refreshToken,\n grantType: \"refresh_token\",\n },\n };\n try {\n const response = await client.send(new CreateOAuth2TokenCommand(commandInput));\n const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};\n const { refreshToken, expiresIn } = response.tokenOutput ?? {};\n if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {\n throw new CredentialsProviderError(\"Token refresh response missing required fields\", {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n const expiresInMs = (expiresIn ?? 900) * 1000;\n const expiration = new Date(Date.now() + expiresInMs);\n const updatedToken = {\n ...freshToken,\n accessToken: {\n ...freshToken.accessToken,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n expiresAt: expiration.toISOString(),\n },\n refreshToken,\n };\n await this.saveToken(updatedToken);\n return this.toCredentials(updatedToken.accessToken);\n }\n catch (error) {\n if (error.name === \"AccessDeniedException\") {\n const errorType = error.error;\n let message;\n switch (errorType) {\n case \"TOKEN_EXPIRED\":\n message = \"Your session has expired. Please reauthenticate.\";\n break;\n case \"USER_CREDENTIALS_CHANGED\":\n message =\n \"Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.\";\n break;\n case \"INSUFFICIENT_PERMISSIONS\":\n message =\n \"Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.\";\n break;\n default:\n message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \\`aws login\\``;\n }\n throw new CredentialsProviderError(message, {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n const tokenExpiry = new Date(freshToken.accessToken.expiresAt).getTime();\n if (tokenExpiry > Date.now()) {\n this.logger?.warn?.(`Failed to refresh token: ${String(error)}. Using existing token until expiry.`);\n return this.toCredentials(freshToken.accessToken);\n }\n throw new CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });\n }\n }\n async loadToken() {\n const tokenFilePath = this.getTokenFilePath();\n try {\n const tokenData = await fs.readFile(tokenFilePath, \"utf8\");\n const token = JSON.parse(tokenData);\n const missingFields = [\"accessToken\", \"clientId\", \"refreshToken\", \"dpopKey\"].filter((k) => !token[k]);\n if (!token.accessToken?.accountId) {\n missingFields.push(\"accountId\");\n }\n if (missingFields.length > 0) {\n throw new CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(\", \")}`, {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n return token;\n }\n catch (error) {\n throw new CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n }\n async saveToken(token) {\n const tokenFilePath = this.getTokenFilePath();\n const directory = dirname(tokenFilePath);\n try {\n await fs.mkdir(directory, { recursive: true });\n }\n catch (error) {\n }\n await fs.writeFile(tokenFilePath, JSON.stringify(token, null, 2), \"utf8\");\n }\n getTokenFilePath() {\n const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join(homedir(), \".aws\", \"login\", \"cache\");\n const loginSessionBytes = Buffer.from(this.loginSession, \"utf8\");\n const loginSessionSha256 = createHash(\"sha256\").update(loginSessionBytes).digest(\"hex\");\n return join(directory, `${loginSessionSha256}.json`);\n }\n derToRawSignature(derSignature) {\n let offset = 2;\n if (derSignature[offset] !== 0x02) {\n throw new Error(\"Invalid DER signature\");\n }\n offset++;\n const rLength = derSignature[offset++];\n let r = derSignature.subarray(offset, offset + rLength);\n offset += rLength;\n if (derSignature[offset] !== 0x02) {\n throw new Error(\"Invalid DER signature\");\n }\n offset++;\n const sLength = derSignature[offset++];\n let s = derSignature.subarray(offset, offset + sLength);\n r = r[0] === 0x00 ? r.subarray(1) : r;\n s = s[0] === 0x00 ? s.subarray(1) : s;\n const rPadded = Buffer.concat([Buffer.alloc(32 - r.length), r]);\n const sPadded = Buffer.concat([Buffer.alloc(32 - s.length), s]);\n return Buffer.concat([rPadded, sPadded]);\n }\n createDPoPInterceptor(middlewareStack) {\n middlewareStack.add((next) => async (args) => {\n if (HttpRequest.isInstance(args.request)) {\n const request = args.request;\n const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : \"\"}${request.path}`;\n const dpop = await this.generateDpop(request.method, actualEndpoint);\n request.headers = {\n ...request.headers,\n DPoP: dpop,\n };\n }\n return next(args);\n }, {\n step: \"finalizeRequest\",\n name: \"dpopInterceptor\",\n override: true,\n });\n }\n async generateDpop(method = \"POST\", endpoint) {\n const token = await this.loadToken();\n try {\n const privateKey = createPrivateKey({\n key: token.dpopKey,\n format: \"pem\",\n type: \"sec1\",\n });\n const publicKey = createPublicKey(privateKey);\n const publicDer = publicKey.export({ format: \"der\", type: \"spki\" });\n let pointStart = -1;\n for (let i = 0; i < publicDer.length; i++) {\n if (publicDer[i] === 0x04) {\n pointStart = i;\n break;\n }\n }\n const x = publicDer.slice(pointStart + 1, pointStart + 33);\n const y = publicDer.slice(pointStart + 33, pointStart + 65);\n const header = {\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: {\n kty: \"EC\",\n crv: \"P-256\",\n x: x.toString(\"base64url\"),\n y: y.toString(\"base64url\"),\n },\n };\n const payload = {\n jti: crypto.randomUUID(),\n htm: method,\n htu: endpoint,\n iat: Math.floor(Date.now() / 1000),\n };\n const headerB64 = Buffer.from(JSON.stringify(header)).toString(\"base64url\");\n const payloadB64 = Buffer.from(JSON.stringify(payload)).toString(\"base64url\");\n const message = `${headerB64}.${payloadB64}`;\n const asn1Signature = sign(\"sha256\", Buffer.from(message), privateKey);\n const rawSignature = this.derToRawSignature(asn1Signature);\n const signatureB64 = rawSignature.toString(\"base64url\");\n return `${message}.${signatureB64}`;\n }\n catch (error) {\n throw new CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });\n }\n }\n}\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { CredentialsProviderError, getProfileName, parseKnownFiles } from \"@smithy/core/config\";\nimport { LoginCredentialsFetcher } from \"./LoginCredentialsFetcher\";\nexport const fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {\n init?.logger?.debug?.(\"@aws-sdk/credential-providers - fromLoginCredentials\");\n const profiles = await parseKnownFiles(init || {});\n const profileName = getProfileName({\n profile: init?.profile ?? callerClientConfig?.profile,\n });\n const profile = profiles[profileName];\n if (!profile?.login_session) {\n throw new CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {\n tryNextLink: true,\n logger: init?.logger,\n });\n }\n const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);\n const credentials = await fetcher.loadCredentials();\n return setCredentialFeature(credentials, \"CREDENTIALS_LOGIN\", \"AD\");\n};\n","export { fromLoginCredentials } from \"./fromLoginCredentials\";\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = "node_modules_aws-sdk_credential-provider-process_dist-es_index_js";
|
|
3
|
+
exports.ids = ["node_modules_aws-sdk_credential-provider-process_dist-es_index_js"];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ "./node_modules/@aws-sdk/credential-provider-process/dist-es/index.js"
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
fromProcess: () => (/* reexport */ fromProcess)
|
|
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: external "node:child_process"
|
|
18
|
+
var external_node_child_process_ = __webpack_require__("node:child_process");
|
|
19
|
+
// EXTERNAL MODULE: external "node:util"
|
|
20
|
+
var external_node_util_ = __webpack_require__("node:util");
|
|
21
|
+
// EXTERNAL MODULE: ./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js + 35 modules
|
|
22
|
+
var client = __webpack_require__("./node_modules/@aws-sdk/core/dist-es/submodules/client/index.js");
|
|
23
|
+
;// ./node_modules/@aws-sdk/credential-provider-process/dist-es/getValidatedProcessCredentials.js
|
|
24
|
+
|
|
25
|
+
const getValidatedProcessCredentials = (profileName, data, profiles) => {
|
|
26
|
+
if (data.Version !== 1) {
|
|
27
|
+
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
|
|
28
|
+
}
|
|
29
|
+
if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {
|
|
30
|
+
throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);
|
|
31
|
+
}
|
|
32
|
+
if (data.Expiration) {
|
|
33
|
+
const currentTime = new Date();
|
|
34
|
+
const expireTime = new Date(data.Expiration);
|
|
35
|
+
if (expireTime < currentTime) {
|
|
36
|
+
throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let accountId = data.AccountId;
|
|
40
|
+
if (!accountId && profiles?.[profileName]?.aws_account_id) {
|
|
41
|
+
accountId = profiles[profileName].aws_account_id;
|
|
42
|
+
}
|
|
43
|
+
const credentials = {
|
|
44
|
+
accessKeyId: data.AccessKeyId,
|
|
45
|
+
secretAccessKey: data.SecretAccessKey,
|
|
46
|
+
...(data.SessionToken && { sessionToken: data.SessionToken }),
|
|
47
|
+
...(data.Expiration && { expiration: new Date(data.Expiration) }),
|
|
48
|
+
...(data.CredentialScope && { credentialScope: data.CredentialScope }),
|
|
49
|
+
...(accountId && { accountId }),
|
|
50
|
+
};
|
|
51
|
+
(0,client/* setCredentialFeature */.gD)(credentials, "CREDENTIALS_PROCESS", "w");
|
|
52
|
+
return credentials;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
;// ./node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const resolveProcessCredentials = async (profileName, profiles, logger) => {
|
|
61
|
+
const profile = profiles[profileName];
|
|
62
|
+
if (profiles[profileName]) {
|
|
63
|
+
const credentialProcess = profile["credential_process"];
|
|
64
|
+
if (credentialProcess !== undefined) {
|
|
65
|
+
const execPromise = (0,external_node_util_.promisify)(config/* externalDataInterceptor */.ZY?.getTokenRecord?.().exec ?? external_node_child_process_.exec);
|
|
66
|
+
try {
|
|
67
|
+
const { stdout } = await execPromise(credentialProcess);
|
|
68
|
+
let data;
|
|
69
|
+
try {
|
|
70
|
+
data = JSON.parse(stdout.trim());
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
|
74
|
+
}
|
|
75
|
+
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw new config/* CredentialsProviderError */.C1(error.message, { logger });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new config/* CredentialsProviderError */.C1(`Profile ${profileName} did not contain credential_process.`, { logger });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
throw new config/* CredentialsProviderError */.C1(`Profile ${profileName} could not be found in shared credentials file.`, {
|
|
87
|
+
logger,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
;// ./node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
96
|
+
init.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");
|
|
97
|
+
const profiles = await (0,config/* parseKnownFiles */.YU)(init);
|
|
98
|
+
return resolveProcessCredentials((0,config/* getProfileName */.Bz)({
|
|
99
|
+
profile: init.profile ?? callerClientConfig?.profile,
|
|
100
|
+
}), profiles, init.logger);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
;// ./node_modules/@aws-sdk/credential-provider-process/dist-es/index.js
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/***/ }
|
|
108
|
+
|
|
109
|
+
};
|
|
110
|
+
;
|
|
111
|
+
//# sourceMappingURL=node_modules_aws-sdk_credential-provider-process_dist-es_index_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_aws-sdk_credential-provider-process_dist-es_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA4D;AACrD;AACP;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,iCAAiC;AACpE,iCAAiC,uCAAuC;AACxE,sCAAsC,uCAAuC;AAC7E,2BAA2B,WAAW;AACtC;AACA,IAAI,uCAAoB;AACxB;AACA;;;AC7BwF;AAC9C;AACJ;AAC4C;AAC3E;AACP;AACA;AACA;AACA;AACA,gCAAgC,iCAAS,CAAC,sCAAuB,6BAA6B,iCAAI;AAClG;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;AACA;AACA;AACA,2CAA2C,aAAa;AACxD;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA,0BAA0B,uCAAwB,kBAAkB,QAAQ;AAC5E;AACA;AACA;AACA,sBAAsB,uCAAwB,YAAY,aAAa,wCAAwC,QAAQ;AACvH;AACA;AACA;AACA,kBAAkB,uCAAwB,YAAY,aAAa;AACnE;AACA,SAAS;AACT;AACA;;;AClCsE;AACE;AACjE,8BAA8B,cAAc,qBAAqB,IAAI;AAC5E;AACA,2BAA2B,kCAAe;AAC1C,WAAW,yBAAyB,CAAC,iCAAc;AACnD;AACA,KAAK;AACL;;;ACR4C","sources":["webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-process/dist-es/getValidatedProcessCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js","webpack://@aws/cloudformation-languageserver/./node_modules/@aws-sdk/credential-provider-process/dist-es/index.js"],"sourcesContent":["import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const getValidatedProcessCredentials = (profileName, data, profiles) => {\n if (data.Version !== 1) {\n throw Error(`Profile ${profileName} credential_process did not return Version 1.`);\n }\n if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {\n throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);\n }\n if (data.Expiration) {\n const currentTime = new Date();\n const expireTime = new Date(data.Expiration);\n if (expireTime < currentTime) {\n throw Error(`Profile ${profileName} credential_process returned expired credentials.`);\n }\n }\n let accountId = data.AccountId;\n if (!accountId && profiles?.[profileName]?.aws_account_id) {\n accountId = profiles[profileName].aws_account_id;\n }\n const credentials = {\n accessKeyId: data.AccessKeyId,\n secretAccessKey: data.SecretAccessKey,\n ...(data.SessionToken && { sessionToken: data.SessionToken }),\n ...(data.Expiration && { expiration: new Date(data.Expiration) }),\n ...(data.CredentialScope && { credentialScope: data.CredentialScope }),\n ...(accountId && { accountId }),\n };\n setCredentialFeature(credentials, \"CREDENTIALS_PROCESS\", \"w\");\n return credentials;\n};\n","import { CredentialsProviderError, externalDataInterceptor } from \"@smithy/core/config\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { getValidatedProcessCredentials } from \"./getValidatedProcessCredentials\";\nexport const resolveProcessCredentials = async (profileName, profiles, logger) => {\n const profile = profiles[profileName];\n if (profiles[profileName]) {\n const credentialProcess = profile[\"credential_process\"];\n if (credentialProcess !== undefined) {\n const execPromise = promisify(externalDataInterceptor?.getTokenRecord?.().exec ?? exec);\n try {\n const { stdout } = await execPromise(credentialProcess);\n let data;\n try {\n data = JSON.parse(stdout.trim());\n }\n catch {\n throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);\n }\n return getValidatedProcessCredentials(profileName, data, profiles);\n }\n catch (error) {\n throw new CredentialsProviderError(error.message, { logger });\n }\n }\n else {\n throw new CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });\n }\n }\n else {\n throw new CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {\n logger,\n });\n }\n};\n","import { getProfileName, parseKnownFiles } from \"@smithy/core/config\";\nimport { resolveProcessCredentials } from \"./resolveProcessCredentials\";\nexport const fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-process - fromProcess\");\n const profiles = await parseKnownFiles(init);\n return resolveProcessCredentials(getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n }), profiles, init.logger);\n};\n","export { fromProcess } from \"./fromProcess\";\n"],"names":[],"sourceRoot":""}
|