mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-08-24 04:25:05 +09:00
Compare commits
273 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 61815dcd50 | |||
| 56d6a583f0 | |||
| 4a54c24244 | |||
| b2793c943d | |||
| 8c230bf21d | |||
| f7a5b07d53 | |||
| 730fc04382 | |||
| bc0dd36aec | |||
| f2964c7281 | |||
| cf464951be | |||
| 14f860bb8e | |||
| 02adcee6f2 | |||
| fd7505160d | |||
| 808f17c380 | |||
| 6e3512ff0e | |||
| 2475ef7675 | |||
| d020ce65bb | |||
| 9dfa9aa010 | |||
| dc177b0cb5 | |||
| e6b10e1b9a | |||
| 0a72677904 | |||
| 9c6d2df54d | |||
| 5198eea6a8 | |||
| bf07717bcd | |||
| 781ccd3347 | |||
| 6b20e81005 | |||
| e82302327e | |||
| d2665a1bab | |||
| 529b4c7f3b | |||
| 0d00a56e02 | |||
| 058e7b6336 | |||
| d89ed6b36e | |||
| 5d603e1316 | |||
| 5dc01dbae8 | |||
| 2ff97a3c6c | |||
| d17e5e49d8 | |||
| ed0c759578 | |||
| 776d30ea75 | |||
| 76b4475187 | |||
| 06083b7564 | |||
| 7b61d013d9 | |||
| 188b7fa96d | |||
| 2915cb333f | |||
| f74340c85e | |||
| 9a4d0ad460 | |||
| 7bf7fb2669 | |||
| 00943011d9 | |||
| e381dc357a | |||
| 031a65bdc1 | |||
| 9efe715a4b | |||
| 6bbafa679f | |||
| 4c879b4d5d | |||
| fb52c697f2 | |||
| f226b0540e | |||
| be2cf0c768 | |||
| 0be22f94c3 | |||
| 555a8e9ce6 | |||
| 6e562ac9ab | |||
| 4283504248 | |||
| 3146acf819 | |||
| 8688f2d5c1 | |||
| 56c08aa702 | |||
| eda31a964a | |||
| 8b7cc57256 | |||
| 351d894493 | |||
| 1584b8b0e2 | |||
| b845e0f4f4 | |||
| cea42985ac | |||
| 6b19f7ffe6 | |||
| 97ef425d73 | |||
| 6bf15574d0 | |||
| 3cb849cb01 | |||
| dde9b22a8e | |||
| 5ebd15afc6 | |||
| c7a2280e36 | |||
| 3de82418a6 | |||
| a3143e85cf | |||
| 3c23363139 | |||
| 44e57d426c | |||
| b876879204 | |||
| 8e2d02296b | |||
| fb3078e4c8 | |||
| 0994a359d5 | |||
| 1ec058b7a1 | |||
| 163b496f8b | |||
| f2e9d495b0 | |||
| a03048d875 | |||
| 337f510212 | |||
| f001d79eaa | |||
| cf5f2acba3 | |||
| b394bdd9f0 | |||
| b632c0b5e4 | |||
| 978e44aa36 | |||
| c4be498953 | |||
| c5a43c32e1 | |||
| 8c45f6b081 | |||
| a5c87b6a6b | |||
| 45a41642bb | |||
| cb3b499674 | |||
| ec8e002276 | |||
| 1b2b73eb6a | |||
| e30ac4daac | |||
| 195dc25ad5 | |||
| c284255d3b | |||
| bee3104844 | |||
| 241c954d31 | |||
| 0eb446ecb2 | |||
| bd1e9e7da1 | |||
| 0be2363ca1 | |||
| 74b3e27aa8 | |||
| df886f22da | |||
| a688da0051 | |||
| 4a45167436 | |||
| 0928ae2f74 | |||
| 28c84c0297 | |||
| 09a74e37ce | |||
| 3821430d17 | |||
| 3df3b9e987 | |||
| a91a6303b8 | |||
| 209f2a4450 | |||
| 92fa2639a8 | |||
| 5505db6539 | |||
| 51e8c081a1 | |||
| 00dc4f2d3d | |||
| 24a1539a9c | |||
| 4cc620671e | |||
| aa1f74b81b | |||
| 2de20cdfbc | |||
| 7474bc4690 | |||
| be2e7ad815 | |||
| 4a9906ba73 | |||
| 83a7f06197 | |||
| b8b4fdbcd4 | |||
| d0834ad3a6 | |||
| 3f7c218721 | |||
| c7b374462f | |||
| cbea70821e | |||
| 9581336d17 | |||
| 51f5560378 | |||
| d343995f27 | |||
| 59b441846a | |||
| 9fa0b155aa | |||
| 59489ba544 | |||
| a021b96993 | |||
| e7ec4b66d5 | |||
| 5b3c895046 | |||
| 63b1cdc38a | |||
| fc2b804e37 | |||
| 243d714529 | |||
| 9227d6ee4a | |||
| 84ac3de26c | |||
| cfc1102463 | |||
| 0ed0e57cf8 | |||
| 5fd1747fbc | |||
| 6b8bbaed05 | |||
| 8128bbdaac | |||
| 77e8c97f17 | |||
| b09a246f74 | |||
| 10850c9616 | |||
| a31e903eec | |||
| b88116ba3b | |||
| 68858db075 | |||
| 93f10a2e06 | |||
| fd13a40502 | |||
| a159d7bb53 | |||
| a9a3826013 | |||
| f503a18704 | |||
| 66d12fc03b | |||
| 37fe9a740b | |||
| 0d129e7d87 | |||
| 3d8cba388a | |||
| a19327083a | |||
| bca7d38ca4 | |||
| 3bb878b6ab | |||
| 3c7407c187 | |||
| 20ef22c966 | |||
| a95656fcd9 | |||
| 15a2ebe5a0 | |||
| 875428c99e | |||
| f03bfa9b96 | |||
| a93de34720 | |||
| ab0ba40832 | |||
| c3b3ce61b0 | |||
| 33adce1577 | |||
| 3d90187bb1 | |||
| 6f3d50aafb | |||
| aeb75711d0 | |||
| 7a01614d60 | |||
| b7878cdf5c | |||
| 0adfac7013 | |||
| 243e417dfd | |||
| 308756d6c3 | |||
| 151e7fee89 | |||
| a275d07fc4 | |||
| 2d7f362573 | |||
| b92d0d98bf | |||
| ff4bb8c1f9 | |||
| 2092c6a253 | |||
| ca88fa5aed | |||
| 91b1921080 | |||
| 34b52a3920 | |||
| 439a529737 | |||
| 244b4ca7be | |||
| 21cf8e5f31 | |||
| 6ccac84ceb | |||
| e20bc6c550 | |||
| 97c66b881d | |||
| ffa925d298 | |||
| b475783126 | |||
| e56e6c4038 | |||
| c0573b22e0 | |||
| df9c8fed6b | |||
| e7aeb52aa2 | |||
| 51886263f2 | |||
| a7d7b7872a | |||
| e10de4c3ea | |||
| 85f7c4ce7f | |||
| f24d7193d9 | |||
| f6095d9dc4 | |||
| df1fa04984 | |||
| 1c397386a2 | |||
| 21e0c4b1ca | |||
| b0f2baf098 | |||
| 4320d1b180 | |||
| 5d1959cbc9 | |||
| 3ecfae8a2c | |||
| 2f26d75abd | |||
| 658557f884 | |||
| f157a6574f | |||
| 9e38641911 | |||
| 2c168adcae | |||
| 4d5f2395c0 | |||
| a4f326760c | |||
| 93edf43b3a | |||
| fe54dce1bb | |||
| 423f4e15fb | |||
| 11e58be8bc | |||
| 7f5e3139fe | |||
| 5a0cf0167f | |||
| adb43a2cd3 | |||
| e62ae06aa8 | |||
| 66d7591932 | |||
| 76dfa67953 | |||
| ab246ce5fb | |||
| ca537c9527 | |||
| 72a198126f | |||
| 203a39c651 | |||
| c401b8a98c | |||
| 27e906a655 | |||
| 483d6b517a | |||
| c7765366a4 | |||
| ececac1a45 | |||
| 16fec6080f | |||
| eb70354fb4 | |||
| 3478c15aa1 | |||
| a69d38c39d | |||
| 6b1d0f829d | |||
| f021516513 | |||
| 1c8dbbcc02 | |||
| ce290d67fe | |||
| 1780ebd97b | |||
| a02ef26683 | |||
| 5fbd2e409b | |||
| f0af89b102 | |||
| b9ee51dc60 | |||
| 66c00faf39 | |||
| 134d71efe0 | |||
| b8ef615781 | |||
| e5b9735585 | |||
| 79ebbb3141 | |||
| 7f029f3507 | |||
| 39fd91c08e | |||
| cf624fbdad |
@@ -0,0 +1,6 @@
|
||||
Port 9999
|
||||
Listen 127.0.0.1
|
||||
Timeout 600
|
||||
Allow 127.0.0.1
|
||||
LogFile "/home/runner/work/configure-aws-credentials/configure-aws-credentials/integ_proxy_log.txt"
|
||||
LogLevel Connect
|
||||
@@ -9,14 +9,11 @@ jobs:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
if: >-
|
||||
github.event.review.state == 'approved' &&
|
||||
github.event.repository == 'aws/configure-aws-credentials' &&
|
||||
(github.event.review.author_association == 'OWNER' || github.event.review.user.login == 'aws-sdk-osds')
|
||||
if: ${{ github.event.review.state == 'approved' && github.repository == 'aws-actions/configure-aws-credentials' && (github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.user.login == 'aws-sdk-osds') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
@@ -27,7 +24,7 @@ jobs:
|
||||
with:
|
||||
parse-json-secrets: true
|
||||
secret-ids: |
|
||||
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
|
||||
${{ secrets.OSDS_PACKAGING_ROLE }}
|
||||
- name: Enable PR automerge
|
||||
run: gh pr merge --auto --squash "$PR_URL"
|
||||
env:
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Test Configure AWS Credential
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
cawsc:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: CAWSC
|
||||
uses: aws-actions/configure-aws-credentials@main
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
role-duration-seconds: 900
|
||||
role-session-name: TestCAWSC
|
||||
- name: Whoami
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
@@ -1,30 +1,34 @@
|
||||
name: Dependabot auto-approve
|
||||
on: pull_request
|
||||
on:
|
||||
pull_request_target:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
contents: read
|
||||
jobs:
|
||||
dependabot:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'aws/configure-aws-credentials'
|
||||
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
steps:
|
||||
- name: Get Metadata
|
||||
id: dependabot-metadata
|
||||
uses: dependabot/fetch-metadata@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
name: Clone repo
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
role-to-assume: ${{ secrets.CONFIGUREAWSCREDENTIALSPACKAGEROLEARN }}
|
||||
role-duration-seconds: 900
|
||||
role-session-name: SecretsManagerFetch
|
||||
- name: Get bot user token
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@v2
|
||||
with:
|
||||
parse-json-secrets: true
|
||||
secret-ids: |
|
||||
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
|
||||
${{ secrets.OSDS_PACKAGING_ROLE }}
|
||||
- name: Approve PR if not already approved
|
||||
run: |
|
||||
gh pr checkout "$PR_URL"
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref_name }}
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
npm test
|
||||
npm run package
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
with:
|
||||
parse-json-secrets: true
|
||||
secret-ids: |
|
||||
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
|
||||
${{ secrets.OSDS_PACKAGING_ROLE }}
|
||||
- name: Commit
|
||||
run: |
|
||||
echo "::add-mask::${{ env.OSDS_ACCESS_TOKEN }}"
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
@@ -32,7 +32,7 @@
|
||||
with:
|
||||
parse-json-secrets: true
|
||||
secret-ids: |
|
||||
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
|
||||
${{ secrets.OSDS_PACKAGING_ROLE }}
|
||||
|
||||
- name: Run release-please
|
||||
uses: googleapis/release-please-action@v4
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Run post-release integration test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'dist/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
package_and_test:
|
||||
name: Package dist files
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Integation tests
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.CAWSC_integ_role }}
|
||||
role-session-name: IntegTestCAWSC
|
||||
- name: Get caller identity
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
@@ -0,0 +1,202 @@
|
||||
name: Run pre-release integ tests
|
||||
on:
|
||||
pull_request_target:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
oidc:
|
||||
if: ${{ github.event.pull_request.user.login == 'aws-sdk-osds' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: OIDC login test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Configure AWS credentials
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.OIDC_integ_role }}
|
||||
- name: Get Caller Identity
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
|
||||
#can cut this test out if it's not necessary
|
||||
static_assumeRole:
|
||||
if: ${{ github.event.pull_request.user.login == 'aws-sdk-osds' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Static IAM creds test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Configure AWS credentials
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
aws-access-key-id: ${{ secrets.STATIC_ak_id }}
|
||||
aws-secret-access-key: ${{ secrets.STATIC_secret_ak }}
|
||||
role-to-assume: ${{ secrets.STATIC_role }}
|
||||
- name: Get Caller Identity
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
|
||||
role_chaining:
|
||||
if: ${{ github.event.pull_request.user.login == 'aws-sdk-osds' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Existing Creds + Role Chaining test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Configure AWS credentials
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.ROLE_chaining_1 }}
|
||||
- name: Get Caller Identity
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
- name: assume second role
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.ROLE_chaining_2 }}
|
||||
role-chaining: true
|
||||
- name: get caller identity
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
|
||||
inline_policy:
|
||||
if: ${{ github.event.pull_request.user.login == 'aws-sdk-osds' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Inline Policy Test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: get creds w scoped down policy
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.INLINE_policy_role }}
|
||||
inline-session-policy: '{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:ListAllMyBuckets","Resource":"*"}]}'
|
||||
|
||||
#NOTE: This step should succeed. The role should have permission only to list all buckets.
|
||||
- name: list buckets
|
||||
run: aws s3 ls > /dev/null
|
||||
|
||||
#NOTE: This step should fail. we don't want the role to have permission to see the bucket contents.
|
||||
- name: try to list bucket contents
|
||||
id: bucketContentsStep
|
||||
continue-on-error: true
|
||||
run: aws s3 ls s3://cawsc-integ-tests-bucket > /dev/null
|
||||
|
||||
#But the test fails if we could list the bucket contents.
|
||||
- name: fail if we can list bucket contents
|
||||
if: steps.bucketContentsStep.outcome == 'success'
|
||||
run: exit 1
|
||||
|
||||
http-proxy:
|
||||
if: ${{ github.event.pull_request.user.login == 'aws-sdk-osds' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
runs-on: ubuntu-latest
|
||||
name: HTTP Proxy Test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: install tinyproxy
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install tinyproxy
|
||||
- name: start tinyproxy
|
||||
run: tinyproxy -c .github/integ_tests/tinyproxy.conf
|
||||
- name: Configure AWS credentials
|
||||
continue-on-error: true
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.OIDC_integ_role }}
|
||||
http-proxy: http://127.0.0.1:9999
|
||||
retry-max-attempts: 4
|
||||
- name: checkout logs
|
||||
run: cat integ_proxy_log.txt
|
||||
- name: check logs to see if successful call
|
||||
run: grep -q "Request" integ_proxy_log.txt && echo "PROXY_CALL_LOGGED=1" >> $GITHUB_ENV || echo "PROXY_CALL_LOGGED=0" >> $GITHUB_ENV
|
||||
- name: fail job if bad call
|
||||
if: ${{ env.PROXY_CALL_LOGGED != 1 }}
|
||||
run: exit 1
|
||||
|
||||
token-file:
|
||||
if: ${{ github.event.pull_request.user.login == 'aws-sdk-osds' && github.repository == 'aws-actions/configure-aws-credentials' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Token File Test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: fetch token and write to file
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
async function getIDTokenAction() {
|
||||
const id_token = await core.getIDToken("sts.amazonaws.com");
|
||||
return id_token;
|
||||
}
|
||||
const idToken = await getIDTokenAction();
|
||||
fs.writeFileSync(".github/integ_tests/integ_token.txt", idToken, (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
- name: get creds with that file
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.OIDC_integ_role }}
|
||||
web-identity-token-file: .github/integ_tests/integ_token.txt
|
||||
retry-max-attempts: 4
|
||||
- name: check creds
|
||||
run: aws sts get-caller-identity
|
||||
@@ -1,112 +0,0 @@
|
||||
name: Run Integ tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
integ-oidc:
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
name: Run OIDC integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for OIDC
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_OIDC_AWS_ROLE_TO_ASSUME }}
|
||||
role-duration-seconds: 900
|
||||
role-session-name: IntegOidcAssumeRole
|
||||
role-external-id: ${{ secrets.SECRETS_OIDC_AWS_ROLE_EXTERNAL_ID }}
|
||||
integ-oidc-env:
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
name: Run OIDC integ tests with existing invalid env vars
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: dummyaccesskeyid
|
||||
AWS_SECRET_ACCESS_KEY: dummysecretkey
|
||||
AWS_SESSION_TOKEN: dummytoken
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for OIDC
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_OIDC_AWS_ROLE_TO_ASSUME }}
|
||||
role-duration-seconds: 900
|
||||
role-session-name: IntegOidcAssumeRole
|
||||
role-external-id: ${{ secrets.SECRETS_OIDC_AWS_ROLE_EXTERNAL_ID }}
|
||||
integ-access-keys:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
name: Run access key integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for access keys
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_ROLE_TO_ASSUME }}
|
||||
role-session-name: IntegAccessKeysAssumeRole
|
||||
role-external-id: ${{ secrets.SECRETS_AWS_ROLE_EXTERNAL_ID }}
|
||||
integ-access-keys-env:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
name: Run access key from env integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for access keys
|
||||
uses: ./
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_ROLE_TO_ASSUME }}
|
||||
role-session-name: IntegAccessKeysAssumeRole
|
||||
role-external-id: ${{ secrets.SECRETS_AWS_ROLE_EXTERNAL_ID }}
|
||||
integ-iam-user:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
name: Run IAM User integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for IAM user
|
||||
uses: ./
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
@@ -2,6 +2,8 @@ on:
|
||||
[pull_request]
|
||||
|
||||
name: Run unit tests
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
unit-test:
|
||||
@@ -14,13 +16,13 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v4.4.0
|
||||
with:
|
||||
node-version: 20
|
||||
- name: "Install dependencies"
|
||||
uses: bahmutov/npm-install@v1
|
||||
run: npm ci
|
||||
- name: "Run tests"
|
||||
run: npm run test --if-present
|
||||
lint:
|
||||
@@ -29,7 +31,7 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: "Checkout repostiory"
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
".release-please-manifest.json": "4.0.2",
|
||||
"package.json": "4.0.2",
|
||||
".": "4.0.3"
|
||||
".": "5.1.1"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,105 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [5.1.1](https://github.com/aws-actions/configure-aws-credentials/compare/v5.1.0...v5.1.1) (2025-11-24)
|
||||
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
* release 5.1.1 ([56d6a58](https://github.com/aws-actions/configure-aws-credentials/commit/56d6a583f00f6bad6d19d91d53a7bc3b8143d0e9))
|
||||
|
||||
## [5.1.0](https://github.com/aws-actions/configure-aws-credentials/compare/v5.0.0...v5.1.0) (2025-10-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add global timeout support ([#1487](https://github.com/aws-actions/configure-aws-credentials/issues/1487)) ([1584b8b](https://github.com/aws-actions/configure-aws-credentials/commit/1584b8b0e2062557287c28fbe9b8920df434e866))
|
||||
* add no-proxy support ([#1482](https://github.com/aws-actions/configure-aws-credentials/issues/1482)) ([dde9b22](https://github.com/aws-actions/configure-aws-credentials/commit/dde9b22a8e889a0821997a21a2c5a38020ee8de3))
|
||||
* Improve debug logging in retry logic ([#1485](https://github.com/aws-actions/configure-aws-credentials/issues/1485)) ([97ef425](https://github.com/aws-actions/configure-aws-credentials/commit/97ef425d73aa532439f54f90d0e83101a186c5a6))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* properly expose getProxyForUrl (introduced in [#1482](https://github.com/aws-actions/configure-aws-credentials/issues/1482)) ([#1486](https://github.com/aws-actions/configure-aws-credentials/issues/1486)) ([cea4298](https://github.com/aws-actions/configure-aws-credentials/commit/cea42985ac88b42678fbc84c18066a7f07f05176))
|
||||
|
||||
## [5.0.0](https://github.com/aws-actions/configure-aws-credentials/compare/v4.3.1...v5.0.0) (2025-09-03)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* Cleanup input handling. Changes invalid boolean input behavior (see #1445)
|
||||
|
||||
### Features
|
||||
|
||||
* add skip OIDC option ([#1458](https://github.com/aws-actions/configure-aws-credentials/issues/1458)) ([8c45f6b](https://github.com/aws-actions/configure-aws-credentials/commit/8c45f6b08196feb86cfdbe431541d5571d9ab2c2))
|
||||
* Cleanup input handling. Changes invalid boolean input behavior (see [#1445](https://github.com/aws-actions/configure-aws-credentials/issues/1445)) ([74b3e27](https://github.com/aws-actions/configure-aws-credentials/commit/74b3e27aa80db064b5bb8c04b22fc607e817acf7))
|
||||
* support account id allowlist ([#1456](https://github.com/aws-actions/configure-aws-credentials/issues/1456)) ([c4be498](https://github.com/aws-actions/configure-aws-credentials/commit/c4be498953fc1da2707a50ce4b761a53af3d02af))
|
||||
|
||||
## [4.3.1](https://github.com/aws-actions/configure-aws-credentials/compare/v4.3.0...v4.3.1) (2025-08-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update readme to 4.3.1 ([#1424](https://github.com/aws-actions/configure-aws-credentials/issues/1424)) ([be2e7ad](https://github.com/aws-actions/configure-aws-credentials/commit/be2e7ad815e27b890489a89ce2717b0f9e26b56e))
|
||||
|
||||
## [4.3.0](https://github.com/aws-actions/configure-aws-credentials/compare/v4.2.1...v4.3.0) (2025-08-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* depenency update and feature cleanup ([#1414](https://github.com/aws-actions/configure-aws-credentials/issues/1414)) ([59489ba](https://github.com/aws-actions/configure-aws-credentials/commit/59489ba544930000b7b67412c167f5fe816568cf)), closes [#1062](https://github.com/aws-actions/configure-aws-credentials/issues/1062) [#1191](https://github.com/aws-actions/configure-aws-credentials/issues/1191)
|
||||
* Optional environment variable output ([c3b3ce6](https://github.com/aws-actions/configure-aws-credentials/commit/c3b3ce61b02510937ff02916a4eb153874bc5085))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **docs:** readme samples versioning ([5b3c895](https://github.com/aws-actions/configure-aws-credentials/commit/5b3c89504689ea1ea2b6000b23a6a2aac463662a))
|
||||
* the wrong example region for China partition in README ([37fe9a7](https://github.com/aws-actions/configure-aws-credentials/commit/37fe9a740bcb30ee8cccd96feb90666c937311f2))
|
||||
* properly set proxy environment variable ([cbea708](https://github.com/aws-actions/configure-aws-credentials/commit/cbea70821e4ab985ad3be0e5a93390523e257cde))
|
||||
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
* release 4.3.0 ([3f7c218](https://github.com/aws-actions/configure-aws-credentials/commit/3f7c2187213bafaa1ea60a850b27082cbf55dda0))
|
||||
|
||||
## [4.2.1](https://github.com/aws-actions/configure-aws-credentials/compare/v4.2.0...v4.2.1) (2025-05-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ensure explicit inputs take precedence over environment variables ([e56e6c4](https://github.com/aws-actions/configure-aws-credentials/commit/e56e6c4038915cd5a7238a671fe97f44c98a40b0))
|
||||
* prioritize explicit inputs over environment variables ([df9c8fe](https://github.com/aws-actions/configure-aws-credentials/commit/df9c8fed6b364f0d1fb0e6e03a0ec26f1ea4e3fc))
|
||||
|
||||
## [4.2.0](https://github.com/aws-actions/configure-aws-credentials/compare/v4.1.0...v4.2.0) (2025-05-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add Expiration field to Outputs ([a4f3267](https://github.com/aws-actions/configure-aws-credentials/commit/a4f326760c1c1bf49ab86051c658d6501816b930))
|
||||
* Document role-duration-seconds range ([5a0cf01](https://github.com/aws-actions/configure-aws-credentials/commit/5a0cf0167f837dfa7af7d951ba6a78a38dc2b79e))
|
||||
* support action inputs as environment variables ([#1338](https://github.com/aws-actions/configure-aws-credentials/issues/1338)) ([2c168ad](https://github.com/aws-actions/configure-aws-credentials/commit/2c168adcae62d67531ba83842723c8f30695116a))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make sure action builds, also fix dependabot autoapprove ([c401b8a](https://github.com/aws-actions/configure-aws-credentials/commit/c401b8a98c5067672f52e0387cdd87d54acfe1fd))
|
||||
* role chaning on mulitple runs ([#1340](https://github.com/aws-actions/configure-aws-credentials/issues/1340)) ([9e38641](https://github.com/aws-actions/configure-aws-credentials/commit/9e386419117a9edd458297e4f1822a5df7506a03))
|
||||
|
||||
## [4.1.0](https://github.com/aws-actions/configure-aws-credentials/compare/v4.0.3...v4.1.0) (2025-02-08)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* idempotent fetch ([#1289](https://github.com/aws-actions/configure-aws-credentials/issues/1289)) ([eb70354](https://github.com/aws-actions/configure-aws-credentials/commit/eb70354fb423a380b6e4ab4b9f15d2ee9ffae911))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* build failure due to tests ([#1283](https://github.com/aws-actions/configure-aws-credentials/issues/1283)) ([134d71e](https://github.com/aws-actions/configure-aws-credentials/commit/134d71efe0ecbe9ad6965f2f766c0cae63a7685f))
|
||||
* Dependabot autoapprove ([#1284](https://github.com/aws-actions/configure-aws-credentials/issues/1284)) ([b9ee51d](https://github.com/aws-actions/configure-aws-credentials/commit/b9ee51dc600fe38c892e24f60ca26476e0e0b6de))
|
||||
* Dependabot autoapprove id-token write permission ([#1285](https://github.com/aws-actions/configure-aws-credentials/issues/1285)) ([f0af89b](https://github.com/aws-actions/configure-aws-credentials/commit/f0af89b102390dcf10ce402195d74a98f24861f3))
|
||||
* typo ([#1281](https://github.com/aws-actions/configure-aws-credentials/issues/1281)) ([39fd91c](https://github.com/aws-actions/configure-aws-credentials/commit/39fd91c08ed8bf770034de4e62662503e8007d76))
|
||||
|
||||
## [4.0.3](https://github.com/aws-actions/configure-aws-credentials/compare/v4.0.2...v4.0.3) (2025-01-27)
|
||||
|
||||
|
||||
|
||||
@@ -1,98 +1,130 @@
|
||||
## Configure AWS Credentials for GitHub Actions
|
||||
Configure your AWS credentials and region environment variables for use in other
|
||||
GitHub Actions.
|
||||
Configure AWS Credentials
|
||||
=========================
|
||||
Authenticate to AWS in GitHub Actions! Works especially well with [AWS Secrets
|
||||
Manager](https://github.com/aws-actions/aws-secretsmanager-get-secrets).
|
||||
|
||||
This action implements the AWS JavaScript SDK credential resolution chain
|
||||
and exports session environment variables for your other Actions to use.
|
||||
Environment variable exports are detected by both the AWS SDKs and the AWS CLI
|
||||
for AWS API calls.
|
||||
Quick Start (OIDC, recommended)
|
||||
-------------------------------
|
||||
1. Create an IAM Identity Provider in your AWS account for GitHub OIDC. (See
|
||||
[OIDC configuration](#oidc-configuration) below for details.)
|
||||
2. Create an IAM Role in your AWS account with a trust policy that allows GitHub
|
||||
Actions to assume it:
|
||||
<details>
|
||||
<summary>GitHub OIDC Trust Policy</summary>
|
||||
|
||||
## Overview
|
||||
API calls to AWS need to be signed with credential information, so when you use
|
||||
one of the AWS SDKs or an AWS tool, you must provide it with AWS credentials and
|
||||
and AWS region. One way to do that in GitHub Actions is to use a repository
|
||||
secret with IAM credentials, but this doesn't follow [AWS security
|
||||
guidelines](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html)
|
||||
on using long term credentials. Instead, we recommend that you use a long term
|
||||
credential or JWT to fetch a temporary credential, and use that with your tools
|
||||
instead. This GitHub Action facilitates just that.
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"Federated": "arn:aws:iam::<AWS_ACCOUNT_ID>:oidc-provider/token.actions.githubusercontent.com"
|
||||
},
|
||||
"Action": "sts:AssumeRoleWithWebIdentity",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
|
||||
"token.actions.githubusercontent.com:sub": "repo:<GITHUB_ORG>/<GITHUB_REPOSITORY>:ref:refs/heads/<GITHUB_BRANCH>"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</details>
|
||||
3. Attach permissions to the IAM Role that allow it to access the AWS resources
|
||||
you need.
|
||||
4. Add the following to your GitHub Actions workflow:
|
||||
<details>
|
||||
<summary>Example Workflow</summary>
|
||||
|
||||
AWS SDKs and Tools look for your credentials in standardized environment
|
||||
variables. In essence, this Action runs through the standard [credential
|
||||
resolution flow](https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html),
|
||||
and at the end, exports environment variables for you to use later.
|
||||
```yaml
|
||||
# Need ID token write permission to use OIDC
|
||||
permissions:
|
||||
id-token: write
|
||||
jobs:
|
||||
run_job_with_aws:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@main # Or a specific version
|
||||
with:
|
||||
role-to-assume: <Role ARN you created in step 2>
|
||||
aws-region: <AWS Region you want to use>
|
||||
- name: Additional steps
|
||||
run: |
|
||||
# Your commands that require AWS credentials
|
||||
aws sts get-caller-identity
|
||||
```
|
||||
</details>
|
||||
That's it! Your GitHub Actions workflow can now access AWS resources using the
|
||||
IAM Role you created. Other authentication scenarios are also supported (see
|
||||
below).
|
||||
|
||||
We support five methods for fetching credentials from AWS, but we recommend that
|
||||
you use GitHub's OIDC provider in conjunction with a configured AWS IAM
|
||||
Identity Provider endpoint.
|
||||
Security Recommendations
|
||||
------------------------
|
||||
* Use temporary credentials when possible. OIDC is recommended because it
|
||||
provides temporary credentials and it's easy to set up.
|
||||
* Do not store credentials in your repository's code. Consider using
|
||||
[git-secrets](https://github.com/awslabs/git-secrets) to prevent committing
|
||||
secrets to your repository.
|
||||
* [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege)
|
||||
to your workflows. Grant only those permissions that are necessary for the
|
||||
workflow to run.
|
||||
* [Monitor the activity](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#keep-a-log)
|
||||
of the credentials used in workflows.
|
||||
* Periodically rotate any long-lived credentials that you use.
|
||||
* Store sensitive information in a secure way, such as using
|
||||
[AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) or
|
||||
[GitHub Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets).
|
||||
|
||||
For more information on how to do that, read on.
|
||||
Other Authentication Scenarios
|
||||
------------------------------
|
||||
This action supports five different authentication methods that are configured
|
||||
by specifying different inputs.
|
||||
|
||||
### Note about GHES
|
||||
|
||||
Some of this documentation may be inaccurate if you are using GHES (GitHub
|
||||
Enterprise Server), please take note to review the GitHub documentation when
|
||||
relevant.
|
||||
|
||||
For example, the URL that the OIDC JWT is issued from is different than the
|
||||
usual `token.actions.githubusercontent.com`, and will be unique to your
|
||||
enterprise server. As a result, you will need to configure this differently when
|
||||
you create the Identity Provider.
|
||||
|
||||
We do not presently have a GHES testing environment to validate this action. If
|
||||
you are running in GHES and encounter problems, please
|
||||
[let us know](https://github.com/aws-actions/configure-aws-credentials/issues/new/choose).
|
||||
|
||||
## Security recommendations
|
||||
|
||||
We recommend following
|
||||
[Amazon IAM best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)
|
||||
for the AWS credentials used in GitHub Actions workflows, including:
|
||||
* Do not store credentials in your repository's code.
|
||||
* [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege)
|
||||
to the credentials used in GitHub Actions workflows. Grant only the
|
||||
permissions required to perform the actions in your GitHub Actions workflows.
|
||||
Do not assume overly permissive roles, even for testing.
|
||||
* [Monitor the activity](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#keep-a-log)
|
||||
of the credentials used in GitHub Actions workflows.
|
||||
* Use temporary credentials when possible.
|
||||
* Periodically rotate any long-term credentials you use.
|
||||
|
||||
## Using this action
|
||||
There are five different supported ways to retrieve credentials:
|
||||
|
||||
- Using GitHub's OIDC provider (`AssumeRoleWithWebIdentity`)
|
||||
- Proceeding as an IAM user (No STS call is made)
|
||||
- Using access keys as action input (`AssumeRole`)
|
||||
- Using a WebIdentity Token File (`AssumeRoleWithWebIdentity`)
|
||||
- Using existing credentials in your runner (`AssumeRole`)
|
||||
1. Use a `core.getIDToken()` call to authenticate via OIDC.
|
||||
2. Re-export existing long-lived IAM credentials (access key ID and secret
|
||||
access key) as environment variables.
|
||||
3. Use static credentials stored in GitHub Secrets to fetch temporary
|
||||
credentials via STS AssumeRole.
|
||||
4. Use a Web Identity Token to fetch temporary credentials via STS
|
||||
AssumeRoleWithWebIdentity.
|
||||
5. Use credentials stored in the Action environment to fetch temporary
|
||||
credentials via STS AssumeRole.
|
||||
|
||||
Because we use the AWS JavaScript SDK, we always will use the [credential
|
||||
resolution flow for Node.js](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html).
|
||||
Depending on your inputs, the action might override parts of this flow.
|
||||
|
||||
We recommend using the first option above: [GitHub's OIDC provider](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services).
|
||||
This method uses OIDC to get short-lived credentials needed for your actions.
|
||||
See [OIDC](#OIDC) for more information on how to setup your AWS account to
|
||||
assume a role with OIDC.
|
||||
<details>
|
||||
<summary>Inputs and their effects on the credential resolution flow</summary>
|
||||
|
||||
The following table describes which method we'll use to get your credentials
|
||||
based on which values are supplied to the Action:
|
||||
|
||||
| **Identity Used** | `aws-access-key-id` | `role-to-assume` | `web-identity-token-file` | `role-chaining` | `id-token` permission
|
||||
| --------------------------------------------------------------- | ------------------- | ---------------- | ------------------------- | - | - |
|
||||
| [✅ Recommended] Assume Role directly using GitHub OIDC provider | | ✔ | | | ✔ |
|
||||
| IAM User | ✔ | | | | |
|
||||
| Assume Role using IAM User credentials | ✔ | ✔ | | | |
|
||||
| Assume Role using WebIdentity Token File credentials | | ✔ | ✔ | | |
|
||||
| Assume Role using existing credentials | | ✔ | | ✔ | |
|
||||
| **Identity Used** | `aws-access-key-id` | `role-to-assume` | `web-identity-token-file` | `role-chaining` |
|
||||
| ---------------------------------------- | ------------------- | ---------------- | ------------------------- | --------------- |
|
||||
| [✅ Recommended] GitHub OIDC | | ✔ | | |
|
||||
| IAM User (no AssumeRole) | ✔ | | | |
|
||||
| AssumeRole using static IAM credentials | ✔ | ✔ | | |
|
||||
| AssumeWithWebIdentity use a token file | | ✔ | ✔ | |
|
||||
| AssumeRole using existing credentials | | ✔ | | ✔ |
|
||||
|
||||
*Note: `role-chaining` is not always necessary to use existing credentials.
|
||||
If you're getting a "Credentials loaded by the SDK do not match" error,
|
||||
try enabling this option.*
|
||||
</details>
|
||||
|
||||
Additionally, **`aws-region`** is always required.
|
||||
|
||||
*Note: If you use GitHub Enterprise Server, you must use the you may need to
|
||||
adjust examples here to match your environment.*
|
||||
|
||||
Additional Options
|
||||
------------------
|
||||
### Options
|
||||
See [action.yml](./action.yml) for more detail.
|
||||
<details>
|
||||
<summary>Options list and descriptions</summary>
|
||||
|
||||
| Option | Description | Required |
|
||||
|---------------------------|---------------------------------------------------------------------------------------------------|----------|
|
||||
@@ -105,32 +137,85 @@ See [action.yml](./action.yml) for more detail.
|
||||
| audience | The JWT audience when using OIDC. Used in non-default AWS partitions, like China regions. | No |
|
||||
| http-proxy | An HTTP proxy to use for API calls. | No |
|
||||
| mask-aws-account-id | AWS account IDs are not considered secret. Setting this will hide account IDs from output anyway. | No |
|
||||
| role-duration-seconds | The assumed role duration in seconds, if assuming a role. Defaults to 1 hour. | No |
|
||||
| role-duration-seconds | The assumed role duration in seconds, if assuming a role. Defaults to 1 hour (3600 seconds). Acceptable values range from 15 minutes (900 seconds) to 12 hours (43200 seconds). | No |
|
||||
| role-external-id | The external ID of the role to assume. Only needed if your role requires it. | No |
|
||||
| role-session-name | Defaults to "GitHubActions", but may be changed if required. | No |
|
||||
| role-skip-session-tagging | Skips session tagging if set. | No |
|
||||
| inline-session-policy | You may further restrict the assumed role policy by defining an inline policy here. | No |
|
||||
| managed-session-policies | You may further restrict the assumed role policy by specifying a managed policy here. | No |
|
||||
| output-credentials | When set, outputs fetched credentials as action step output. Defaults to false. | No |
|
||||
| output-credentials | When set, outputs fetched credentials as action step output. (Outputs aws-access-key-id, aws-secret-access-key, aws-session-token, aws-account-id, authenticated-arn, and aws-expiration). Defaults to false. | No |
|
||||
| output-env-credentials | When set, outputs fetched credentials as environment variables (AWS_REGION, AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN). Defaults to true. Set to false if you need to avoid setting/changing env variables. You'd probably want to use output-credentials if you disable this. (NOTE: Setting to false will prevent the aws-account-id from being exported as a step output). | No |
|
||||
| unset-current-credentials | When set, attempts to unset any existing credentials in your action runner. | No |
|
||||
| disable-retry | Disabled retry/backoff logic for assume role calls. By default, retries are enabled. | No |
|
||||
| retry-max-attempts | Limits the number of retry attempts before giving up. Defaults to 12. | No |
|
||||
| special-characters-workaround | Uncommonly, some environments cannot tolerate special characters in a secret key. This option will retry fetching credentials until the secret access key does not contain special characters. This option overrides disable-retry and retry-max-attempts. | No |
|
||||
| use-existing-credentials | When set, the action will check if existing credentials are valid and exit if they are. Defaults to false. | No |
|
||||
| allowed-account-ids | A comma-delimited list of expected AWS account IDs. The action will fail if we receive credentials for the wrong account. | No |
|
||||
| force-skip-oidc | When set, the action will skip using GitHub OIDC provider even if the id-token permission is set. | No |
|
||||
| action-timeout-s | Global timeout for the action in seconds. If set to a value greater than 0, the action will fail if it takes longer than this time to complete. | No |
|
||||
</details>
|
||||
|
||||
#### Credential Lifetime
|
||||
The default session duration is **1 hour**.
|
||||
#### Adjust the retry mechanism
|
||||
You can configure retry settings for if the STS call fails. By default, we
|
||||
retry with exponential backoff `12` times. You can disable this behavior
|
||||
altogether by setting the `disable-retry` input to `true`, or you can configure
|
||||
the number of times it retries with the `retry-max-attempts` input.
|
||||
|
||||
If you would like to adjust this you can pass a duration to
|
||||
`role-duration-seconds`, but the duration cannot exceed the maximum that was
|
||||
defined when the IAM Role was created.
|
||||
#### Mask account ID
|
||||
Your account ID is not masked by default in workflow logs. You can set the
|
||||
`mask-aws-account-id` input to `true` to mask your account ID in workflow logs
|
||||
if desired.
|
||||
|
||||
#### External ID
|
||||
If your role requires an external ID to assume, you can provide the external ID
|
||||
with the `role-external-id` input
|
||||
#### Unset current credentials
|
||||
Sometimes, existing credentials in your runner can get in the way of the
|
||||
intended outcome. You can set the `unset-current-credentials` input to `true` to
|
||||
work around this issue.
|
||||
|
||||
#### Session tagging and name
|
||||
#### Use an HTTP proxy
|
||||
|
||||
If need use an HTTP proxy you can set it in the action manually. Additionally
|
||||
this action will always consider the `HTTP_PROXY` environment variable.
|
||||
|
||||
<details>
|
||||
<summary>Proxy configuration</summary>
|
||||
|
||||
Manually configured proxy:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: my-github-actions-role
|
||||
http-proxy: "http://companydomain.com:3128"
|
||||
```
|
||||
|
||||
Proxy configured in the environment variable:
|
||||
```bash
|
||||
# Your environment configuration
|
||||
HTTP_PROXY="http://companydomain.com:3128"
|
||||
```
|
||||
</details>
|
||||
|
||||
#### Special characters in AWS_SECRET_ACCESS_KEY
|
||||
Some edge cases are unable to properly parse an `AWS_SECRET_ACCESS_KEY` if it
|
||||
contains special characters. For more information, please see the
|
||||
[AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-troubleshooting.html#tshoot-signature-does-not-match).
|
||||
If you set the `special-characters-workaround` option, this action will
|
||||
continually retry fetching credentials until we get one that does not have
|
||||
special characters. This option overrides the `disable-retry` and
|
||||
`retry-max-attempts` options. We recommend that you do not enable this option
|
||||
unless required, because retrying APIs infinitely until they succeed is not best
|
||||
practice.
|
||||
|
||||
Session Naming and Policies
|
||||
---------------------------
|
||||
The default session name is "GitHubActions", and you can modify it by specifying
|
||||
the desired name in `role-session-name`. The session will be tagged with the
|
||||
the desired name in `role-session-name`.
|
||||
|
||||
*Note: you might find it helpful to set the `role-session-name` to `${{ github.run_id }}`
|
||||
so as to clarify in audit logs which AWS actions were performed by which workflow
|
||||
run.*
|
||||
|
||||
The session will be tagged with the
|
||||
following tags: (Refer to [GitHub's documentation for `GITHUB_` environment
|
||||
variable definitions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables))
|
||||
|
||||
@@ -150,21 +235,7 @@ Particularly, `GITHUB_WORKFLOW` will be truncated if it's too long. If
|
||||
`GITHUB_ACTOR` or `GITHUB_WORKFLOW` contain invalid characters, the characters
|
||||
will be replaced with an '*'._
|
||||
|
||||
The action will use session tagging by default during role assumption, unless
|
||||
you follow our recommendation and are assuming a role with a WebIdentity. For
|
||||
WebIdentity role assumption, the session tags have to be included in the encoded
|
||||
WebIdentity token. This means that tags can only be supplied by the OIDC
|
||||
provider, and they cannot set during the AssumeRoleWithWebIdentity API call
|
||||
within the Action. See [#419](https://github.com/aws-actions/configure-aws-credentials/issues/419)
|
||||
for more information.
|
||||
|
||||
You can skip this session tagging by providing
|
||||
`role-skip-session-tagging` as true in the action's inputs:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-skip-session-tagging: true
|
||||
```
|
||||
The action will use session tagging by default unless you are using OIDC.
|
||||
|
||||
### Session policies
|
||||
Session policies are not required, but they allow you to limit the scope of the
|
||||
@@ -175,15 +246,19 @@ session policy by its ARN.
|
||||
#### Inline session policies
|
||||
An IAM policy in stringified JSON format that you want to use as an inline
|
||||
session policy. Depending on preferences, the JSON could be written on a single
|
||||
line like this:
|
||||
line.
|
||||
|
||||
<details>
|
||||
<summary>Inline session policy examples</summary>
|
||||
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
inline-session-policy: '{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:List*","Resource":"*"}]}'
|
||||
```
|
||||
Or we can have a nicely formatted JSON as well:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
inline-session-policy: >-
|
||||
{
|
||||
@@ -198,56 +273,33 @@ Or we can have a nicely formatted JSON as well:
|
||||
]
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
#### Managed session policies
|
||||
The Amazon Resource Names (ARNs) of the IAM managed policies that you want to
|
||||
use as managed session policies. The policies must exist in the same account as
|
||||
the role. You can pass a single managed policy like this:
|
||||
the role.
|
||||
|
||||
<details>
|
||||
<summary>Managed session policy examples</summary>
|
||||
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
managed-session-policies: arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
|
||||
```
|
||||
And we can pass multiple managed policies likes this:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
managed-session-policies: |
|
||||
arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
|
||||
arn:aws:iam::aws:policy/AmazonS3OutpostsReadOnlyAccess
|
||||
```
|
||||
</details>
|
||||
|
||||
### Misc
|
||||
|
||||
#### Adjust the retry mechanism
|
||||
You can now configure retry settings for when the STS call fails. By default, we
|
||||
retry with exponential backoff `12` times. You can disable this behavior
|
||||
altogether by setting the `disable-retry` input to `true`, or you can configure
|
||||
the number of times it retries with the `retry-max-attempts` input.
|
||||
|
||||
#### Mask account ID
|
||||
Your account ID is not masked by default in workflow logs since it's not
|
||||
considered sensitive information. However, you can set the `mask-aws-account-id`
|
||||
input to `true` to mask your account ID in workflow logs if desired.
|
||||
|
||||
#### Unset current credentials
|
||||
Sometimes, existing credentials in your runner can get in the way of the
|
||||
intended outcome. You can set the `unset-current-credentials` input to `true` to
|
||||
work around this issue.
|
||||
|
||||
#### Special characters in AWS_SECRET_ACCESS_KEY
|
||||
Some edge cases are unable to properly parse an `AWS_SECRET_ACCESS_KEY` if it
|
||||
contains special characters. For more information, please see the
|
||||
[AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-troubleshooting.html#tshoot-signature-does-not-match).
|
||||
If you set the `special-characters-workaround` option, this action will
|
||||
continually retry fetching credentials until we get one that does not have
|
||||
special characters. This option overrides the `disable-retry` and
|
||||
`retry-max-attempts` options. We recommend that you do not enable this option
|
||||
unless required, because retrying APIs infinitely until they succeed is not best
|
||||
practice.
|
||||
|
||||
## OIDC
|
||||
|
||||
OIDC Configuration
|
||||
-------------------
|
||||
We recommend using [GitHub's OIDC
|
||||
provider](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services)
|
||||
to get short-lived AWS credentials needed for your actions. When using OIDC, you
|
||||
@@ -266,15 +318,6 @@ To get this to work
|
||||
|
||||
5. Specify that role's ARN when setting up this action.
|
||||
|
||||
First, in order for this action to create the JWT, your workflow file must have
|
||||
the `id-token: write` permission:
|
||||
|
||||
```yaml
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
```
|
||||
|
||||
### OIDC Audience
|
||||
|
||||
When the JWT is created, an audience needs to be specified. Normally, you would
|
||||
@@ -285,83 +328,33 @@ You can specify the audience through the `audience` input:
|
||||
|
||||
```yaml
|
||||
- name: Configure AWS Credentials for China region audience
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
audience: sts.amazonaws.com.cn
|
||||
aws-region: us-east-3
|
||||
aws-region: cn-northwest-1
|
||||
role-to-assume: arn:aws-cn:iam::123456789100:role/my-github-actions-role
|
||||
```
|
||||
|
||||
### Configuring IAM to trust GitHub
|
||||
To use GitHub's OIDC provider, you must first set up federation
|
||||
with the provider as an IAM IdP. The GitHub OIDC provider only needs to be
|
||||
created once per account (i.e. multiple IAM Roles that can be assumed by the
|
||||
GitHub's OIDC can share a single OIDC Provider). Here is a sample CloudFormation
|
||||
template that will configure this trust for you.
|
||||
To use GitHub's OIDC provider, you must first set up federation in your AWS
|
||||
account. This involves creating an IAM Identity Provider that trusts GitHub's
|
||||
OIDC endpoint. You can create an IAM Identity Provider in the AWS Management
|
||||
Console by specifying the following details:
|
||||
- **Provider Type**: OIDC
|
||||
- **Provider URL**: `https://token.actions.githubusercontent.com`
|
||||
- **Audience**: `sts.amazonaws.com` (or your custom audience if you specified
|
||||
one in the `audience` input)
|
||||
|
||||
Note that the thumbprint below has been set to all F's because the thumbprint is
|
||||
not used when authenticating `token.actions.githubusercontent.com`. This is a
|
||||
special case used *only when GitHub's OIDC is authenticating to IAM*. IAM uses
|
||||
its library of trusted CAs to authenticate. The value is still the API, so it
|
||||
must be specified.
|
||||
Prior versions of this documentation gave instructions for specifying the
|
||||
certificate fingerprint, but this is no longer necessary. The thumbprint, if
|
||||
specified, will be ignored.
|
||||
|
||||
You can copy the template below, or load it from here:
|
||||
https://d38mtn6aq9zhn6.cloudfront.net/configure-aws-credentials-latest.yml
|
||||
You can also create the IAM Identity Provider using the AWS CLI:
|
||||
|
||||
```yaml
|
||||
Parameters:
|
||||
GitHubOrg:
|
||||
Description: Name of GitHub organization/user (case sensitive)
|
||||
Type: String
|
||||
RepositoryName:
|
||||
Description: Name of GitHub repository (case sensitive)
|
||||
Type: String
|
||||
OIDCProviderArn:
|
||||
Description: Arn for the GitHub OIDC Provider.
|
||||
Default: ""
|
||||
Type: String
|
||||
OIDCAudience:
|
||||
Description: Audience supplied to configure-aws-credentials.
|
||||
Default: "sts.amazonaws.com"
|
||||
Type: String
|
||||
|
||||
Conditions:
|
||||
CreateOIDCProvider: !Equals
|
||||
- !Ref OIDCProviderArn
|
||||
- ""
|
||||
|
||||
Resources:
|
||||
Role:
|
||||
Type: AWS::IAM::Role
|
||||
Properties:
|
||||
AssumeRolePolicyDocument:
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Action: sts:AssumeRoleWithWebIdentity
|
||||
Principal:
|
||||
Federated: !If
|
||||
- CreateOIDCProvider
|
||||
- !Ref GithubOidc
|
||||
- !Ref OIDCProviderArn
|
||||
Condition:
|
||||
StringEquals:
|
||||
token.actions.githubusercontent.com:aud: !Ref OIDCAudience
|
||||
StringLike:
|
||||
token.actions.githubusercontent.com:sub: !Sub repo:${GitHubOrg}/${RepositoryName}:*
|
||||
|
||||
GithubOidc:
|
||||
Type: AWS::IAM::OIDCProvider
|
||||
Condition: CreateOIDCProvider
|
||||
Properties:
|
||||
Url: https://token.actions.githubusercontent.com
|
||||
ClientIdList:
|
||||
- sts.amazonaws.com
|
||||
ThumbprintList:
|
||||
- ffffffffffffffffffffffffffffffffffffffff
|
||||
|
||||
Outputs:
|
||||
Role:
|
||||
Value: !GetAtt Role.Arn
|
||||
```bash
|
||||
aws iam create-open-id-connect-provider \
|
||||
--url https://token.actions.githubusercontent.com \
|
||||
--client-id-list sts.amazonaws.com
|
||||
```
|
||||
|
||||
### Claims and scoping permissions
|
||||
@@ -403,83 +396,13 @@ For further information on OIDC and GitHub Actions, please see:
|
||||
* [GitHub docs: Configuring OpenID Connect in Amazon Web Services](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services)
|
||||
* [GitHub changelog: GitHub Actions: Secure cloud deployments with OpenID Connect](https://github.blog/changelog/2021-10-27-github-actions-secure-cloud-deployments-with-openid-connect/)
|
||||
|
||||
## Self-Hosted Runners
|
||||
Examples
|
||||
--------
|
||||
|
||||
If you run your GitHub Actions in a
|
||||
[self-hosted runner](https://help.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) that already has access to AWS credentials, such as
|
||||
an EC2 instance, then you do not need to provide IAM user access key credentials
|
||||
to this action. We will use the standard AWS JavaScript SDK credential
|
||||
resolution methods to find your credentials, so if the AWS JS SDK can
|
||||
authenticate on your runner, this Action will as well.
|
||||
|
||||
If no access key credentials are given in the action inputs, this action will
|
||||
use credentials from the runner environment using the
|
||||
[default methods for the AWS SDK for Javascript](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html).
|
||||
|
||||
You can use this action to simply configure the region and account ID in the
|
||||
environment, and then use the runner's credentials for all AWS API calls made by
|
||||
your Actions workflow:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
```
|
||||
In this case, your runner's credentials must have permissions to call any AWS
|
||||
APIs called by your Actions workflow.
|
||||
|
||||
Or, you can use this action to assume a role, and then use the role credentials
|
||||
for all AWS API calls made by your Actions workflow:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: my-github-actions-role
|
||||
```
|
||||
In this case, your runner's credentials must have permissions to assume the
|
||||
role.
|
||||
|
||||
You can also assume a role using a web identity token file, such as if using
|
||||
[Amazon EKS IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html). Pods running in EKS
|
||||
worker nodes that do not run as root can use this file to assume a role with a
|
||||
web identity.
|
||||
|
||||
### Proxy Configuration
|
||||
|
||||
If need use a HTTP proxy you can set it in the action manually.
|
||||
|
||||
Additionally this action will always consider the `HTTP_PROXY` environment
|
||||
variable.
|
||||
|
||||
Manually configured proxy:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: my-github-actions-role
|
||||
http-proxy: "http://companydomain.com:3128"
|
||||
```
|
||||
|
||||
Proxy configured in the environment variable:
|
||||
```bash
|
||||
# Your environment configuration
|
||||
HTTP_PROXY="http://companydomain.com:3128"
|
||||
```
|
||||
|
||||
### Use with the AWS CLI
|
||||
This workflow does _not_ install the [AWS CLI](https://aws.amazon.com/cli/)
|
||||
into your environment. Self-hosted runners that intend to run this action prior
|
||||
to executing `aws` commands need to have the AWS CLI
|
||||
[installed](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)
|
||||
if it's not already present.
|
||||
Most [GitHub hosted runner environments](https://github.com/actions/virtual-environments)
|
||||
should include the AWS CLI by default.
|
||||
|
||||
## Examples
|
||||
|
||||
### AssumeRoleWithWebIdentity (recommended)
|
||||
### AssumeRoleWithWebIdentity
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
@@ -493,13 +416,13 @@ environment variable and use it to assume the role
|
||||
### AssumeRole with role previously assumed by action in same workflow
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
role-session-name: MySessionName
|
||||
- name: Configure other AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::987654321000:role/my-second-role
|
||||
@@ -511,10 +434,12 @@ In this two-step example, the first step will use OIDC to assume the role
|
||||
example. Following that, a second step will use this role to assume a different
|
||||
role, `arn:aws:iam::987654321000:role/my-second-role`.
|
||||
|
||||
Note that the trust relationship/trust policy of the second role must grant the permissions `sts:AssumeRole` and `sts:TagSession` to the first role. (Or, alternatively, the `TagSession` permission can be omitted if you are using the `role-skip-session-tagging: true` flag for the second step.)
|
||||
|
||||
### AssumeRole with static IAM credentials in repository secrets
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
@@ -533,7 +458,7 @@ name, like `role-to-assume: my-github-actions-role`.
|
||||
```yaml
|
||||
- name: Configure AWS Credentials 1
|
||||
id: creds
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
@@ -542,7 +467,7 @@ name, like `role-to-assume: my-github-actions-role`.
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
- name: Configure AWS Credentials 2
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
aws-access-key-id: ${{ steps.creds.outputs.aws-access-key-id }}
|
||||
@@ -557,12 +482,21 @@ This example shows that you can reference the fetched credentials as outputs if
|
||||
`output-credentials` is set to true. This example also shows that you can use
|
||||
the `aws-session-token` input in a situation where session tokens are fetched
|
||||
and passed to this action.
|
||||
|
||||
## License Summary
|
||||
|
||||
Versioning
|
||||
----------
|
||||
Starting with version 5.0.0, this action uses semantic-style release tags and
|
||||
[immutable releases](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases).
|
||||
A floating version tag (vN) is also provided for convenience: this tag will
|
||||
move to the latest major version (vN -> vN.2.1, vM -> vM.0.0, etc.).
|
||||
|
||||
License
|
||||
-------
|
||||
This code is made available under the MIT license.
|
||||
|
||||
## Security Disclosures
|
||||
Security Disclosures
|
||||
--------------------
|
||||
If you would like to report a potential security issue in this project, please
|
||||
do not create a GitHub issue. Instead, please follow the instructions
|
||||
[here](https://aws.amazon.com/security/vulnerability-reporting/) or [email AWS
|
||||
security directly](mailto:aws-security@amazon.com).
|
||||
do not create a GitHub issue. Instead, please follow the instructions
|
||||
[here](https://aws.amazon.com/security/vulnerability-reporting/) or
|
||||
[email AWS security](mailto:aws-security@amazon.com) directly.
|
||||
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
const { fs } = require('memfs')
|
||||
module.exports = fs
|
||||
const { fs } = require('memfs');
|
||||
module.exports = fs;
|
||||
|
||||
+22
@@ -37,6 +37,9 @@ inputs:
|
||||
http-proxy:
|
||||
description: Proxy to use for the AWS SDK agent
|
||||
required: false
|
||||
no-proxy:
|
||||
description: Hosts to skip for the proxy configuration
|
||||
required: false
|
||||
mask-aws-account-id:
|
||||
description: Whether to mask the AWS account ID for these credentials as a secret value. By default the account ID will not be masked
|
||||
required: false
|
||||
@@ -61,6 +64,10 @@ inputs:
|
||||
output-credentials:
|
||||
description: Whether to set credentials as step output
|
||||
required: false
|
||||
output-env-credentials:
|
||||
description: Whether to export credentials as environment variables. If you set this to false, you probably want to use output-credentials.
|
||||
required: false
|
||||
default: true
|
||||
unset-current-credentials:
|
||||
description: Whether to unset the existing credentials in your runner. May be useful if you run this action multiple times in the same job
|
||||
required: false
|
||||
@@ -73,6 +80,19 @@ inputs:
|
||||
special-characters-workaround:
|
||||
description: Some environments do not support special characters in AWS_SECRET_ACCESS_KEY. This option will retry fetching credentials until the secret access key does not contain special characters. This option overrides disable-retry and retry-max-attempts. This option is disabled by default
|
||||
required: false
|
||||
use-existing-credentials:
|
||||
required: false
|
||||
description: When enabled, this option will check if there are already valid credentials in the environment. If there are, new credentials will not be fetched. If there are not, the action will run as normal.
|
||||
allowed-account-ids:
|
||||
required: false
|
||||
description: An option comma-delimited list of expected AWS account IDs. The action will fail if we receive credentials for the wrong account.
|
||||
force-skip-oidc:
|
||||
required: false
|
||||
description: When enabled, this option will skip using GitHub OIDC provider even if the id-token permission is set. This is sometimes useful when using IAM instance credentials.
|
||||
action-timeout-s:
|
||||
required: false
|
||||
description: A global timeout in seconds for the action. When the timeout is reached, the action immediately exits. The default is to run without a timeout.
|
||||
|
||||
outputs:
|
||||
aws-account-id:
|
||||
description: The AWS account ID for the provided credentials
|
||||
@@ -82,3 +102,5 @@ outputs:
|
||||
description: The AWS secret access key for the provided credentials
|
||||
aws-session-token:
|
||||
description: The AWS session token for the provided credentials
|
||||
aws-expiration:
|
||||
description: The expiration time for the provided credentials
|
||||
|
||||
+13
-9
@@ -4,18 +4,22 @@
|
||||
"lineWidth": 120,
|
||||
"indentWidth": 2,
|
||||
"lineEnding": "lf",
|
||||
"enabled": true,
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"performance": {
|
||||
"noDelete": "off",
|
||||
"noDelete": "off"
|
||||
},
|
||||
"correctness": {
|
||||
// Specifying a radix disables interpretation of 0x as a number (needed for backwards compat)
|
||||
"useParseIntRadix": "off"
|
||||
},
|
||||
"complexity": {
|
||||
"noExtraBooleanCast": "off",
|
||||
"noExtraBooleanCast": "off"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
@@ -23,12 +27,12 @@
|
||||
"jsxQuoteStyle": "double",
|
||||
"quoteStyle": "single",
|
||||
"bracketSpacing": true,
|
||||
"arrowParentheses": "always",
|
||||
},
|
||||
"arrowParentheses": "always"
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"formatter": {
|
||||
"trailingCommas": "all",
|
||||
},
|
||||
},
|
||||
"trailingCommas": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
exports.id = 121;
|
||||
exports.ids = [121];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 7121:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
|
||||
var client = __webpack_require__(5152);
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
|
||||
const ENV_KEY = "AWS_ACCESS_KEY_ID";
|
||||
const ENV_SECRET = "AWS_SECRET_ACCESS_KEY";
|
||||
const ENV_SESSION = "AWS_SESSION_TOKEN";
|
||||
const ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION";
|
||||
const ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE";
|
||||
const ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID";
|
||||
const fromEnv = (init) => async () => {
|
||||
init?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");
|
||||
const accessKeyId = process.env[ENV_KEY];
|
||||
const secretAccessKey = process.env[ENV_SECRET];
|
||||
const sessionToken = process.env[ENV_SESSION];
|
||||
const expiry = process.env[ENV_EXPIRATION];
|
||||
const credentialScope = process.env[ENV_CREDENTIAL_SCOPE];
|
||||
const accountId = process.env[ENV_ACCOUNT_ID];
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
const credentials = {
|
||||
accessKeyId,
|
||||
secretAccessKey,
|
||||
...(sessionToken && { sessionToken }),
|
||||
...(expiry && { expiration: new Date(expiry) }),
|
||||
...(credentialScope && { credentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
|
||||
return credentials;
|
||||
}
|
||||
throw new propertyProvider.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
|
||||
};
|
||||
|
||||
__webpack_unused_export__ = ENV_ACCOUNT_ID;
|
||||
__webpack_unused_export__ = ENV_CREDENTIAL_SCOPE;
|
||||
__webpack_unused_export__ = ENV_EXPIRATION;
|
||||
__webpack_unused_export__ = ENV_KEY;
|
||||
__webpack_unused_export__ = ENV_SECRET;
|
||||
__webpack_unused_export__ = ENV_SESSION;
|
||||
exports.fromEnv = fromEnv;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+903
@@ -0,0 +1,903 @@
|
||||
"use strict";
|
||||
exports.id = 136;
|
||||
exports.ids = [136];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 3723:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.STSClient = exports.__Client = void 0;
|
||||
const middleware_host_header_1 = __webpack_require__(2590);
|
||||
const middleware_logger_1 = __webpack_require__(5242);
|
||||
const middleware_recursion_detection_1 = __webpack_require__(1568);
|
||||
const middleware_user_agent_1 = __webpack_require__(2959);
|
||||
const config_resolver_1 = __webpack_require__(9316);
|
||||
const core_1 = __webpack_require__(402);
|
||||
const schema_1 = __webpack_require__(6890);
|
||||
const middleware_content_length_1 = __webpack_require__(7212);
|
||||
const middleware_endpoint_1 = __webpack_require__(99);
|
||||
const middleware_retry_1 = __webpack_require__(9618);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
Object.defineProperty(exports, "__Client", ({ enumerable: true, get: function () { return smithy_client_1.Client; } }));
|
||||
const httpAuthSchemeProvider_1 = __webpack_require__(7851);
|
||||
const EndpointParameters_1 = __webpack_require__(6811);
|
||||
const runtimeConfig_1 = __webpack_require__(6578);
|
||||
const runtimeExtensions_1 = __webpack_require__(7742);
|
||||
class STSClient extends smithy_client_1.Client {
|
||||
config;
|
||||
constructor(...[configuration]) {
|
||||
const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {});
|
||||
super(_config_0);
|
||||
this.initConfig = _config_0;
|
||||
const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0);
|
||||
const _config_2 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_1);
|
||||
const _config_3 = (0, middleware_retry_1.resolveRetryConfig)(_config_2);
|
||||
const _config_4 = (0, config_resolver_1.resolveRegionConfig)(_config_3);
|
||||
const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4);
|
||||
const _config_6 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_5);
|
||||
const _config_7 = (0, httpAuthSchemeProvider_1.resolveHttpAuthSchemeConfig)(_config_6);
|
||||
const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []);
|
||||
this.config = _config_8;
|
||||
this.middlewareStack.use((0, schema_1.getSchemaSerdePlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config));
|
||||
this.middlewareStack.use((0, core_1.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
|
||||
httpAuthSchemeParametersProvider: httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeParametersProvider,
|
||||
identityProviderConfigProvider: async (config) => new core_1.DefaultIdentityProviderConfig({
|
||||
"aws.auth#sigv4": config.credentials,
|
||||
}),
|
||||
}));
|
||||
this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config));
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
exports.STSClient = STSClient;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4532:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveHttpAuthRuntimeConfig = exports.getHttpAuthExtensionConfiguration = void 0;
|
||||
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.getHttpAuthExtensionConfiguration = getHttpAuthExtensionConfiguration;
|
||||
const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
exports.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7851:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveHttpAuthSchemeConfig = exports.resolveStsAuthConfig = exports.defaultSTSHttpAuthSchemeProvider = exports.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_middleware_1 = __webpack_require__(6324);
|
||||
const STSClient_1 = __webpack_require__(3723);
|
||||
const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
|
||||
region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
|
||||
(() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
exports.defaultSTSHttpAuthSchemeParametersProvider = defaultSTSHttpAuthSchemeParametersProvider;
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "sts",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "smithy.api#noAuth",
|
||||
};
|
||||
}
|
||||
const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
case "AssumeRoleWithWebIdentity": {
|
||||
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
exports.defaultSTSHttpAuthSchemeProvider = defaultSTSHttpAuthSchemeProvider;
|
||||
const resolveStsAuthConfig = (input) => Object.assign(input, {
|
||||
stsClientCtor: STSClient_1.STSClient,
|
||||
});
|
||||
exports.resolveStsAuthConfig = resolveStsAuthConfig;
|
||||
const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = (0, exports.resolveStsAuthConfig)(config);
|
||||
const config_1 = (0, core_1.resolveAwsSdkSigV4Config)(config_0);
|
||||
return Object.assign(config_1, {
|
||||
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6811:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.commonParams = exports.resolveClientEndpointParameters = void 0;
|
||||
const resolveClientEndpointParameters = (options) => {
|
||||
return Object.assign(options, {
|
||||
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
||||
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
||||
useGlobalEndpoint: options.useGlobalEndpoint ?? false,
|
||||
defaultSigningName: "sts",
|
||||
});
|
||||
};
|
||||
exports.resolveClientEndpointParameters = resolveClientEndpointParameters;
|
||||
exports.commonParams = {
|
||||
UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" },
|
||||
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
||||
Endpoint: { type: "builtInParams", name: "endpoint" },
|
||||
Region: { type: "builtInParams", name: "region" },
|
||||
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9765:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.defaultEndpointResolver = void 0;
|
||||
const util_endpoints_1 = __webpack_require__(3068);
|
||||
const util_endpoints_2 = __webpack_require__(9674);
|
||||
const ruleset_1 = __webpack_require__(1670);
|
||||
const cache = new util_endpoints_2.EndpointCache({
|
||||
size: 50,
|
||||
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
|
||||
});
|
||||
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
||||
return cache.get(endpointParams, () => (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, {
|
||||
endpointParams: endpointParams,
|
||||
logger: context.logger,
|
||||
}));
|
||||
};
|
||||
exports.defaultEndpointResolver = defaultEndpointResolver;
|
||||
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1670:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.ruleSet = void 0;
|
||||
const F = "required", G = "type", H = "fn", I = "argv", J = "ref";
|
||||
const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4", f = "sts", g = "us-east-1", h = "endpoint", i = "https://sts.{Region}.{PartitionResult#dnsSuffix}", j = "tree", k = "error", l = "getAttr", m = { [F]: false, [G]: "string" }, n = { [F]: true, "default": false, [G]: "boolean" }, o = { [J]: "Endpoint" }, p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }, q = { [J]: "Region" }, r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }, s = { [J]: "UseFIPS" }, t = { [J]: "UseDualStack" }, u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": e, "signingName": f, "signingRegion": g }] }, "headers": {} }, v = {}, w = { "conditions": [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }, x = { [H]: c, [I]: [s, true] }, y = { [H]: c, [I]: [t, true] }, z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }, A = { [J]: "PartitionResult" }, B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }, C = [{ [H]: "isSet", [I]: [o] }], D = [x], E = [y];
|
||||
const _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] };
|
||||
exports.ruleSet = _data;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1136:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var STSClient = __webpack_require__(3723);
|
||||
var smithyClient = __webpack_require__(1411);
|
||||
var middlewareEndpoint = __webpack_require__(99);
|
||||
var EndpointParameters = __webpack_require__(6811);
|
||||
var schema = __webpack_require__(6890);
|
||||
var client = __webpack_require__(5152);
|
||||
var regionConfigResolver = __webpack_require__(6463);
|
||||
|
||||
let STSServiceException$1 = class STSServiceException extends smithyClient.ServiceException {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
Object.setPrototypeOf(this, STSServiceException.prototype);
|
||||
}
|
||||
};
|
||||
|
||||
let ExpiredTokenException$1 = class ExpiredTokenException extends STSServiceException$1 {
|
||||
name = "ExpiredTokenException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "ExpiredTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
||||
}
|
||||
};
|
||||
let MalformedPolicyDocumentException$1 = class MalformedPolicyDocumentException extends STSServiceException$1 {
|
||||
name = "MalformedPolicyDocumentException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "MalformedPolicyDocumentException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, MalformedPolicyDocumentException.prototype);
|
||||
}
|
||||
};
|
||||
let PackedPolicyTooLargeException$1 = class PackedPolicyTooLargeException extends STSServiceException$1 {
|
||||
name = "PackedPolicyTooLargeException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "PackedPolicyTooLargeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, PackedPolicyTooLargeException.prototype);
|
||||
}
|
||||
};
|
||||
let RegionDisabledException$1 = class RegionDisabledException extends STSServiceException$1 {
|
||||
name = "RegionDisabledException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "RegionDisabledException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, RegionDisabledException.prototype);
|
||||
}
|
||||
};
|
||||
let IDPRejectedClaimException$1 = class IDPRejectedClaimException extends STSServiceException$1 {
|
||||
name = "IDPRejectedClaimException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "IDPRejectedClaimException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, IDPRejectedClaimException.prototype);
|
||||
}
|
||||
};
|
||||
let InvalidIdentityTokenException$1 = class InvalidIdentityTokenException extends STSServiceException$1 {
|
||||
name = "InvalidIdentityTokenException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidIdentityTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidIdentityTokenException.prototype);
|
||||
}
|
||||
};
|
||||
let IDPCommunicationErrorException$1 = class IDPCommunicationErrorException extends STSServiceException$1 {
|
||||
name = "IDPCommunicationErrorException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "IDPCommunicationErrorException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, IDPCommunicationErrorException.prototype);
|
||||
}
|
||||
};
|
||||
|
||||
const _A = "Arn";
|
||||
const _AKI = "AccessKeyId";
|
||||
const _AR = "AssumeRole";
|
||||
const _ARI = "AssumedRoleId";
|
||||
const _ARR = "AssumeRoleRequest";
|
||||
const _ARRs = "AssumeRoleResponse";
|
||||
const _ARU = "AssumedRoleUser";
|
||||
const _ARWWI = "AssumeRoleWithWebIdentity";
|
||||
const _ARWWIR = "AssumeRoleWithWebIdentityRequest";
|
||||
const _ARWWIRs = "AssumeRoleWithWebIdentityResponse";
|
||||
const _Au = "Audience";
|
||||
const _C = "Credentials";
|
||||
const _CA = "ContextAssertion";
|
||||
const _DS = "DurationSeconds";
|
||||
const _E = "Expiration";
|
||||
const _EI = "ExternalId";
|
||||
const _ETE = "ExpiredTokenException";
|
||||
const _IDPCEE = "IDPCommunicationErrorException";
|
||||
const _IDPRCE = "IDPRejectedClaimException";
|
||||
const _IITE = "InvalidIdentityTokenException";
|
||||
const _K = "Key";
|
||||
const _MPDE = "MalformedPolicyDocumentException";
|
||||
const _P = "Policy";
|
||||
const _PA = "PolicyArns";
|
||||
const _PAr = "ProviderArn";
|
||||
const _PC = "ProvidedContexts";
|
||||
const _PCLT = "ProvidedContextsListType";
|
||||
const _PCr = "ProvidedContext";
|
||||
const _PDT = "PolicyDescriptorType";
|
||||
const _PI = "ProviderId";
|
||||
const _PPS = "PackedPolicySize";
|
||||
const _PPTLE = "PackedPolicyTooLargeException";
|
||||
const _Pr = "Provider";
|
||||
const _RA = "RoleArn";
|
||||
const _RDE = "RegionDisabledException";
|
||||
const _RSN = "RoleSessionName";
|
||||
const _SAK = "SecretAccessKey";
|
||||
const _SFWIT = "SubjectFromWebIdentityToken";
|
||||
const _SI = "SourceIdentity";
|
||||
const _SN = "SerialNumber";
|
||||
const _ST = "SessionToken";
|
||||
const _T = "Tags";
|
||||
const _TC = "TokenCode";
|
||||
const _TTK = "TransitiveTagKeys";
|
||||
const _Ta = "Tag";
|
||||
const _V = "Value";
|
||||
const _WIT = "WebIdentityToken";
|
||||
const _a = "arn";
|
||||
const _aKST = "accessKeySecretType";
|
||||
const _aQE = "awsQueryError";
|
||||
const _c = "client";
|
||||
const _cTT = "clientTokenType";
|
||||
const _e = "error";
|
||||
const _hE = "httpError";
|
||||
const _m = "message";
|
||||
const _pDLT = "policyDescriptorListType";
|
||||
const _s = "smithy.ts.sdk.synthetic.com.amazonaws.sts";
|
||||
const _tLT = "tagListType";
|
||||
const n0 = "com.amazonaws.sts";
|
||||
var accessKeySecretType = [0, n0, _aKST, 8, 0];
|
||||
var clientTokenType = [0, n0, _cTT, 8, 0];
|
||||
var AssumedRoleUser = [3, n0, _ARU, 0, [_ARI, _A], [0, 0]];
|
||||
var AssumeRoleRequest = [
|
||||
3,
|
||||
n0,
|
||||
_ARR,
|
||||
0,
|
||||
[_RA, _RSN, _PA, _P, _DS, _T, _TTK, _EI, _SN, _TC, _SI, _PC],
|
||||
[0, 0, () => policyDescriptorListType, 0, 1, () => tagListType, 64 | 0, 0, 0, 0, 0, () => ProvidedContextsListType],
|
||||
];
|
||||
var AssumeRoleResponse = [
|
||||
3,
|
||||
n0,
|
||||
_ARRs,
|
||||
0,
|
||||
[_C, _ARU, _PPS, _SI],
|
||||
[[() => Credentials, 0], () => AssumedRoleUser, 1, 0],
|
||||
];
|
||||
var AssumeRoleWithWebIdentityRequest = [
|
||||
3,
|
||||
n0,
|
||||
_ARWWIR,
|
||||
0,
|
||||
[_RA, _RSN, _WIT, _PI, _PA, _P, _DS],
|
||||
[0, 0, [() => clientTokenType, 0], 0, () => policyDescriptorListType, 0, 1],
|
||||
];
|
||||
var AssumeRoleWithWebIdentityResponse = [
|
||||
3,
|
||||
n0,
|
||||
_ARWWIRs,
|
||||
0,
|
||||
[_C, _SFWIT, _ARU, _PPS, _Pr, _Au, _SI],
|
||||
[[() => Credentials, 0], 0, () => AssumedRoleUser, 1, 0, 0, 0],
|
||||
];
|
||||
var Credentials = [
|
||||
3,
|
||||
n0,
|
||||
_C,
|
||||
0,
|
||||
[_AKI, _SAK, _ST, _E],
|
||||
[0, [() => accessKeySecretType, 0], 0, 4],
|
||||
];
|
||||
var ExpiredTokenException = [
|
||||
-3,
|
||||
n0,
|
||||
_ETE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`ExpiredTokenException`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(ExpiredTokenException, ExpiredTokenException$1);
|
||||
var IDPCommunicationErrorException = [
|
||||
-3,
|
||||
n0,
|
||||
_IDPCEE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`IDPCommunicationError`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(IDPCommunicationErrorException, IDPCommunicationErrorException$1);
|
||||
var IDPRejectedClaimException = [
|
||||
-3,
|
||||
n0,
|
||||
_IDPRCE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 403,
|
||||
[_aQE]: [`IDPRejectedClaim`, 403],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(IDPRejectedClaimException, IDPRejectedClaimException$1);
|
||||
var InvalidIdentityTokenException = [
|
||||
-3,
|
||||
n0,
|
||||
_IITE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`InvalidIdentityToken`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidIdentityTokenException, InvalidIdentityTokenException$1);
|
||||
var MalformedPolicyDocumentException = [
|
||||
-3,
|
||||
n0,
|
||||
_MPDE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`MalformedPolicyDocument`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(MalformedPolicyDocumentException, MalformedPolicyDocumentException$1);
|
||||
var PackedPolicyTooLargeException = [
|
||||
-3,
|
||||
n0,
|
||||
_PPTLE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`PackedPolicyTooLarge`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(PackedPolicyTooLargeException, PackedPolicyTooLargeException$1);
|
||||
var PolicyDescriptorType = [3, n0, _PDT, 0, [_a], [0]];
|
||||
var ProvidedContext = [3, n0, _PCr, 0, [_PAr, _CA], [0, 0]];
|
||||
var RegionDisabledException = [
|
||||
-3,
|
||||
n0,
|
||||
_RDE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 403,
|
||||
[_aQE]: [`RegionDisabledException`, 403],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(RegionDisabledException, RegionDisabledException$1);
|
||||
var Tag = [3, n0, _Ta, 0, [_K, _V], [0, 0]];
|
||||
var STSServiceException = [-3, _s, "STSServiceException", 0, [], []];
|
||||
schema.TypeRegistry.for(_s).registerError(STSServiceException, STSServiceException$1);
|
||||
var policyDescriptorListType = [1, n0, _pDLT, 0, () => PolicyDescriptorType];
|
||||
var ProvidedContextsListType = [1, n0, _PCLT, 0, () => ProvidedContext];
|
||||
var tagListType = [1, n0, _tLT, 0, () => Tag];
|
||||
var AssumeRole = [9, n0, _AR, 0, () => AssumeRoleRequest, () => AssumeRoleResponse];
|
||||
var AssumeRoleWithWebIdentity = [
|
||||
9,
|
||||
n0,
|
||||
_ARWWI,
|
||||
0,
|
||||
() => AssumeRoleWithWebIdentityRequest,
|
||||
() => AssumeRoleWithWebIdentityResponse,
|
||||
];
|
||||
|
||||
class AssumeRoleCommand extends smithyClient.Command
|
||||
.classBuilder()
|
||||
.ep(EndpointParameters.commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
||||
})
|
||||
.s("AWSSecurityTokenServiceV20110615", "AssumeRole", {})
|
||||
.n("STSClient", "AssumeRoleCommand")
|
||||
.sc(AssumeRole)
|
||||
.build() {
|
||||
}
|
||||
|
||||
class AssumeRoleWithWebIdentityCommand extends smithyClient.Command
|
||||
.classBuilder()
|
||||
.ep(EndpointParameters.commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
||||
})
|
||||
.s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {})
|
||||
.n("STSClient", "AssumeRoleWithWebIdentityCommand")
|
||||
.sc(AssumeRoleWithWebIdentity)
|
||||
.build() {
|
||||
}
|
||||
|
||||
const commands = {
|
||||
AssumeRoleCommand,
|
||||
AssumeRoleWithWebIdentityCommand,
|
||||
};
|
||||
class STS extends STSClient.STSClient {
|
||||
}
|
||||
smithyClient.createAggregatedClient(commands, STS);
|
||||
|
||||
const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
|
||||
if (typeof assumedRoleUser?.Arn === "string") {
|
||||
const arnComponents = assumedRoleUser.Arn.split(":");
|
||||
if (arnComponents.length > 4 && arnComponents[4] !== "") {
|
||||
return arnComponents[4];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const resolveRegion = async (_region, _parentRegion, credentialProviderLogger, loaderConfig = {}) => {
|
||||
const region = typeof _region === "function" ? await _region() : _region;
|
||||
const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion;
|
||||
const stsDefaultRegion = await regionConfigResolver.stsRegionDefaultResolver(loaderConfig)();
|
||||
credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (credential provider clientConfig)`, `${parentRegion} (contextual client)`, `${stsDefaultRegion} (STS default: AWS_REGION, profile region, or us-east-1)`);
|
||||
return region ?? parentRegion ?? stsDefaultRegion;
|
||||
};
|
||||
const getDefaultRoleAssumer$1 = (stsOptions, STSClient) => {
|
||||
let stsClient;
|
||||
let closureSourceCreds;
|
||||
return async (sourceCreds, params) => {
|
||||
closureSourceCreds = sourceCreds;
|
||||
if (!stsClient) {
|
||||
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId, } = stsOptions;
|
||||
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
||||
logger,
|
||||
profile,
|
||||
});
|
||||
const isCompatibleRequestHandler = !isH2(requestHandler);
|
||||
stsClient = new STSClient({
|
||||
...stsOptions,
|
||||
userAgentAppId,
|
||||
profile,
|
||||
credentialDefaultProvider: () => async () => closureSourceCreds,
|
||||
region: resolvedRegion,
|
||||
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
||||
logger: logger,
|
||||
});
|
||||
}
|
||||
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleCommand(params));
|
||||
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
||||
throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
|
||||
}
|
||||
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
||||
const credentials = {
|
||||
accessKeyId: Credentials.AccessKeyId,
|
||||
secretAccessKey: Credentials.SecretAccessKey,
|
||||
sessionToken: Credentials.SessionToken,
|
||||
expiration: Credentials.Expiration,
|
||||
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE", "i");
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
const getDefaultRoleAssumerWithWebIdentity$1 = (stsOptions, STSClient) => {
|
||||
let stsClient;
|
||||
return async (params) => {
|
||||
if (!stsClient) {
|
||||
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId, } = stsOptions;
|
||||
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
||||
logger,
|
||||
profile,
|
||||
});
|
||||
const isCompatibleRequestHandler = !isH2(requestHandler);
|
||||
stsClient = new STSClient({
|
||||
...stsOptions,
|
||||
userAgentAppId,
|
||||
profile,
|
||||
region: resolvedRegion,
|
||||
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
||||
logger: logger,
|
||||
});
|
||||
}
|
||||
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
|
||||
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
||||
throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`);
|
||||
}
|
||||
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
||||
const credentials = {
|
||||
accessKeyId: Credentials.AccessKeyId,
|
||||
secretAccessKey: Credentials.SecretAccessKey,
|
||||
sessionToken: Credentials.SessionToken,
|
||||
expiration: Credentials.Expiration,
|
||||
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
if (accountId) {
|
||||
client.setCredentialFeature(credentials, "RESOLVED_ACCOUNT_ID", "T");
|
||||
}
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE_WEB_ID", "k");
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
const isH2 = (requestHandler) => {
|
||||
return requestHandler?.metadata?.handlerProtocol === "h2";
|
||||
};
|
||||
|
||||
const getCustomizableStsClientCtor = (baseCtor, customizations) => {
|
||||
if (!customizations)
|
||||
return baseCtor;
|
||||
else
|
||||
return class CustomizableSTSClient extends baseCtor {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
for (const customization of customizations) {
|
||||
this.middlewareStack.use(customization);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => getDefaultRoleAssumer$1(stsOptions, getCustomizableStsClientCtor(STSClient.STSClient, stsPlugins));
|
||||
const getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => getDefaultRoleAssumerWithWebIdentity$1(stsOptions, getCustomizableStsClientCtor(STSClient.STSClient, stsPlugins));
|
||||
const decorateDefaultCredentialProvider = (provider) => (input) => provider({
|
||||
roleAssumer: getDefaultRoleAssumer(input),
|
||||
roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input),
|
||||
...input,
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "$Command", ({
|
||||
enumerable: true,
|
||||
get: function () { return smithyClient.Command; }
|
||||
}));
|
||||
exports.AssumeRoleCommand = AssumeRoleCommand;
|
||||
exports.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand;
|
||||
exports.ExpiredTokenException = ExpiredTokenException$1;
|
||||
exports.IDPCommunicationErrorException = IDPCommunicationErrorException$1;
|
||||
exports.IDPRejectedClaimException = IDPRejectedClaimException$1;
|
||||
exports.InvalidIdentityTokenException = InvalidIdentityTokenException$1;
|
||||
exports.MalformedPolicyDocumentException = MalformedPolicyDocumentException$1;
|
||||
exports.PackedPolicyTooLargeException = PackedPolicyTooLargeException$1;
|
||||
exports.RegionDisabledException = RegionDisabledException$1;
|
||||
exports.STS = STS;
|
||||
exports.STSServiceException = STSServiceException$1;
|
||||
exports.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider;
|
||||
exports.getDefaultRoleAssumer = getDefaultRoleAssumer;
|
||||
exports.getDefaultRoleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity;
|
||||
Object.keys(STSClient).forEach(function (k) {
|
||||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
||||
enumerable: true,
|
||||
get: function () { return STSClient[k]; }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6578:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const tslib_1 = __webpack_require__(1860);
|
||||
const package_json_1 = tslib_1.__importDefault(__webpack_require__(9955));
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_user_agent_node_1 = __webpack_require__(1656);
|
||||
const config_resolver_1 = __webpack_require__(9316);
|
||||
const core_2 = __webpack_require__(402);
|
||||
const hash_node_1 = __webpack_require__(5092);
|
||||
const middleware_retry_1 = __webpack_require__(9618);
|
||||
const node_config_provider_1 = __webpack_require__(5704);
|
||||
const node_http_handler_1 = __webpack_require__(1279);
|
||||
const util_body_length_node_1 = __webpack_require__(3638);
|
||||
const util_retry_1 = __webpack_require__(5518);
|
||||
const runtimeConfig_shared_1 = __webpack_require__(4443);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const util_defaults_mode_node_1 = __webpack_require__(5435);
|
||||
const smithy_client_2 = __webpack_require__(1411);
|
||||
const getRuntimeConfig = (config) => {
|
||||
(0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
||||
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
||||
(0, core_1.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const loaderConfig = {
|
||||
profile: config?.profile,
|
||||
logger: clientSharedValues.logger,
|
||||
};
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "node",
|
||||
defaultsMode,
|
||||
authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(core_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
(0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
||||
(async (idProps) => await config.credentialDefaultProvider(idProps?.__config || {})()),
|
||||
signer: new core_1.AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new core_2.NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
||||
region: config?.region ??
|
||||
(0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
||||
requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ??
|
||||
(0, node_config_provider_1.loadConfig)({
|
||||
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
||||
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
||||
}, config),
|
||||
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
|
||||
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4443:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const protocols_1 = __webpack_require__(7288);
|
||||
const core_2 = __webpack_require__(402);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const url_parser_1 = __webpack_require__(4494);
|
||||
const util_base64_1 = __webpack_require__(8385);
|
||||
const util_utf8_1 = __webpack_require__(1577);
|
||||
const httpAuthSchemeProvider_1 = __webpack_require__(7851);
|
||||
const endpointResolver_1 = __webpack_require__(9765);
|
||||
const getRuntimeConfig = (config) => {
|
||||
return {
|
||||
apiVersion: "2011-06-15",
|
||||
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
|
||||
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
|
||||
disableHostPrefix: config?.disableHostPrefix ?? false,
|
||||
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
|
||||
extensions: config?.extensions ?? [],
|
||||
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeProvider,
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
||||
signer: new core_1.AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new core_2.NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
|
||||
protocol: config?.protocol ??
|
||||
new protocols_1.AwsQueryProtocol({
|
||||
defaultNamespace: "com.amazonaws.sts",
|
||||
xmlNamespace: "https://sts.amazonaws.com/doc/2011-06-15/",
|
||||
version: "2011-06-15",
|
||||
}),
|
||||
serviceId: config?.serviceId ?? "STS",
|
||||
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
||||
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
|
||||
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7742:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveRuntimeExtensions = void 0;
|
||||
const region_config_resolver_1 = __webpack_require__(6463);
|
||||
const protocol_http_1 = __webpack_require__(2356);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const httpAuthExtensionConfiguration_1 = __webpack_require__(4532);
|
||||
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
||||
const extensionConfiguration = Object.assign((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig), (0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig), (0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig), (0, httpAuthExtensionConfiguration_1.getHttpAuthExtensionConfiguration)(runtimeConfig));
|
||||
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
||||
return Object.assign(runtimeConfig, (0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), (0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), (0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), (0, httpAuthExtensionConfiguration_1.resolveHttpAuthRuntimeConfig)(extensionConfiguration));
|
||||
};
|
||||
exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9955:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","version":"3.933.0","description":"Nested clients for AWS SDK packages.","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"yarn lint && concurrently \'yarn:build:cjs\' \'yarn:build:es\' \'yarn:build:types\'","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","lint":"node ../../scripts/validation/submodules-linter.js --pkg nested-clients","test":"yarn g:vitest run","test:watch":"yarn g:vitest watch"},"engines":{"node":">=18.0.0"},"sideEffects":false,"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.932.0","@aws-sdk/middleware-host-header":"3.930.0","@aws-sdk/middleware-logger":"3.930.0","@aws-sdk/middleware-recursion-detection":"3.933.0","@aws-sdk/middleware-user-agent":"3.932.0","@aws-sdk/region-config-resolver":"3.930.0","@aws-sdk/types":"3.930.0","@aws-sdk/util-endpoints":"3.930.0","@aws-sdk/util-user-agent-browser":"3.930.0","@aws-sdk/util-user-agent-node":"3.932.0","@smithy/config-resolver":"^4.4.3","@smithy/core":"^3.18.2","@smithy/fetch-http-handler":"^5.3.6","@smithy/hash-node":"^4.2.5","@smithy/invalid-dependency":"^4.2.5","@smithy/middleware-content-length":"^4.2.5","@smithy/middleware-endpoint":"^4.3.9","@smithy/middleware-retry":"^4.4.9","@smithy/middleware-serde":"^4.2.5","@smithy/middleware-stack":"^4.2.5","@smithy/node-config-provider":"^4.3.5","@smithy/node-http-handler":"^4.4.5","@smithy/protocol-http":"^5.3.5","@smithy/smithy-client":"^4.9.5","@smithy/types":"^4.9.0","@smithy/url-parser":"^4.2.5","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.8","@smithy/util-defaults-mode-node":"^4.2.11","@smithy/util-endpoints":"^3.2.5","@smithy/util-middleware":"^4.2.5","@smithy/util-retry":"^4.2.5","@smithy/util-utf8":"^4.2.0","tslib":"^2.6.2"},"devDependencies":{"concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.8.3"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["./sso-oidc.d.ts","./sso-oidc.js","./sts.d.ts","./sts.js","dist-*/**"],"browser":{"./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"packages/nested-clients"},"exports":{"./sso-oidc":{"types":"./dist-types/submodules/sso-oidc/index.d.ts","module":"./dist-es/submodules/sso-oidc/index.js","node":"./dist-cjs/submodules/sso-oidc/index.js","import":"./dist-es/submodules/sso-oidc/index.js","require":"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{"types":"./dist-types/submodules/sts/index.d.ts","module":"./dist-es/submodules/sts/index.js","node":"./dist-cjs/submodules/sts/index.js","import":"./dist-es/submodules/sts/index.js","require":"./dist-cjs/submodules/sts/index.js"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
exports.id = 360;
|
||||
exports.ids = [360];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 5360:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var sharedIniFileLoader = __webpack_require__(4964);
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
var child_process = __webpack_require__(5317);
|
||||
var util = __webpack_require__(9023);
|
||||
var client = __webpack_require__(5152);
|
||||
|
||||
const getValidatedProcessCredentials = (profileName, data, profiles) => {
|
||||
if (data.Version !== 1) {
|
||||
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
|
||||
}
|
||||
if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {
|
||||
throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);
|
||||
}
|
||||
if (data.Expiration) {
|
||||
const currentTime = new Date();
|
||||
const expireTime = new Date(data.Expiration);
|
||||
if (expireTime < currentTime) {
|
||||
throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
|
||||
}
|
||||
}
|
||||
let accountId = data.AccountId;
|
||||
if (!accountId && profiles?.[profileName]?.aws_account_id) {
|
||||
accountId = profiles[profileName].aws_account_id;
|
||||
}
|
||||
const credentials = {
|
||||
accessKeyId: data.AccessKeyId,
|
||||
secretAccessKey: data.SecretAccessKey,
|
||||
...(data.SessionToken && { sessionToken: data.SessionToken }),
|
||||
...(data.Expiration && { expiration: new Date(data.Expiration) }),
|
||||
...(data.CredentialScope && { credentialScope: data.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
|
||||
return credentials;
|
||||
};
|
||||
|
||||
const resolveProcessCredentials = async (profileName, profiles, logger) => {
|
||||
const profile = profiles[profileName];
|
||||
if (profiles[profileName]) {
|
||||
const credentialProcess = profile["credential_process"];
|
||||
if (credentialProcess !== undefined) {
|
||||
const execPromise = util.promisify(sharedIniFileLoader.externalDataInterceptor?.getTokenRecord?.().exec ?? child_process.exec);
|
||||
try {
|
||||
const { stdout } = await execPromise(credentialProcess);
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(stdout.trim());
|
||||
}
|
||||
catch {
|
||||
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
||||
}
|
||||
return getValidatedProcessCredentials(profileName, data, profiles);
|
||||
}
|
||||
catch (error) {
|
||||
throw new propertyProvider.CredentialsProviderError(error.message, { logger });
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
|
||||
logger,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
|
||||
init.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");
|
||||
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
||||
return resolveProcessCredentials(sharedIniFileLoader.getProfileName({
|
||||
profile: init.profile ?? callerClientConfig?.profile,
|
||||
}), profiles, init.logger);
|
||||
};
|
||||
|
||||
exports.fromProcess = fromProcess;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+794
@@ -0,0 +1,794 @@
|
||||
"use strict";
|
||||
exports.id = 443;
|
||||
exports.ids = [443];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 8396:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveHttpAuthSchemeConfig = exports.defaultSSOOIDCHttpAuthSchemeProvider = exports.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_middleware_1 = __webpack_require__(6324);
|
||||
const defaultSSOOIDCHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
|
||||
region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
|
||||
(() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
exports.defaultSSOOIDCHttpAuthSchemeParametersProvider = defaultSSOOIDCHttpAuthSchemeParametersProvider;
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "sso-oauth",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "smithy.api#noAuth",
|
||||
};
|
||||
}
|
||||
const defaultSSOOIDCHttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
case "CreateToken": {
|
||||
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
exports.defaultSSOOIDCHttpAuthSchemeProvider = defaultSSOOIDCHttpAuthSchemeProvider;
|
||||
const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config);
|
||||
return Object.assign(config_0, {
|
||||
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 546:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.defaultEndpointResolver = void 0;
|
||||
const util_endpoints_1 = __webpack_require__(3068);
|
||||
const util_endpoints_2 = __webpack_require__(9674);
|
||||
const ruleset_1 = __webpack_require__(9947);
|
||||
const cache = new util_endpoints_2.EndpointCache({
|
||||
size: 50,
|
||||
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
|
||||
});
|
||||
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
||||
return cache.get(endpointParams, () => (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, {
|
||||
endpointParams: endpointParams,
|
||||
logger: context.logger,
|
||||
}));
|
||||
};
|
||||
exports.defaultEndpointResolver = defaultEndpointResolver;
|
||||
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9947:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.ruleSet = void 0;
|
||||
const u = "required", v = "fn", w = "argv", x = "ref";
|
||||
const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "string" }, j = { [u]: true, "default": false, "type": "boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
|
||||
const _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] };
|
||||
exports.ruleSet = _data;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9443:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
|
||||
var middlewareHostHeader = __webpack_require__(2590);
|
||||
var middlewareLogger = __webpack_require__(5242);
|
||||
var middlewareRecursionDetection = __webpack_require__(1568);
|
||||
var middlewareUserAgent = __webpack_require__(2959);
|
||||
var configResolver = __webpack_require__(9316);
|
||||
var core = __webpack_require__(402);
|
||||
var schema = __webpack_require__(6890);
|
||||
var middlewareContentLength = __webpack_require__(7212);
|
||||
var middlewareEndpoint = __webpack_require__(99);
|
||||
var middlewareRetry = __webpack_require__(9618);
|
||||
var smithyClient = __webpack_require__(1411);
|
||||
var httpAuthSchemeProvider = __webpack_require__(8396);
|
||||
var runtimeConfig = __webpack_require__(6901);
|
||||
var regionConfigResolver = __webpack_require__(6463);
|
||||
var protocolHttp = __webpack_require__(2356);
|
||||
|
||||
const resolveClientEndpointParameters = (options) => {
|
||||
return Object.assign(options, {
|
||||
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
||||
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
||||
defaultSigningName: "sso-oauth",
|
||||
});
|
||||
};
|
||||
const commonParams = {
|
||||
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
||||
Endpoint: { type: "builtInParams", name: "endpoint" },
|
||||
Region: { type: "builtInParams", name: "region" },
|
||||
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
||||
};
|
||||
|
||||
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
|
||||
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
||||
const extensionConfiguration = Object.assign(regionConfigResolver.getAwsRegionExtensionConfiguration(runtimeConfig), smithyClient.getDefaultExtensionConfiguration(runtimeConfig), protocolHttp.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
|
||||
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
||||
return Object.assign(runtimeConfig, regionConfigResolver.resolveAwsRegionExtensionConfiguration(extensionConfiguration), smithyClient.resolveDefaultRuntimeConfig(extensionConfiguration), protocolHttp.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
|
||||
};
|
||||
|
||||
class SSOOIDCClient extends smithyClient.Client {
|
||||
config;
|
||||
constructor(...[configuration]) {
|
||||
const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {});
|
||||
super(_config_0);
|
||||
this.initConfig = _config_0;
|
||||
const _config_1 = resolveClientEndpointParameters(_config_0);
|
||||
const _config_2 = middlewareUserAgent.resolveUserAgentConfig(_config_1);
|
||||
const _config_3 = middlewareRetry.resolveRetryConfig(_config_2);
|
||||
const _config_4 = configResolver.resolveRegionConfig(_config_3);
|
||||
const _config_5 = middlewareHostHeader.resolveHostHeaderConfig(_config_4);
|
||||
const _config_6 = middlewareEndpoint.resolveEndpointConfig(_config_5);
|
||||
const _config_7 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_6);
|
||||
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
||||
this.config = _config_8;
|
||||
this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));
|
||||
this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareHostHeader.getHostHeaderPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareLogger.getLoggerPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareRecursionDetection.getRecursionDetectionPlugin(this.config));
|
||||
this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
||||
httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultSSOOIDCHttpAuthSchemeParametersProvider,
|
||||
identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({
|
||||
"aws.auth#sigv4": config.credentials,
|
||||
}),
|
||||
}));
|
||||
this.middlewareStack.use(core.getHttpSigningPlugin(this.config));
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
let SSOOIDCServiceException$1 = class SSOOIDCServiceException extends smithyClient.ServiceException {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
Object.setPrototypeOf(this, SSOOIDCServiceException.prototype);
|
||||
}
|
||||
};
|
||||
|
||||
const AccessDeniedExceptionReason = {
|
||||
KMS_ACCESS_DENIED: "KMS_AccessDeniedException",
|
||||
};
|
||||
let AccessDeniedException$1 = class AccessDeniedException extends SSOOIDCServiceException$1 {
|
||||
name = "AccessDeniedException";
|
||||
$fault = "client";
|
||||
error;
|
||||
reason;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "AccessDeniedException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
||||
this.error = opts.error;
|
||||
this.reason = opts.reason;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let AuthorizationPendingException$1 = class AuthorizationPendingException extends SSOOIDCServiceException$1 {
|
||||
name = "AuthorizationPendingException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "AuthorizationPendingException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, AuthorizationPendingException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let ExpiredTokenException$1 = class ExpiredTokenException extends SSOOIDCServiceException$1 {
|
||||
name = "ExpiredTokenException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "ExpiredTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InternalServerException$1 = class InternalServerException extends SSOOIDCServiceException$1 {
|
||||
name = "InternalServerException";
|
||||
$fault = "server";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InternalServerException",
|
||||
$fault: "server",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InternalServerException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InvalidClientException$1 = class InvalidClientException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidClientException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidClientException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidClientException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InvalidGrantException$1 = class InvalidGrantException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidGrantException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidGrantException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidGrantException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
const InvalidRequestExceptionReason = {
|
||||
KMS_DISABLED_KEY: "KMS_DisabledException",
|
||||
KMS_INVALID_KEY_USAGE: "KMS_InvalidKeyUsageException",
|
||||
KMS_INVALID_STATE: "KMS_InvalidStateException",
|
||||
KMS_KEY_NOT_FOUND: "KMS_NotFoundException",
|
||||
};
|
||||
let InvalidRequestException$1 = class InvalidRequestException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidRequestException";
|
||||
$fault = "client";
|
||||
error;
|
||||
reason;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidRequestException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidRequestException.prototype);
|
||||
this.error = opts.error;
|
||||
this.reason = opts.reason;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InvalidScopeException$1 = class InvalidScopeException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidScopeException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidScopeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidScopeException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let SlowDownException$1 = class SlowDownException extends SSOOIDCServiceException$1 {
|
||||
name = "SlowDownException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "SlowDownException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, SlowDownException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let UnauthorizedClientException$1 = class UnauthorizedClientException extends SSOOIDCServiceException$1 {
|
||||
name = "UnauthorizedClientException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "UnauthorizedClientException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, UnauthorizedClientException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let UnsupportedGrantTypeException$1 = class UnsupportedGrantTypeException extends SSOOIDCServiceException$1 {
|
||||
name = "UnsupportedGrantTypeException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "UnsupportedGrantTypeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, UnsupportedGrantTypeException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
|
||||
const _ADE = "AccessDeniedException";
|
||||
const _APE = "AuthorizationPendingException";
|
||||
const _AT = "AccessToken";
|
||||
const _CS = "ClientSecret";
|
||||
const _CT = "CreateToken";
|
||||
const _CTR = "CreateTokenRequest";
|
||||
const _CTRr = "CreateTokenResponse";
|
||||
const _CV = "CodeVerifier";
|
||||
const _ETE = "ExpiredTokenException";
|
||||
const _ICE = "InvalidClientException";
|
||||
const _IGE = "InvalidGrantException";
|
||||
const _IRE = "InvalidRequestException";
|
||||
const _ISE = "InternalServerException";
|
||||
const _ISEn = "InvalidScopeException";
|
||||
const _IT = "IdToken";
|
||||
const _RT = "RefreshToken";
|
||||
const _SDE = "SlowDownException";
|
||||
const _UCE = "UnauthorizedClientException";
|
||||
const _UGTE = "UnsupportedGrantTypeException";
|
||||
const _aT = "accessToken";
|
||||
const _c = "client";
|
||||
const _cI = "clientId";
|
||||
const _cS = "clientSecret";
|
||||
const _cV = "codeVerifier";
|
||||
const _co = "code";
|
||||
const _dC = "deviceCode";
|
||||
const _e = "error";
|
||||
const _eI = "expiresIn";
|
||||
const _ed = "error_description";
|
||||
const _gT = "grantType";
|
||||
const _h = "http";
|
||||
const _hE = "httpError";
|
||||
const _iT = "idToken";
|
||||
const _r = "reason";
|
||||
const _rT = "refreshToken";
|
||||
const _rU = "redirectUri";
|
||||
const _s = "scope";
|
||||
const _se = "server";
|
||||
const _sm = "smithy.ts.sdk.synthetic.com.amazonaws.ssooidc";
|
||||
const _tT = "tokenType";
|
||||
const n0 = "com.amazonaws.ssooidc";
|
||||
var AccessToken = [0, n0, _AT, 8, 0];
|
||||
var ClientSecret = [0, n0, _CS, 8, 0];
|
||||
var CodeVerifier = [0, n0, _CV, 8, 0];
|
||||
var IdToken = [0, n0, _IT, 8, 0];
|
||||
var RefreshToken = [0, n0, _RT, 8, 0];
|
||||
var AccessDeniedException = [
|
||||
-3,
|
||||
n0,
|
||||
_ADE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _r, _ed],
|
||||
[0, 0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(AccessDeniedException, AccessDeniedException$1);
|
||||
var AuthorizationPendingException = [
|
||||
-3,
|
||||
n0,
|
||||
_APE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(AuthorizationPendingException, AuthorizationPendingException$1);
|
||||
var CreateTokenRequest = [
|
||||
3,
|
||||
n0,
|
||||
_CTR,
|
||||
0,
|
||||
[_cI, _cS, _gT, _dC, _co, _rT, _s, _rU, _cV],
|
||||
[0, [() => ClientSecret, 0], 0, 0, 0, [() => RefreshToken, 0], 64 | 0, 0, [() => CodeVerifier, 0]],
|
||||
];
|
||||
var CreateTokenResponse = [
|
||||
3,
|
||||
n0,
|
||||
_CTRr,
|
||||
0,
|
||||
[_aT, _tT, _eI, _rT, _iT],
|
||||
[[() => AccessToken, 0], 0, 1, [() => RefreshToken, 0], [() => IdToken, 0]],
|
||||
];
|
||||
var ExpiredTokenException = [
|
||||
-3,
|
||||
n0,
|
||||
_ETE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(ExpiredTokenException, ExpiredTokenException$1);
|
||||
var InternalServerException = [
|
||||
-3,
|
||||
n0,
|
||||
_ISE,
|
||||
{
|
||||
[_e]: _se,
|
||||
[_hE]: 500,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InternalServerException, InternalServerException$1);
|
||||
var InvalidClientException = [
|
||||
-3,
|
||||
n0,
|
||||
_ICE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 401,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidClientException, InvalidClientException$1);
|
||||
var InvalidGrantException = [
|
||||
-3,
|
||||
n0,
|
||||
_IGE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidGrantException, InvalidGrantException$1);
|
||||
var InvalidRequestException = [
|
||||
-3,
|
||||
n0,
|
||||
_IRE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _r, _ed],
|
||||
[0, 0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidRequestException, InvalidRequestException$1);
|
||||
var InvalidScopeException = [
|
||||
-3,
|
||||
n0,
|
||||
_ISEn,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidScopeException, InvalidScopeException$1);
|
||||
var SlowDownException = [
|
||||
-3,
|
||||
n0,
|
||||
_SDE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(SlowDownException, SlowDownException$1);
|
||||
var UnauthorizedClientException = [
|
||||
-3,
|
||||
n0,
|
||||
_UCE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(UnauthorizedClientException, UnauthorizedClientException$1);
|
||||
var UnsupportedGrantTypeException = [
|
||||
-3,
|
||||
n0,
|
||||
_UGTE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(UnsupportedGrantTypeException, UnsupportedGrantTypeException$1);
|
||||
var SSOOIDCServiceException = [-3, _sm, "SSOOIDCServiceException", 0, [], []];
|
||||
schema.TypeRegistry.for(_sm).registerError(SSOOIDCServiceException, SSOOIDCServiceException$1);
|
||||
var CreateToken = [
|
||||
9,
|
||||
n0,
|
||||
_CT,
|
||||
{
|
||||
[_h]: ["POST", "/token", 200],
|
||||
},
|
||||
() => CreateTokenRequest,
|
||||
() => CreateTokenResponse,
|
||||
];
|
||||
|
||||
class CreateTokenCommand extends smithyClient.Command
|
||||
.classBuilder()
|
||||
.ep(commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
||||
})
|
||||
.s("AWSSSOOIDCService", "CreateToken", {})
|
||||
.n("SSOOIDCClient", "CreateTokenCommand")
|
||||
.sc(CreateToken)
|
||||
.build() {
|
||||
}
|
||||
|
||||
const commands = {
|
||||
CreateTokenCommand,
|
||||
};
|
||||
class SSOOIDC extends SSOOIDCClient {
|
||||
}
|
||||
smithyClient.createAggregatedClient(commands, SSOOIDC);
|
||||
|
||||
__webpack_unused_export__ = ({
|
||||
enumerable: true,
|
||||
get: function () { return smithyClient.Command; }
|
||||
});
|
||||
__webpack_unused_export__ = ({
|
||||
enumerable: true,
|
||||
get: function () { return smithyClient.Client; }
|
||||
});
|
||||
__webpack_unused_export__ = AccessDeniedException$1;
|
||||
__webpack_unused_export__ = AccessDeniedExceptionReason;
|
||||
__webpack_unused_export__ = AuthorizationPendingException$1;
|
||||
exports.CreateTokenCommand = CreateTokenCommand;
|
||||
__webpack_unused_export__ = ExpiredTokenException$1;
|
||||
__webpack_unused_export__ = InternalServerException$1;
|
||||
__webpack_unused_export__ = InvalidClientException$1;
|
||||
__webpack_unused_export__ = InvalidGrantException$1;
|
||||
__webpack_unused_export__ = InvalidRequestException$1;
|
||||
__webpack_unused_export__ = InvalidRequestExceptionReason;
|
||||
__webpack_unused_export__ = InvalidScopeException$1;
|
||||
__webpack_unused_export__ = SSOOIDC;
|
||||
exports.SSOOIDCClient = SSOOIDCClient;
|
||||
__webpack_unused_export__ = SSOOIDCServiceException$1;
|
||||
__webpack_unused_export__ = SlowDownException$1;
|
||||
__webpack_unused_export__ = UnauthorizedClientException$1;
|
||||
__webpack_unused_export__ = UnsupportedGrantTypeException$1;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6901:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const tslib_1 = __webpack_require__(1860);
|
||||
const package_json_1 = tslib_1.__importDefault(__webpack_require__(9955));
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_user_agent_node_1 = __webpack_require__(1656);
|
||||
const config_resolver_1 = __webpack_require__(9316);
|
||||
const hash_node_1 = __webpack_require__(5092);
|
||||
const middleware_retry_1 = __webpack_require__(9618);
|
||||
const node_config_provider_1 = __webpack_require__(5704);
|
||||
const node_http_handler_1 = __webpack_require__(1279);
|
||||
const util_body_length_node_1 = __webpack_require__(3638);
|
||||
const util_retry_1 = __webpack_require__(5518);
|
||||
const runtimeConfig_shared_1 = __webpack_require__(1546);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const util_defaults_mode_node_1 = __webpack_require__(5435);
|
||||
const smithy_client_2 = __webpack_require__(1411);
|
||||
const getRuntimeConfig = (config) => {
|
||||
(0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
||||
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
||||
(0, core_1.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const loaderConfig = {
|
||||
profile: config?.profile,
|
||||
logger: clientSharedValues.logger,
|
||||
};
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "node",
|
||||
defaultsMode,
|
||||
authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(core_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
(0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
||||
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
||||
region: config?.region ??
|
||||
(0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
||||
requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ??
|
||||
(0, node_config_provider_1.loadConfig)({
|
||||
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
||||
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
||||
}, config),
|
||||
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
|
||||
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1546:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const protocols_1 = __webpack_require__(7288);
|
||||
const core_2 = __webpack_require__(402);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const url_parser_1 = __webpack_require__(4494);
|
||||
const util_base64_1 = __webpack_require__(8385);
|
||||
const util_utf8_1 = __webpack_require__(1577);
|
||||
const httpAuthSchemeProvider_1 = __webpack_require__(8396);
|
||||
const endpointResolver_1 = __webpack_require__(546);
|
||||
const getRuntimeConfig = (config) => {
|
||||
return {
|
||||
apiVersion: "2019-06-10",
|
||||
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
|
||||
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
|
||||
disableHostPrefix: config?.disableHostPrefix ?? false,
|
||||
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
|
||||
extensions: config?.extensions ?? [],
|
||||
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSSOOIDCHttpAuthSchemeProvider,
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
||||
signer: new core_1.AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new core_2.NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
|
||||
protocol: config?.protocol ?? new protocols_1.AwsRestJsonProtocol({ defaultNamespace: "com.amazonaws.ssooidc" }),
|
||||
serviceId: config?.serviceId ?? "SSO OIDC",
|
||||
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
||||
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
|
||||
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9955:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","version":"3.933.0","description":"Nested clients for AWS SDK packages.","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"yarn lint && concurrently \'yarn:build:cjs\' \'yarn:build:es\' \'yarn:build:types\'","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","lint":"node ../../scripts/validation/submodules-linter.js --pkg nested-clients","test":"yarn g:vitest run","test:watch":"yarn g:vitest watch"},"engines":{"node":">=18.0.0"},"sideEffects":false,"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.932.0","@aws-sdk/middleware-host-header":"3.930.0","@aws-sdk/middleware-logger":"3.930.0","@aws-sdk/middleware-recursion-detection":"3.933.0","@aws-sdk/middleware-user-agent":"3.932.0","@aws-sdk/region-config-resolver":"3.930.0","@aws-sdk/types":"3.930.0","@aws-sdk/util-endpoints":"3.930.0","@aws-sdk/util-user-agent-browser":"3.930.0","@aws-sdk/util-user-agent-node":"3.932.0","@smithy/config-resolver":"^4.4.3","@smithy/core":"^3.18.2","@smithy/fetch-http-handler":"^5.3.6","@smithy/hash-node":"^4.2.5","@smithy/invalid-dependency":"^4.2.5","@smithy/middleware-content-length":"^4.2.5","@smithy/middleware-endpoint":"^4.3.9","@smithy/middleware-retry":"^4.4.9","@smithy/middleware-serde":"^4.2.5","@smithy/middleware-stack":"^4.2.5","@smithy/node-config-provider":"^4.3.5","@smithy/node-http-handler":"^4.4.5","@smithy/protocol-http":"^5.3.5","@smithy/smithy-client":"^4.9.5","@smithy/types":"^4.9.0","@smithy/url-parser":"^4.2.5","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.8","@smithy/util-defaults-mode-node":"^4.2.11","@smithy/util-endpoints":"^3.2.5","@smithy/util-middleware":"^4.2.5","@smithy/util-retry":"^4.2.5","@smithy/util-utf8":"^4.2.0","tslib":"^2.6.2"},"devDependencies":{"concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.8.3"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["./sso-oidc.d.ts","./sso-oidc.js","./sts.d.ts","./sts.js","dist-*/**"],"browser":{"./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"packages/nested-clients"},"exports":{"./sso-oidc":{"types":"./dist-types/submodules/sso-oidc/index.d.ts","module":"./dist-es/submodules/sso-oidc/index.js","node":"./dist-cjs/submodules/sso-oidc/index.js","import":"./dist-es/submodules/sso-oidc/index.js","require":"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{"types":"./dist-types/submodules/sts/index.d.ts","module":"./dist-es/submodules/sts/index.js","node":"./dist-cjs/submodules/sts/index.js","import":"./dist-es/submodules/sts/index.js","require":"./dist-cjs/submodules/sts/index.js"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+387
@@ -0,0 +1,387 @@
|
||||
"use strict";
|
||||
exports.id = 566;
|
||||
exports.ids = [566];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 566:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
var url = __webpack_require__(7016);
|
||||
var buffer = __webpack_require__(181);
|
||||
var http = __webpack_require__(8611);
|
||||
var nodeConfigProvider = __webpack_require__(5704);
|
||||
var urlParser = __webpack_require__(4494);
|
||||
|
||||
function httpRequest(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = http.request({
|
||||
method: "GET",
|
||||
...options,
|
||||
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1"),
|
||||
});
|
||||
req.on("error", (err) => {
|
||||
reject(Object.assign(new propertyProvider.ProviderError("Unable to connect to instance metadata service"), err));
|
||||
req.destroy();
|
||||
});
|
||||
req.on("timeout", () => {
|
||||
reject(new propertyProvider.ProviderError("TimeoutError from instance metadata service"));
|
||||
req.destroy();
|
||||
});
|
||||
req.on("response", (res) => {
|
||||
const { statusCode = 400 } = res;
|
||||
if (statusCode < 200 || 300 <= statusCode) {
|
||||
reject(Object.assign(new propertyProvider.ProviderError("Error response received from instance metadata service"), { statusCode }));
|
||||
req.destroy();
|
||||
}
|
||||
const chunks = [];
|
||||
res.on("data", (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
res.on("end", () => {
|
||||
resolve(buffer.Buffer.concat(chunks));
|
||||
req.destroy();
|
||||
});
|
||||
});
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
|
||||
const isImdsCredentials = (arg) => Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.AccessKeyId === "string" &&
|
||||
typeof arg.SecretAccessKey === "string" &&
|
||||
typeof arg.Token === "string" &&
|
||||
typeof arg.Expiration === "string";
|
||||
const fromImdsCredentials = (creds) => ({
|
||||
accessKeyId: creds.AccessKeyId,
|
||||
secretAccessKey: creds.SecretAccessKey,
|
||||
sessionToken: creds.Token,
|
||||
expiration: new Date(creds.Expiration),
|
||||
...(creds.AccountId && { accountId: creds.AccountId }),
|
||||
});
|
||||
|
||||
const DEFAULT_TIMEOUT = 1000;
|
||||
const DEFAULT_MAX_RETRIES = 0;
|
||||
const providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT, }) => ({ maxRetries, timeout });
|
||||
|
||||
const retry = (toRetry, maxRetries) => {
|
||||
let promise = toRetry();
|
||||
for (let i = 0; i < maxRetries; i++) {
|
||||
promise = promise.catch(toRetry);
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
|
||||
const ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
||||
const ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
||||
const ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
||||
const fromContainerMetadata = (init = {}) => {
|
||||
const { timeout, maxRetries } = providerConfigFromInit(init);
|
||||
return () => retry(async () => {
|
||||
const requestOptions = await getCmdsUri({ logger: init.logger });
|
||||
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
||||
if (!isImdsCredentials(credsResponse)) {
|
||||
throw new propertyProvider.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
||||
logger: init.logger,
|
||||
});
|
||||
}
|
||||
return fromImdsCredentials(credsResponse);
|
||||
}, maxRetries);
|
||||
};
|
||||
const requestFromEcsImds = async (timeout, options) => {
|
||||
if (process.env[ENV_CMDS_AUTH_TOKEN]) {
|
||||
options.headers = {
|
||||
...options.headers,
|
||||
Authorization: process.env[ENV_CMDS_AUTH_TOKEN],
|
||||
};
|
||||
}
|
||||
const buffer = await httpRequest({
|
||||
...options,
|
||||
timeout,
|
||||
});
|
||||
return buffer.toString();
|
||||
};
|
||||
const CMDS_IP = "169.254.170.2";
|
||||
const GREENGRASS_HOSTS = {
|
||||
localhost: true,
|
||||
"127.0.0.1": true,
|
||||
};
|
||||
const GREENGRASS_PROTOCOLS = {
|
||||
"http:": true,
|
||||
"https:": true,
|
||||
};
|
||||
const getCmdsUri = async ({ logger }) => {
|
||||
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
||||
return {
|
||||
hostname: CMDS_IP,
|
||||
path: process.env[ENV_CMDS_RELATIVE_URI],
|
||||
};
|
||||
}
|
||||
if (process.env[ENV_CMDS_FULL_URI]) {
|
||||
const parsed = url.parse(process.env[ENV_CMDS_FULL_URI]);
|
||||
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
||||
throw new propertyProvider.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
||||
tryNextLink: false,
|
||||
logger,
|
||||
});
|
||||
}
|
||||
if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
|
||||
throw new propertyProvider.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
||||
tryNextLink: false,
|
||||
logger,
|
||||
});
|
||||
}
|
||||
return {
|
||||
...parsed,
|
||||
port: parsed.port ? parseInt(parsed.port, 10) : undefined,
|
||||
};
|
||||
}
|
||||
throw new propertyProvider.CredentialsProviderError("The container metadata credential provider cannot be used unless" +
|
||||
` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` +
|
||||
" variable is set", {
|
||||
tryNextLink: false,
|
||||
logger,
|
||||
});
|
||||
};
|
||||
|
||||
class InstanceMetadataV1FallbackError extends propertyProvider.CredentialsProviderError {
|
||||
tryNextLink;
|
||||
name = "InstanceMetadataV1FallbackError";
|
||||
constructor(message, tryNextLink = true) {
|
||||
super(message, tryNextLink);
|
||||
this.tryNextLink = tryNextLink;
|
||||
Object.setPrototypeOf(this, InstanceMetadataV1FallbackError.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
exports.yI = void 0;
|
||||
(function (Endpoint) {
|
||||
Endpoint["IPv4"] = "http://169.254.169.254";
|
||||
Endpoint["IPv6"] = "http://[fd00:ec2::254]";
|
||||
})(exports.yI || (exports.yI = {}));
|
||||
|
||||
const ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
||||
const CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
||||
const ENDPOINT_CONFIG_OPTIONS = {
|
||||
environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],
|
||||
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
|
||||
default: undefined,
|
||||
};
|
||||
|
||||
var EndpointMode;
|
||||
(function (EndpointMode) {
|
||||
EndpointMode["IPv4"] = "IPv4";
|
||||
EndpointMode["IPv6"] = "IPv6";
|
||||
})(EndpointMode || (EndpointMode = {}));
|
||||
|
||||
const ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
|
||||
const CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
|
||||
const ENDPOINT_MODE_CONFIG_OPTIONS = {
|
||||
environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],
|
||||
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
|
||||
default: EndpointMode.IPv4,
|
||||
};
|
||||
|
||||
const getInstanceMetadataEndpoint = async () => urlParser.parseUrl((await getFromEndpointConfig()) || (await getFromEndpointModeConfig()));
|
||||
const getFromEndpointConfig = async () => nodeConfigProvider.loadConfig(ENDPOINT_CONFIG_OPTIONS)();
|
||||
const getFromEndpointModeConfig = async () => {
|
||||
const endpointMode = await nodeConfigProvider.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
||||
switch (endpointMode) {
|
||||
case EndpointMode.IPv4:
|
||||
return exports.yI.IPv4;
|
||||
case EndpointMode.IPv6:
|
||||
return exports.yI.IPv6;
|
||||
default:
|
||||
throw new Error(`Unsupported endpoint mode: ${endpointMode}.` + ` Select from ${Object.values(EndpointMode)}`);
|
||||
}
|
||||
};
|
||||
|
||||
const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
||||
const STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
||||
const STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
||||
const getExtendedInstanceMetadataCredentials = (credentials, logger) => {
|
||||
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS +
|
||||
Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
||||
const newExpiration = new Date(Date.now() + refreshInterval * 1000);
|
||||
logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these " +
|
||||
`credentials will be attempted after ${new Date(newExpiration)}.\nFor more information, please visit: ` +
|
||||
STATIC_STABILITY_DOC_URL);
|
||||
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
||||
return {
|
||||
...credentials,
|
||||
...(originalExpiration ? { originalExpiration } : {}),
|
||||
expiration: newExpiration,
|
||||
};
|
||||
};
|
||||
|
||||
const staticStabilityProvider = (provider, options = {}) => {
|
||||
const logger = options?.logger || console;
|
||||
let pastCredentials;
|
||||
return async () => {
|
||||
let credentials;
|
||||
try {
|
||||
credentials = await provider();
|
||||
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
||||
credentials = getExtendedInstanceMetadataCredentials(credentials, logger);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (pastCredentials) {
|
||||
logger.warn("Credential renew failed: ", e);
|
||||
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
pastCredentials = credentials;
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
|
||||
const IMDS_PATH = "/latest/meta-data/iam/security-credentials/";
|
||||
const IMDS_TOKEN_PATH = "/latest/api/token";
|
||||
const AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED";
|
||||
const PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled";
|
||||
const X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
|
||||
const fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger });
|
||||
const getInstanceMetadataProvider = (init = {}) => {
|
||||
let disableFetchToken = false;
|
||||
const { logger, profile } = init;
|
||||
const { timeout, maxRetries } = providerConfigFromInit(init);
|
||||
const getCredentials = async (maxRetries, options) => {
|
||||
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
||||
if (isImdsV1Fallback) {
|
||||
let fallbackBlockedFromProfile = false;
|
||||
let fallbackBlockedFromProcessEnv = false;
|
||||
const configValue = await nodeConfigProvider.loadConfig({
|
||||
environmentVariableSelector: (env) => {
|
||||
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
||||
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
||||
if (envValue === undefined) {
|
||||
throw new propertyProvider.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
||||
}
|
||||
return fallbackBlockedFromProcessEnv;
|
||||
},
|
||||
configFileSelector: (profile) => {
|
||||
const profileValue = profile[PROFILE_AWS_EC2_METADATA_V1_DISABLED];
|
||||
fallbackBlockedFromProfile = !!profileValue && profileValue !== "false";
|
||||
return fallbackBlockedFromProfile;
|
||||
},
|
||||
default: false,
|
||||
}, {
|
||||
profile,
|
||||
})();
|
||||
if (init.ec2MetadataV1Disabled || configValue) {
|
||||
const causes = [];
|
||||
if (init.ec2MetadataV1Disabled)
|
||||
causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");
|
||||
if (fallbackBlockedFromProfile)
|
||||
causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);
|
||||
if (fallbackBlockedFromProcessEnv)
|
||||
causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);
|
||||
throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(", ")}].`);
|
||||
}
|
||||
}
|
||||
const imdsProfile = (await retry(async () => {
|
||||
let profile;
|
||||
try {
|
||||
profile = await getProfile(options);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.statusCode === 401) {
|
||||
disableFetchToken = false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return profile;
|
||||
}, maxRetries)).trim();
|
||||
return retry(async () => {
|
||||
let creds;
|
||||
try {
|
||||
creds = await getCredentialsFromProfile(imdsProfile, options, init);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.statusCode === 401) {
|
||||
disableFetchToken = false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return creds;
|
||||
}, maxRetries);
|
||||
};
|
||||
return async () => {
|
||||
const endpoint = await getInstanceMetadataEndpoint();
|
||||
if (disableFetchToken) {
|
||||
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
||||
return getCredentials(maxRetries, { ...endpoint, timeout });
|
||||
}
|
||||
else {
|
||||
let token;
|
||||
try {
|
||||
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
||||
}
|
||||
catch (error) {
|
||||
if (error?.statusCode === 400) {
|
||||
throw Object.assign(error, {
|
||||
message: "EC2 Metadata token request returned error",
|
||||
});
|
||||
}
|
||||
else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
||||
disableFetchToken = true;
|
||||
}
|
||||
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
||||
return getCredentials(maxRetries, { ...endpoint, timeout });
|
||||
}
|
||||
return getCredentials(maxRetries, {
|
||||
...endpoint,
|
||||
headers: {
|
||||
[X_AWS_EC2_METADATA_TOKEN]: token,
|
||||
},
|
||||
timeout,
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
const getMetadataToken = async (options) => httpRequest({
|
||||
...options,
|
||||
path: IMDS_TOKEN_PATH,
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"x-aws-ec2-metadata-token-ttl-seconds": "21600",
|
||||
},
|
||||
});
|
||||
const getProfile = async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString();
|
||||
const getCredentialsFromProfile = async (profile, options, init) => {
|
||||
const credentialsResponse = JSON.parse((await httpRequest({
|
||||
...options,
|
||||
path: IMDS_PATH + profile,
|
||||
})).toString());
|
||||
if (!isImdsCredentials(credentialsResponse)) {
|
||||
throw new propertyProvider.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
||||
logger: init.logger,
|
||||
});
|
||||
}
|
||||
return fromImdsCredentials(credentialsResponse);
|
||||
};
|
||||
|
||||
__webpack_unused_export__ = DEFAULT_MAX_RETRIES;
|
||||
__webpack_unused_export__ = DEFAULT_TIMEOUT;
|
||||
__webpack_unused_export__ = ENV_CMDS_AUTH_TOKEN;
|
||||
exports.ENV_CMDS_FULL_URI = ENV_CMDS_FULL_URI;
|
||||
exports.ENV_CMDS_RELATIVE_URI = ENV_CMDS_RELATIVE_URI;
|
||||
exports.fromContainerMetadata = fromContainerMetadata;
|
||||
exports.fromInstanceMetadata = fromInstanceMetadata;
|
||||
exports.getInstanceMetadataEndpoint = getInstanceMetadataEndpoint;
|
||||
exports.httpRequest = httpRequest;
|
||||
__webpack_unused_export__ = providerConfigFromInit;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
"use strict";
|
||||
exports.id = 579;
|
||||
exports.ids = [579];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6579:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var utilUtf8 = __webpack_require__(1577);
|
||||
|
||||
class EventStreamSerde {
|
||||
marshaller;
|
||||
serializer;
|
||||
deserializer;
|
||||
serdeContext;
|
||||
defaultContentType;
|
||||
constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, }) {
|
||||
this.marshaller = marshaller;
|
||||
this.serializer = serializer;
|
||||
this.deserializer = deserializer;
|
||||
this.serdeContext = serdeContext;
|
||||
this.defaultContentType = defaultContentType;
|
||||
}
|
||||
async serializeEventStream({ eventStream, requestSchema, initialRequest, }) {
|
||||
const marshaller = this.marshaller;
|
||||
const eventStreamMember = requestSchema.getEventStreamMember();
|
||||
const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
|
||||
const serializer = this.serializer;
|
||||
const defaultContentType = this.defaultContentType;
|
||||
const initialRequestMarker = Symbol("initialRequestMarker");
|
||||
const eventStreamIterable = {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
if (initialRequest) {
|
||||
const headers = {
|
||||
":event-type": { type: "string", value: "initial-request" },
|
||||
":message-type": { type: "string", value: "event" },
|
||||
":content-type": { type: "string", value: defaultContentType },
|
||||
};
|
||||
serializer.write(requestSchema, initialRequest);
|
||||
const body = serializer.flush();
|
||||
yield {
|
||||
[initialRequestMarker]: true,
|
||||
headers,
|
||||
body,
|
||||
};
|
||||
}
|
||||
for await (const page of eventStream) {
|
||||
yield page;
|
||||
}
|
||||
},
|
||||
};
|
||||
return marshaller.serialize(eventStreamIterable, (event) => {
|
||||
if (event[initialRequestMarker]) {
|
||||
return {
|
||||
headers: event.headers,
|
||||
body: event.body,
|
||||
};
|
||||
}
|
||||
const unionMember = Object.keys(event).find((key) => {
|
||||
return key !== "__type";
|
||||
}) ?? "";
|
||||
const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);
|
||||
const headers = {
|
||||
":event-type": { type: "string", value: eventType },
|
||||
":message-type": { type: "string", value: "event" },
|
||||
":content-type": { type: "string", value: explicitPayloadContentType ?? defaultContentType },
|
||||
...additionalHeaders,
|
||||
};
|
||||
return {
|
||||
headers,
|
||||
body,
|
||||
};
|
||||
});
|
||||
}
|
||||
async deserializeEventStream({ response, responseSchema, initialResponseContainer, }) {
|
||||
const marshaller = this.marshaller;
|
||||
const eventStreamMember = responseSchema.getEventStreamMember();
|
||||
const unionSchema = responseSchema.getMemberSchema(eventStreamMember);
|
||||
const memberSchemas = unionSchema.getMemberSchemas();
|
||||
const initialResponseMarker = Symbol("initialResponseMarker");
|
||||
const asyncIterable = marshaller.deserialize(response.body, async (event) => {
|
||||
const unionMember = Object.keys(event).find((key) => {
|
||||
return key !== "__type";
|
||||
}) ?? "";
|
||||
const body = event[unionMember].body;
|
||||
if (unionMember === "initial-response") {
|
||||
const dataObject = await this.deserializer.read(responseSchema, body);
|
||||
delete dataObject[eventStreamMember];
|
||||
return {
|
||||
[initialResponseMarker]: true,
|
||||
...dataObject,
|
||||
};
|
||||
}
|
||||
else if (unionMember in memberSchemas) {
|
||||
const eventStreamSchema = memberSchemas[unionMember];
|
||||
if (eventStreamSchema.isStructSchema()) {
|
||||
const out = {};
|
||||
let hasBindings = false;
|
||||
for (const [name, member] of eventStreamSchema.structIterator()) {
|
||||
const { eventHeader, eventPayload } = member.getMergedTraits();
|
||||
hasBindings = hasBindings || Boolean(eventHeader || eventPayload);
|
||||
if (eventPayload) {
|
||||
if (member.isBlobSchema()) {
|
||||
out[name] = body;
|
||||
}
|
||||
else if (member.isStringSchema()) {
|
||||
out[name] = (this.serdeContext?.utf8Encoder ?? utilUtf8.toUtf8)(body);
|
||||
}
|
||||
else if (member.isStructSchema()) {
|
||||
out[name] = await this.deserializer.read(member, body);
|
||||
}
|
||||
}
|
||||
else if (eventHeader) {
|
||||
const value = event[unionMember].headers[name]?.value;
|
||||
if (value != null) {
|
||||
if (member.isNumericSchema()) {
|
||||
if (value && typeof value === "object" && "bytes" in value) {
|
||||
out[name] = BigInt(value.toString());
|
||||
}
|
||||
else {
|
||||
out[name] = Number(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
out[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasBindings) {
|
||||
return {
|
||||
[unionMember]: out,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
[unionMember]: await this.deserializer.read(eventStreamSchema, body),
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
$unknown: event,
|
||||
};
|
||||
}
|
||||
});
|
||||
const asyncIterator = asyncIterable[Symbol.asyncIterator]();
|
||||
const firstEvent = await asyncIterator.next();
|
||||
if (firstEvent.done) {
|
||||
return asyncIterable;
|
||||
}
|
||||
if (firstEvent.value?.[initialResponseMarker]) {
|
||||
if (!responseSchema) {
|
||||
throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
|
||||
}
|
||||
for (const [key, value] of Object.entries(firstEvent.value)) {
|
||||
initialResponseContainer[key] = value;
|
||||
}
|
||||
}
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
if (!firstEvent?.value?.[initialResponseMarker]) {
|
||||
yield firstEvent.value;
|
||||
}
|
||||
while (true) {
|
||||
const { done, value } = await asyncIterator.next();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
yield value;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
writeEventBody(unionMember, unionSchema, event) {
|
||||
const serializer = this.serializer;
|
||||
let eventType = unionMember;
|
||||
let explicitPayloadMember = null;
|
||||
let explicitPayloadContentType;
|
||||
const isKnownSchema = (() => {
|
||||
const struct = unionSchema.getSchema();
|
||||
return struct[4].includes(unionMember);
|
||||
})();
|
||||
const additionalHeaders = {};
|
||||
if (!isKnownSchema) {
|
||||
const [type, value] = event[unionMember];
|
||||
eventType = type;
|
||||
serializer.write(15, value);
|
||||
}
|
||||
else {
|
||||
const eventSchema = unionSchema.getMemberSchema(unionMember);
|
||||
if (eventSchema.isStructSchema()) {
|
||||
for (const [memberName, memberSchema] of eventSchema.structIterator()) {
|
||||
const { eventHeader, eventPayload } = memberSchema.getMergedTraits();
|
||||
if (eventPayload) {
|
||||
explicitPayloadMember = memberName;
|
||||
break;
|
||||
}
|
||||
else if (eventHeader) {
|
||||
const value = event[unionMember][memberName];
|
||||
let type = "binary";
|
||||
if (memberSchema.isNumericSchema()) {
|
||||
if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {
|
||||
type = "integer";
|
||||
}
|
||||
else {
|
||||
type = "long";
|
||||
}
|
||||
}
|
||||
else if (memberSchema.isTimestampSchema()) {
|
||||
type = "timestamp";
|
||||
}
|
||||
else if (memberSchema.isStringSchema()) {
|
||||
type = "string";
|
||||
}
|
||||
else if (memberSchema.isBooleanSchema()) {
|
||||
type = "boolean";
|
||||
}
|
||||
if (value != null) {
|
||||
additionalHeaders[memberName] = {
|
||||
type,
|
||||
value,
|
||||
};
|
||||
delete event[unionMember][memberName];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (explicitPayloadMember !== null) {
|
||||
const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);
|
||||
if (payloadSchema.isBlobSchema()) {
|
||||
explicitPayloadContentType = "application/octet-stream";
|
||||
}
|
||||
else if (payloadSchema.isStringSchema()) {
|
||||
explicitPayloadContentType = "text/plain";
|
||||
}
|
||||
serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);
|
||||
}
|
||||
else {
|
||||
serializer.write(eventSchema, event[unionMember]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
|
||||
}
|
||||
}
|
||||
const messageSerialization = serializer.flush();
|
||||
const body = typeof messageSerialization === "string"
|
||||
? (this.serdeContext?.utf8Decoder ?? utilUtf8.fromUtf8)(messageSerialization)
|
||||
: messageSerialization;
|
||||
return {
|
||||
body,
|
||||
eventType,
|
||||
explicitPayloadContentType,
|
||||
additionalHeaders,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.EventStreamSerde = EventStreamSerde;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
exports.id = 605;
|
||||
exports.ids = [605];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 1509:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.checkUrl = void 0;
|
||||
const property_provider_1 = __webpack_require__(1238);
|
||||
const LOOPBACK_CIDR_IPv4 = "127.0.0.0/8";
|
||||
const LOOPBACK_CIDR_IPv6 = "::1/128";
|
||||
const ECS_CONTAINER_HOST = "169.254.170.2";
|
||||
const EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
||||
const EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
||||
const checkUrl = (url, logger) => {
|
||||
if (url.protocol === "https:") {
|
||||
return;
|
||||
}
|
||||
if (url.hostname === ECS_CONTAINER_HOST ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv4 ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
||||
return;
|
||||
}
|
||||
if (url.hostname.includes("[")) {
|
||||
if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (url.hostname === "localhost") {
|
||||
return;
|
||||
}
|
||||
const ipComponents = url.hostname.split(".");
|
||||
const inRange = (component) => {
|
||||
const num = parseInt(component, 10);
|
||||
return 0 <= num && num <= 255;
|
||||
};
|
||||
if (ipComponents[0] === "127" &&
|
||||
inRange(ipComponents[1]) &&
|
||||
inRange(ipComponents[2]) &&
|
||||
inRange(ipComponents[3]) &&
|
||||
ipComponents.length === 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
||||
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
||||
- ECS container host 169.254.170.2
|
||||
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
||||
};
|
||||
exports.checkUrl = checkUrl;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6331:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.fromHttp = void 0;
|
||||
const tslib_1 = __webpack_require__(1860);
|
||||
const client_1 = __webpack_require__(5152);
|
||||
const node_http_handler_1 = __webpack_require__(1279);
|
||||
const property_provider_1 = __webpack_require__(1238);
|
||||
const promises_1 = tslib_1.__importDefault(__webpack_require__(1943));
|
||||
const checkUrl_1 = __webpack_require__(1509);
|
||||
const requestHelpers_1 = __webpack_require__(8914);
|
||||
const retry_wrapper_1 = __webpack_require__(1122);
|
||||
const AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
||||
const DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
|
||||
const AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
||||
const fromHttp = (options = {}) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
||||
let host;
|
||||
const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
||||
const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
||||
const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
||||
const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
||||
const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn
|
||||
? console.warn
|
||||
: options.logger.warn.bind(options.logger);
|
||||
if (relative && full) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
||||
warn("awsContainerCredentialsFullUri will take precedence.");
|
||||
}
|
||||
if (token && tokenFile) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
||||
warn("awsContainerAuthorizationToken will take precedence.");
|
||||
}
|
||||
if (full) {
|
||||
host = full;
|
||||
}
|
||||
else if (relative) {
|
||||
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
||||
}
|
||||
else {
|
||||
throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided.
|
||||
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
||||
}
|
||||
const url = new URL(host);
|
||||
(0, checkUrl_1.checkUrl)(url, options.logger);
|
||||
const requestHandler = node_http_handler_1.NodeHttpHandler.create({
|
||||
requestTimeout: options.timeout ?? 1000,
|
||||
connectionTimeout: options.timeout ?? 1000,
|
||||
});
|
||||
return (0, retry_wrapper_1.retryWrapper)(async () => {
|
||||
const request = (0, requestHelpers_1.createGetRequest)(url);
|
||||
if (token) {
|
||||
request.headers.Authorization = token;
|
||||
}
|
||||
else if (tokenFile) {
|
||||
request.headers.Authorization = (await promises_1.default.readFile(tokenFile)).toString();
|
||||
}
|
||||
try {
|
||||
const result = await requestHandler.handle(request);
|
||||
return (0, requestHelpers_1.getCredentials)(result.response).then((creds) => (0, client_1.setCredentialFeature)(creds, "CREDENTIALS_HTTP", "z"));
|
||||
}
|
||||
catch (e) {
|
||||
throw new property_provider_1.CredentialsProviderError(String(e), { logger: options.logger });
|
||||
}
|
||||
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
||||
};
|
||||
exports.fromHttp = fromHttp;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8914:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.createGetRequest = createGetRequest;
|
||||
exports.getCredentials = getCredentials;
|
||||
const property_provider_1 = __webpack_require__(1238);
|
||||
const protocol_http_1 = __webpack_require__(2356);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const util_stream_1 = __webpack_require__(4252);
|
||||
function createGetRequest(url) {
|
||||
return new protocol_http_1.HttpRequest({
|
||||
protocol: url.protocol,
|
||||
hostname: url.hostname,
|
||||
port: Number(url.port),
|
||||
path: url.pathname,
|
||||
query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
|
||||
acc[k] = v;
|
||||
return acc;
|
||||
}, {}),
|
||||
fragment: url.hash,
|
||||
});
|
||||
}
|
||||
async function getCredentials(response, logger) {
|
||||
const stream = (0, util_stream_1.sdkStreamMixin)(response.body);
|
||||
const str = await stream.transformToString();
|
||||
if (response.statusCode === 200) {
|
||||
const parsed = JSON.parse(str);
|
||||
if (typeof parsed.AccessKeyId !== "string" ||
|
||||
typeof parsed.SecretAccessKey !== "string" ||
|
||||
typeof parsed.Token !== "string" ||
|
||||
typeof parsed.Expiration !== "string") {
|
||||
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " +
|
||||
"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
||||
}
|
||||
return {
|
||||
accessKeyId: parsed.AccessKeyId,
|
||||
secretAccessKey: parsed.SecretAccessKey,
|
||||
sessionToken: parsed.Token,
|
||||
expiration: (0, smithy_client_1.parseRfc3339DateTime)(parsed.Expiration),
|
||||
};
|
||||
}
|
||||
if (response.statusCode >= 400 && response.statusCode < 500) {
|
||||
let parsedBody = {};
|
||||
try {
|
||||
parsedBody = JSON.parse(str);
|
||||
}
|
||||
catch (e) { }
|
||||
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
||||
Code: parsedBody.Code,
|
||||
Message: parsedBody.Message,
|
||||
});
|
||||
}
|
||||
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1122:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.retryWrapper = void 0;
|
||||
const retryWrapper = (toRetry, maxRetries, delayMs) => {
|
||||
return async () => {
|
||||
for (let i = 0; i < maxRetries; ++i) {
|
||||
try {
|
||||
return await toRetry();
|
||||
}
|
||||
catch (e) {
|
||||
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
||||
}
|
||||
}
|
||||
return await toRetry();
|
||||
};
|
||||
};
|
||||
exports.retryWrapper = retryWrapper;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8605:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
__webpack_unused_export__ = ({ value: true });
|
||||
exports.fromHttp = void 0;
|
||||
var fromHttp_1 = __webpack_require__(6331);
|
||||
Object.defineProperty(exports, "fromHttp", ({ enumerable: true, get: function () { return fromHttp_1.fromHttp; } }));
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
exports.id = 869;
|
||||
exports.ids = [869];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 5869:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var sharedIniFileLoader = __webpack_require__(4964);
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
var client = __webpack_require__(5152);
|
||||
|
||||
const resolveCredentialSource = (credentialSource, profileName, logger) => {
|
||||
const sourceProvidersMap = {
|
||||
EcsContainer: async (options) => {
|
||||
const { fromHttp } = await __webpack_require__.e(/* import() */ 605).then(__webpack_require__.bind(__webpack_require__, 8605));
|
||||
const { fromContainerMetadata } = await __webpack_require__.e(/* import() */ 566).then(__webpack_require__.t.bind(__webpack_require__, 566, 19));
|
||||
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
||||
return async () => propertyProvider.chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
|
||||
},
|
||||
Ec2InstanceMetadata: async (options) => {
|
||||
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
||||
const { fromInstanceMetadata } = await __webpack_require__.e(/* import() */ 566).then(__webpack_require__.t.bind(__webpack_require__, 566, 19));
|
||||
return async () => fromInstanceMetadata(options)().then(setNamedProvider);
|
||||
},
|
||||
Environment: async (options) => {
|
||||
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
||||
const { fromEnv } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 5606, 19));
|
||||
return async () => fromEnv(options)().then(setNamedProvider);
|
||||
},
|
||||
};
|
||||
if (credentialSource in sourceProvidersMap) {
|
||||
return sourceProvidersMap[credentialSource];
|
||||
}
|
||||
else {
|
||||
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, ` +
|
||||
`expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
||||
}
|
||||
};
|
||||
const setNamedProvider = (creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
||||
|
||||
const isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
||||
return (Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.role_arn === "string" &&
|
||||
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 &&
|
||||
["undefined", "string"].indexOf(typeof arg.external_id) > -1 &&
|
||||
["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 &&
|
||||
(isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })));
|
||||
};
|
||||
const isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
|
||||
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
||||
if (withSourceProfile) {
|
||||
logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
|
||||
}
|
||||
return withSourceProfile;
|
||||
};
|
||||
const isCredentialSourceProfile = (arg, { profile, logger }) => {
|
||||
const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
||||
if (withProviderProfile) {
|
||||
logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
|
||||
}
|
||||
return withProviderProfile;
|
||||
};
|
||||
const resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}, resolveProfileData) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
|
||||
const profileData = profiles[profileName];
|
||||
const { source_profile, region } = profileData;
|
||||
if (!options.roleAssumer) {
|
||||
const { getDefaultRoleAssumer } = await __webpack_require__.e(/* import() */ 136).then(__webpack_require__.t.bind(__webpack_require__, 1136, 23));
|
||||
options.roleAssumer = getDefaultRoleAssumer({
|
||||
...options.clientConfig,
|
||||
credentialProviderLogger: options.logger,
|
||||
parentClientConfig: {
|
||||
...options?.parentClientConfig,
|
||||
region: region ?? options?.parentClientConfig?.region,
|
||||
},
|
||||
}, options.clientPlugins);
|
||||
}
|
||||
if (source_profile && source_profile in visitedProfiles) {
|
||||
throw new propertyProvider.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile` +
|
||||
` ${sharedIniFileLoader.getProfileName(options)}. Profiles visited: ` +
|
||||
Object.keys(visitedProfiles).join(", "), { logger: options.logger });
|
||||
}
|
||||
options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
|
||||
const sourceCredsProvider = source_profile
|
||||
? resolveProfileData(source_profile, profiles, options, {
|
||||
...visitedProfiles,
|
||||
[source_profile]: true,
|
||||
}, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {}))
|
||||
: (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
|
||||
if (isCredentialSourceWithoutRoleArn(profileData)) {
|
||||
return sourceCredsProvider.then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
||||
}
|
||||
else {
|
||||
const params = {
|
||||
RoleArn: profileData.role_arn,
|
||||
RoleSessionName: profileData.role_session_name || `aws-sdk-js-${Date.now()}`,
|
||||
ExternalId: profileData.external_id,
|
||||
DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10),
|
||||
};
|
||||
const { mfa_serial } = profileData;
|
||||
if (mfa_serial) {
|
||||
if (!options.mfaCodeProvider) {
|
||||
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
|
||||
}
|
||||
params.SerialNumber = mfa_serial;
|
||||
params.TokenCode = await options.mfaCodeProvider(mfa_serial);
|
||||
}
|
||||
const sourceCreds = await sourceCredsProvider;
|
||||
return options.roleAssumer(sourceCreds, params).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
||||
}
|
||||
};
|
||||
const isCredentialSourceWithoutRoleArn = (section) => {
|
||||
return !section.role_arn && !!section.credential_source;
|
||||
};
|
||||
|
||||
const isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
|
||||
const resolveProcessCredentials = async (options, profile) => __webpack_require__.e(/* import() */ 360).then(__webpack_require__.t.bind(__webpack_require__, 5360, 19)).then(({ fromProcess }) => fromProcess({
|
||||
...options,
|
||||
profile,
|
||||
})().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v")));
|
||||
|
||||
const resolveSsoCredentials = async (profile, profileData, options = {}) => {
|
||||
const { fromSSO } = await __webpack_require__.e(/* import() */ 998).then(__webpack_require__.t.bind(__webpack_require__, 998, 19));
|
||||
return fromSSO({
|
||||
profile,
|
||||
logger: options.logger,
|
||||
parentClientConfig: options.parentClientConfig,
|
||||
clientConfig: options.clientConfig,
|
||||
})().then((creds) => {
|
||||
if (profileData.sso_session) {
|
||||
return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
||||
}
|
||||
else {
|
||||
return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
|
||||
}
|
||||
});
|
||||
};
|
||||
const isSsoProfile = (arg) => arg &&
|
||||
(typeof arg.sso_start_url === "string" ||
|
||||
typeof arg.sso_account_id === "string" ||
|
||||
typeof arg.sso_session === "string" ||
|
||||
typeof arg.sso_region === "string" ||
|
||||
typeof arg.sso_role_name === "string");
|
||||
|
||||
const isStaticCredsProfile = (arg) => Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.aws_access_key_id === "string" &&
|
||||
typeof arg.aws_secret_access_key === "string" &&
|
||||
["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 &&
|
||||
["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1;
|
||||
const resolveStaticCredentials = async (profile, options) => {
|
||||
options?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
|
||||
const credentials = {
|
||||
accessKeyId: profile.aws_access_key_id,
|
||||
secretAccessKey: profile.aws_secret_access_key,
|
||||
sessionToken: profile.aws_session_token,
|
||||
...(profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }),
|
||||
...(profile.aws_account_id && { accountId: profile.aws_account_id }),
|
||||
};
|
||||
return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
|
||||
};
|
||||
|
||||
const isWebIdentityProfile = (arg) => Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.web_identity_token_file === "string" &&
|
||||
typeof arg.role_arn === "string" &&
|
||||
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
|
||||
const resolveWebIdentityCredentials = async (profile, options) => __webpack_require__.e(/* import() */ 956).then(__webpack_require__.t.bind(__webpack_require__, 9956, 23)).then(({ fromTokenFile }) => fromTokenFile({
|
||||
webIdentityTokenFile: profile.web_identity_token_file,
|
||||
roleArn: profile.role_arn,
|
||||
roleSessionName: profile.role_session_name,
|
||||
roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
|
||||
logger: options.logger,
|
||||
parentClientConfig: options.parentClientConfig,
|
||||
})().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q")));
|
||||
|
||||
const resolveProfileData = async (profileName, profiles, options, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
|
||||
const data = profiles[profileName];
|
||||
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
||||
return resolveStaticCredentials(data, options);
|
||||
}
|
||||
if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
|
||||
return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles, resolveProfileData);
|
||||
}
|
||||
if (isStaticCredsProfile(data)) {
|
||||
return resolveStaticCredentials(data, options);
|
||||
}
|
||||
if (isWebIdentityProfile(data)) {
|
||||
return resolveWebIdentityCredentials(data, options);
|
||||
}
|
||||
if (isProcessProfile(data)) {
|
||||
return resolveProcessCredentials(options, profileName);
|
||||
}
|
||||
if (isSsoProfile(data)) {
|
||||
return await resolveSsoCredentials(profileName, data, options);
|
||||
}
|
||||
throw new propertyProvider.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
|
||||
};
|
||||
|
||||
const fromIni = (_init = {}) => async ({ callerClientConfig } = {}) => {
|
||||
const init = {
|
||||
..._init,
|
||||
parentClientConfig: {
|
||||
...callerClientConfig,
|
||||
..._init.parentClientConfig,
|
||||
},
|
||||
};
|
||||
init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
|
||||
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
||||
return resolveProfileData(sharedIniFileLoader.getProfileName({
|
||||
profile: _init.profile ?? callerClientConfig?.profile,
|
||||
}), profiles, init);
|
||||
};
|
||||
|
||||
exports.fromIni = fromIni;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+1039
File diff suppressed because it is too large
Load Diff
+1455
File diff suppressed because it is too large
Load Diff
+56
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
exports.id = 121;
|
||||
exports.ids = [121];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 7121:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
|
||||
var client = __webpack_require__(5152);
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
|
||||
const ENV_KEY = "AWS_ACCESS_KEY_ID";
|
||||
const ENV_SECRET = "AWS_SECRET_ACCESS_KEY";
|
||||
const ENV_SESSION = "AWS_SESSION_TOKEN";
|
||||
const ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION";
|
||||
const ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE";
|
||||
const ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID";
|
||||
const fromEnv = (init) => async () => {
|
||||
init?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");
|
||||
const accessKeyId = process.env[ENV_KEY];
|
||||
const secretAccessKey = process.env[ENV_SECRET];
|
||||
const sessionToken = process.env[ENV_SESSION];
|
||||
const expiry = process.env[ENV_EXPIRATION];
|
||||
const credentialScope = process.env[ENV_CREDENTIAL_SCOPE];
|
||||
const accountId = process.env[ENV_ACCOUNT_ID];
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
const credentials = {
|
||||
accessKeyId,
|
||||
secretAccessKey,
|
||||
...(sessionToken && { sessionToken }),
|
||||
...(expiry && { expiration: new Date(expiry) }),
|
||||
...(credentialScope && { credentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
|
||||
return credentials;
|
||||
}
|
||||
throw new propertyProvider.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
|
||||
};
|
||||
|
||||
__webpack_unused_export__ = ENV_ACCOUNT_ID;
|
||||
__webpack_unused_export__ = ENV_CREDENTIAL_SCOPE;
|
||||
__webpack_unused_export__ = ENV_EXPIRATION;
|
||||
__webpack_unused_export__ = ENV_KEY;
|
||||
__webpack_unused_export__ = ENV_SECRET;
|
||||
__webpack_unused_export__ = ENV_SESSION;
|
||||
exports.fromEnv = fromEnv;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+903
@@ -0,0 +1,903 @@
|
||||
"use strict";
|
||||
exports.id = 136;
|
||||
exports.ids = [136];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 3723:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.STSClient = exports.__Client = void 0;
|
||||
const middleware_host_header_1 = __webpack_require__(2590);
|
||||
const middleware_logger_1 = __webpack_require__(5242);
|
||||
const middleware_recursion_detection_1 = __webpack_require__(1568);
|
||||
const middleware_user_agent_1 = __webpack_require__(2959);
|
||||
const config_resolver_1 = __webpack_require__(9316);
|
||||
const core_1 = __webpack_require__(402);
|
||||
const schema_1 = __webpack_require__(6890);
|
||||
const middleware_content_length_1 = __webpack_require__(7212);
|
||||
const middleware_endpoint_1 = __webpack_require__(99);
|
||||
const middleware_retry_1 = __webpack_require__(9618);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
Object.defineProperty(exports, "__Client", ({ enumerable: true, get: function () { return smithy_client_1.Client; } }));
|
||||
const httpAuthSchemeProvider_1 = __webpack_require__(7851);
|
||||
const EndpointParameters_1 = __webpack_require__(6811);
|
||||
const runtimeConfig_1 = __webpack_require__(6578);
|
||||
const runtimeExtensions_1 = __webpack_require__(7742);
|
||||
class STSClient extends smithy_client_1.Client {
|
||||
config;
|
||||
constructor(...[configuration]) {
|
||||
const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {});
|
||||
super(_config_0);
|
||||
this.initConfig = _config_0;
|
||||
const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0);
|
||||
const _config_2 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_1);
|
||||
const _config_3 = (0, middleware_retry_1.resolveRetryConfig)(_config_2);
|
||||
const _config_4 = (0, config_resolver_1.resolveRegionConfig)(_config_3);
|
||||
const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4);
|
||||
const _config_6 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_5);
|
||||
const _config_7 = (0, httpAuthSchemeProvider_1.resolveHttpAuthSchemeConfig)(_config_6);
|
||||
const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []);
|
||||
this.config = _config_8;
|
||||
this.middlewareStack.use((0, schema_1.getSchemaSerdePlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config));
|
||||
this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config));
|
||||
this.middlewareStack.use((0, core_1.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
|
||||
httpAuthSchemeParametersProvider: httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeParametersProvider,
|
||||
identityProviderConfigProvider: async (config) => new core_1.DefaultIdentityProviderConfig({
|
||||
"aws.auth#sigv4": config.credentials,
|
||||
}),
|
||||
}));
|
||||
this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config));
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
exports.STSClient = STSClient;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4532:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveHttpAuthRuntimeConfig = exports.getHttpAuthExtensionConfiguration = void 0;
|
||||
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.getHttpAuthExtensionConfiguration = getHttpAuthExtensionConfiguration;
|
||||
const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
exports.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7851:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveHttpAuthSchemeConfig = exports.resolveStsAuthConfig = exports.defaultSTSHttpAuthSchemeProvider = exports.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_middleware_1 = __webpack_require__(6324);
|
||||
const STSClient_1 = __webpack_require__(3723);
|
||||
const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
|
||||
region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
|
||||
(() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
exports.defaultSTSHttpAuthSchemeParametersProvider = defaultSTSHttpAuthSchemeParametersProvider;
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "sts",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "smithy.api#noAuth",
|
||||
};
|
||||
}
|
||||
const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
case "AssumeRoleWithWebIdentity": {
|
||||
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
exports.defaultSTSHttpAuthSchemeProvider = defaultSTSHttpAuthSchemeProvider;
|
||||
const resolveStsAuthConfig = (input) => Object.assign(input, {
|
||||
stsClientCtor: STSClient_1.STSClient,
|
||||
});
|
||||
exports.resolveStsAuthConfig = resolveStsAuthConfig;
|
||||
const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = (0, exports.resolveStsAuthConfig)(config);
|
||||
const config_1 = (0, core_1.resolveAwsSdkSigV4Config)(config_0);
|
||||
return Object.assign(config_1, {
|
||||
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6811:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.commonParams = exports.resolveClientEndpointParameters = void 0;
|
||||
const resolveClientEndpointParameters = (options) => {
|
||||
return Object.assign(options, {
|
||||
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
||||
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
||||
useGlobalEndpoint: options.useGlobalEndpoint ?? false,
|
||||
defaultSigningName: "sts",
|
||||
});
|
||||
};
|
||||
exports.resolveClientEndpointParameters = resolveClientEndpointParameters;
|
||||
exports.commonParams = {
|
||||
UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" },
|
||||
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
||||
Endpoint: { type: "builtInParams", name: "endpoint" },
|
||||
Region: { type: "builtInParams", name: "region" },
|
||||
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9765:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.defaultEndpointResolver = void 0;
|
||||
const util_endpoints_1 = __webpack_require__(3068);
|
||||
const util_endpoints_2 = __webpack_require__(9674);
|
||||
const ruleset_1 = __webpack_require__(1670);
|
||||
const cache = new util_endpoints_2.EndpointCache({
|
||||
size: 50,
|
||||
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
|
||||
});
|
||||
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
||||
return cache.get(endpointParams, () => (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, {
|
||||
endpointParams: endpointParams,
|
||||
logger: context.logger,
|
||||
}));
|
||||
};
|
||||
exports.defaultEndpointResolver = defaultEndpointResolver;
|
||||
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1670:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.ruleSet = void 0;
|
||||
const F = "required", G = "type", H = "fn", I = "argv", J = "ref";
|
||||
const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4", f = "sts", g = "us-east-1", h = "endpoint", i = "https://sts.{Region}.{PartitionResult#dnsSuffix}", j = "tree", k = "error", l = "getAttr", m = { [F]: false, [G]: "string" }, n = { [F]: true, "default": false, [G]: "boolean" }, o = { [J]: "Endpoint" }, p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }, q = { [J]: "Region" }, r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }, s = { [J]: "UseFIPS" }, t = { [J]: "UseDualStack" }, u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": e, "signingName": f, "signingRegion": g }] }, "headers": {} }, v = {}, w = { "conditions": [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }, x = { [H]: c, [I]: [s, true] }, y = { [H]: c, [I]: [t, true] }, z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }, A = { [J]: "PartitionResult" }, B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }, C = [{ [H]: "isSet", [I]: [o] }], D = [x], E = [y];
|
||||
const _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] };
|
||||
exports.ruleSet = _data;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1136:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var STSClient = __webpack_require__(3723);
|
||||
var smithyClient = __webpack_require__(1411);
|
||||
var middlewareEndpoint = __webpack_require__(99);
|
||||
var EndpointParameters = __webpack_require__(6811);
|
||||
var schema = __webpack_require__(6890);
|
||||
var client = __webpack_require__(5152);
|
||||
var regionConfigResolver = __webpack_require__(6463);
|
||||
|
||||
let STSServiceException$1 = class STSServiceException extends smithyClient.ServiceException {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
Object.setPrototypeOf(this, STSServiceException.prototype);
|
||||
}
|
||||
};
|
||||
|
||||
let ExpiredTokenException$1 = class ExpiredTokenException extends STSServiceException$1 {
|
||||
name = "ExpiredTokenException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "ExpiredTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
||||
}
|
||||
};
|
||||
let MalformedPolicyDocumentException$1 = class MalformedPolicyDocumentException extends STSServiceException$1 {
|
||||
name = "MalformedPolicyDocumentException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "MalformedPolicyDocumentException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, MalformedPolicyDocumentException.prototype);
|
||||
}
|
||||
};
|
||||
let PackedPolicyTooLargeException$1 = class PackedPolicyTooLargeException extends STSServiceException$1 {
|
||||
name = "PackedPolicyTooLargeException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "PackedPolicyTooLargeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, PackedPolicyTooLargeException.prototype);
|
||||
}
|
||||
};
|
||||
let RegionDisabledException$1 = class RegionDisabledException extends STSServiceException$1 {
|
||||
name = "RegionDisabledException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "RegionDisabledException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, RegionDisabledException.prototype);
|
||||
}
|
||||
};
|
||||
let IDPRejectedClaimException$1 = class IDPRejectedClaimException extends STSServiceException$1 {
|
||||
name = "IDPRejectedClaimException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "IDPRejectedClaimException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, IDPRejectedClaimException.prototype);
|
||||
}
|
||||
};
|
||||
let InvalidIdentityTokenException$1 = class InvalidIdentityTokenException extends STSServiceException$1 {
|
||||
name = "InvalidIdentityTokenException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidIdentityTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidIdentityTokenException.prototype);
|
||||
}
|
||||
};
|
||||
let IDPCommunicationErrorException$1 = class IDPCommunicationErrorException extends STSServiceException$1 {
|
||||
name = "IDPCommunicationErrorException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "IDPCommunicationErrorException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, IDPCommunicationErrorException.prototype);
|
||||
}
|
||||
};
|
||||
|
||||
const _A = "Arn";
|
||||
const _AKI = "AccessKeyId";
|
||||
const _AR = "AssumeRole";
|
||||
const _ARI = "AssumedRoleId";
|
||||
const _ARR = "AssumeRoleRequest";
|
||||
const _ARRs = "AssumeRoleResponse";
|
||||
const _ARU = "AssumedRoleUser";
|
||||
const _ARWWI = "AssumeRoleWithWebIdentity";
|
||||
const _ARWWIR = "AssumeRoleWithWebIdentityRequest";
|
||||
const _ARWWIRs = "AssumeRoleWithWebIdentityResponse";
|
||||
const _Au = "Audience";
|
||||
const _C = "Credentials";
|
||||
const _CA = "ContextAssertion";
|
||||
const _DS = "DurationSeconds";
|
||||
const _E = "Expiration";
|
||||
const _EI = "ExternalId";
|
||||
const _ETE = "ExpiredTokenException";
|
||||
const _IDPCEE = "IDPCommunicationErrorException";
|
||||
const _IDPRCE = "IDPRejectedClaimException";
|
||||
const _IITE = "InvalidIdentityTokenException";
|
||||
const _K = "Key";
|
||||
const _MPDE = "MalformedPolicyDocumentException";
|
||||
const _P = "Policy";
|
||||
const _PA = "PolicyArns";
|
||||
const _PAr = "ProviderArn";
|
||||
const _PC = "ProvidedContexts";
|
||||
const _PCLT = "ProvidedContextsListType";
|
||||
const _PCr = "ProvidedContext";
|
||||
const _PDT = "PolicyDescriptorType";
|
||||
const _PI = "ProviderId";
|
||||
const _PPS = "PackedPolicySize";
|
||||
const _PPTLE = "PackedPolicyTooLargeException";
|
||||
const _Pr = "Provider";
|
||||
const _RA = "RoleArn";
|
||||
const _RDE = "RegionDisabledException";
|
||||
const _RSN = "RoleSessionName";
|
||||
const _SAK = "SecretAccessKey";
|
||||
const _SFWIT = "SubjectFromWebIdentityToken";
|
||||
const _SI = "SourceIdentity";
|
||||
const _SN = "SerialNumber";
|
||||
const _ST = "SessionToken";
|
||||
const _T = "Tags";
|
||||
const _TC = "TokenCode";
|
||||
const _TTK = "TransitiveTagKeys";
|
||||
const _Ta = "Tag";
|
||||
const _V = "Value";
|
||||
const _WIT = "WebIdentityToken";
|
||||
const _a = "arn";
|
||||
const _aKST = "accessKeySecretType";
|
||||
const _aQE = "awsQueryError";
|
||||
const _c = "client";
|
||||
const _cTT = "clientTokenType";
|
||||
const _e = "error";
|
||||
const _hE = "httpError";
|
||||
const _m = "message";
|
||||
const _pDLT = "policyDescriptorListType";
|
||||
const _s = "smithy.ts.sdk.synthetic.com.amazonaws.sts";
|
||||
const _tLT = "tagListType";
|
||||
const n0 = "com.amazonaws.sts";
|
||||
var accessKeySecretType = [0, n0, _aKST, 8, 0];
|
||||
var clientTokenType = [0, n0, _cTT, 8, 0];
|
||||
var AssumedRoleUser = [3, n0, _ARU, 0, [_ARI, _A], [0, 0]];
|
||||
var AssumeRoleRequest = [
|
||||
3,
|
||||
n0,
|
||||
_ARR,
|
||||
0,
|
||||
[_RA, _RSN, _PA, _P, _DS, _T, _TTK, _EI, _SN, _TC, _SI, _PC],
|
||||
[0, 0, () => policyDescriptorListType, 0, 1, () => tagListType, 64 | 0, 0, 0, 0, 0, () => ProvidedContextsListType],
|
||||
];
|
||||
var AssumeRoleResponse = [
|
||||
3,
|
||||
n0,
|
||||
_ARRs,
|
||||
0,
|
||||
[_C, _ARU, _PPS, _SI],
|
||||
[[() => Credentials, 0], () => AssumedRoleUser, 1, 0],
|
||||
];
|
||||
var AssumeRoleWithWebIdentityRequest = [
|
||||
3,
|
||||
n0,
|
||||
_ARWWIR,
|
||||
0,
|
||||
[_RA, _RSN, _WIT, _PI, _PA, _P, _DS],
|
||||
[0, 0, [() => clientTokenType, 0], 0, () => policyDescriptorListType, 0, 1],
|
||||
];
|
||||
var AssumeRoleWithWebIdentityResponse = [
|
||||
3,
|
||||
n0,
|
||||
_ARWWIRs,
|
||||
0,
|
||||
[_C, _SFWIT, _ARU, _PPS, _Pr, _Au, _SI],
|
||||
[[() => Credentials, 0], 0, () => AssumedRoleUser, 1, 0, 0, 0],
|
||||
];
|
||||
var Credentials = [
|
||||
3,
|
||||
n0,
|
||||
_C,
|
||||
0,
|
||||
[_AKI, _SAK, _ST, _E],
|
||||
[0, [() => accessKeySecretType, 0], 0, 4],
|
||||
];
|
||||
var ExpiredTokenException = [
|
||||
-3,
|
||||
n0,
|
||||
_ETE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`ExpiredTokenException`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(ExpiredTokenException, ExpiredTokenException$1);
|
||||
var IDPCommunicationErrorException = [
|
||||
-3,
|
||||
n0,
|
||||
_IDPCEE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`IDPCommunicationError`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(IDPCommunicationErrorException, IDPCommunicationErrorException$1);
|
||||
var IDPRejectedClaimException = [
|
||||
-3,
|
||||
n0,
|
||||
_IDPRCE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 403,
|
||||
[_aQE]: [`IDPRejectedClaim`, 403],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(IDPRejectedClaimException, IDPRejectedClaimException$1);
|
||||
var InvalidIdentityTokenException = [
|
||||
-3,
|
||||
n0,
|
||||
_IITE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`InvalidIdentityToken`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidIdentityTokenException, InvalidIdentityTokenException$1);
|
||||
var MalformedPolicyDocumentException = [
|
||||
-3,
|
||||
n0,
|
||||
_MPDE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`MalformedPolicyDocument`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(MalformedPolicyDocumentException, MalformedPolicyDocumentException$1);
|
||||
var PackedPolicyTooLargeException = [
|
||||
-3,
|
||||
n0,
|
||||
_PPTLE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
[_aQE]: [`PackedPolicyTooLarge`, 400],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(PackedPolicyTooLargeException, PackedPolicyTooLargeException$1);
|
||||
var PolicyDescriptorType = [3, n0, _PDT, 0, [_a], [0]];
|
||||
var ProvidedContext = [3, n0, _PCr, 0, [_PAr, _CA], [0, 0]];
|
||||
var RegionDisabledException = [
|
||||
-3,
|
||||
n0,
|
||||
_RDE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 403,
|
||||
[_aQE]: [`RegionDisabledException`, 403],
|
||||
},
|
||||
[_m],
|
||||
[0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(RegionDisabledException, RegionDisabledException$1);
|
||||
var Tag = [3, n0, _Ta, 0, [_K, _V], [0, 0]];
|
||||
var STSServiceException = [-3, _s, "STSServiceException", 0, [], []];
|
||||
schema.TypeRegistry.for(_s).registerError(STSServiceException, STSServiceException$1);
|
||||
var policyDescriptorListType = [1, n0, _pDLT, 0, () => PolicyDescriptorType];
|
||||
var ProvidedContextsListType = [1, n0, _PCLT, 0, () => ProvidedContext];
|
||||
var tagListType = [1, n0, _tLT, 0, () => Tag];
|
||||
var AssumeRole = [9, n0, _AR, 0, () => AssumeRoleRequest, () => AssumeRoleResponse];
|
||||
var AssumeRoleWithWebIdentity = [
|
||||
9,
|
||||
n0,
|
||||
_ARWWI,
|
||||
0,
|
||||
() => AssumeRoleWithWebIdentityRequest,
|
||||
() => AssumeRoleWithWebIdentityResponse,
|
||||
];
|
||||
|
||||
class AssumeRoleCommand extends smithyClient.Command
|
||||
.classBuilder()
|
||||
.ep(EndpointParameters.commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
||||
})
|
||||
.s("AWSSecurityTokenServiceV20110615", "AssumeRole", {})
|
||||
.n("STSClient", "AssumeRoleCommand")
|
||||
.sc(AssumeRole)
|
||||
.build() {
|
||||
}
|
||||
|
||||
class AssumeRoleWithWebIdentityCommand extends smithyClient.Command
|
||||
.classBuilder()
|
||||
.ep(EndpointParameters.commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
||||
})
|
||||
.s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {})
|
||||
.n("STSClient", "AssumeRoleWithWebIdentityCommand")
|
||||
.sc(AssumeRoleWithWebIdentity)
|
||||
.build() {
|
||||
}
|
||||
|
||||
const commands = {
|
||||
AssumeRoleCommand,
|
||||
AssumeRoleWithWebIdentityCommand,
|
||||
};
|
||||
class STS extends STSClient.STSClient {
|
||||
}
|
||||
smithyClient.createAggregatedClient(commands, STS);
|
||||
|
||||
const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
|
||||
if (typeof assumedRoleUser?.Arn === "string") {
|
||||
const arnComponents = assumedRoleUser.Arn.split(":");
|
||||
if (arnComponents.length > 4 && arnComponents[4] !== "") {
|
||||
return arnComponents[4];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const resolveRegion = async (_region, _parentRegion, credentialProviderLogger, loaderConfig = {}) => {
|
||||
const region = typeof _region === "function" ? await _region() : _region;
|
||||
const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion;
|
||||
const stsDefaultRegion = await regionConfigResolver.stsRegionDefaultResolver(loaderConfig)();
|
||||
credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (credential provider clientConfig)`, `${parentRegion} (contextual client)`, `${stsDefaultRegion} (STS default: AWS_REGION, profile region, or us-east-1)`);
|
||||
return region ?? parentRegion ?? stsDefaultRegion;
|
||||
};
|
||||
const getDefaultRoleAssumer$1 = (stsOptions, STSClient) => {
|
||||
let stsClient;
|
||||
let closureSourceCreds;
|
||||
return async (sourceCreds, params) => {
|
||||
closureSourceCreds = sourceCreds;
|
||||
if (!stsClient) {
|
||||
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId, } = stsOptions;
|
||||
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
||||
logger,
|
||||
profile,
|
||||
});
|
||||
const isCompatibleRequestHandler = !isH2(requestHandler);
|
||||
stsClient = new STSClient({
|
||||
...stsOptions,
|
||||
userAgentAppId,
|
||||
profile,
|
||||
credentialDefaultProvider: () => async () => closureSourceCreds,
|
||||
region: resolvedRegion,
|
||||
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
||||
logger: logger,
|
||||
});
|
||||
}
|
||||
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleCommand(params));
|
||||
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
||||
throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
|
||||
}
|
||||
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
||||
const credentials = {
|
||||
accessKeyId: Credentials.AccessKeyId,
|
||||
secretAccessKey: Credentials.SecretAccessKey,
|
||||
sessionToken: Credentials.SessionToken,
|
||||
expiration: Credentials.Expiration,
|
||||
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE", "i");
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
const getDefaultRoleAssumerWithWebIdentity$1 = (stsOptions, STSClient) => {
|
||||
let stsClient;
|
||||
return async (params) => {
|
||||
if (!stsClient) {
|
||||
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId, } = stsOptions;
|
||||
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
||||
logger,
|
||||
profile,
|
||||
});
|
||||
const isCompatibleRequestHandler = !isH2(requestHandler);
|
||||
stsClient = new STSClient({
|
||||
...stsOptions,
|
||||
userAgentAppId,
|
||||
profile,
|
||||
region: resolvedRegion,
|
||||
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
||||
logger: logger,
|
||||
});
|
||||
}
|
||||
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
|
||||
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
||||
throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`);
|
||||
}
|
||||
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
||||
const credentials = {
|
||||
accessKeyId: Credentials.AccessKeyId,
|
||||
secretAccessKey: Credentials.SecretAccessKey,
|
||||
sessionToken: Credentials.SessionToken,
|
||||
expiration: Credentials.Expiration,
|
||||
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
if (accountId) {
|
||||
client.setCredentialFeature(credentials, "RESOLVED_ACCOUNT_ID", "T");
|
||||
}
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE_WEB_ID", "k");
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
const isH2 = (requestHandler) => {
|
||||
return requestHandler?.metadata?.handlerProtocol === "h2";
|
||||
};
|
||||
|
||||
const getCustomizableStsClientCtor = (baseCtor, customizations) => {
|
||||
if (!customizations)
|
||||
return baseCtor;
|
||||
else
|
||||
return class CustomizableSTSClient extends baseCtor {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
for (const customization of customizations) {
|
||||
this.middlewareStack.use(customization);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => getDefaultRoleAssumer$1(stsOptions, getCustomizableStsClientCtor(STSClient.STSClient, stsPlugins));
|
||||
const getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => getDefaultRoleAssumerWithWebIdentity$1(stsOptions, getCustomizableStsClientCtor(STSClient.STSClient, stsPlugins));
|
||||
const decorateDefaultCredentialProvider = (provider) => (input) => provider({
|
||||
roleAssumer: getDefaultRoleAssumer(input),
|
||||
roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input),
|
||||
...input,
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "$Command", ({
|
||||
enumerable: true,
|
||||
get: function () { return smithyClient.Command; }
|
||||
}));
|
||||
exports.AssumeRoleCommand = AssumeRoleCommand;
|
||||
exports.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand;
|
||||
exports.ExpiredTokenException = ExpiredTokenException$1;
|
||||
exports.IDPCommunicationErrorException = IDPCommunicationErrorException$1;
|
||||
exports.IDPRejectedClaimException = IDPRejectedClaimException$1;
|
||||
exports.InvalidIdentityTokenException = InvalidIdentityTokenException$1;
|
||||
exports.MalformedPolicyDocumentException = MalformedPolicyDocumentException$1;
|
||||
exports.PackedPolicyTooLargeException = PackedPolicyTooLargeException$1;
|
||||
exports.RegionDisabledException = RegionDisabledException$1;
|
||||
exports.STS = STS;
|
||||
exports.STSServiceException = STSServiceException$1;
|
||||
exports.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider;
|
||||
exports.getDefaultRoleAssumer = getDefaultRoleAssumer;
|
||||
exports.getDefaultRoleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity;
|
||||
Object.keys(STSClient).forEach(function (k) {
|
||||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
||||
enumerable: true,
|
||||
get: function () { return STSClient[k]; }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6578:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const tslib_1 = __webpack_require__(1860);
|
||||
const package_json_1 = tslib_1.__importDefault(__webpack_require__(9955));
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_user_agent_node_1 = __webpack_require__(1656);
|
||||
const config_resolver_1 = __webpack_require__(9316);
|
||||
const core_2 = __webpack_require__(402);
|
||||
const hash_node_1 = __webpack_require__(5092);
|
||||
const middleware_retry_1 = __webpack_require__(9618);
|
||||
const node_config_provider_1 = __webpack_require__(5704);
|
||||
const node_http_handler_1 = __webpack_require__(1279);
|
||||
const util_body_length_node_1 = __webpack_require__(3638);
|
||||
const util_retry_1 = __webpack_require__(5518);
|
||||
const runtimeConfig_shared_1 = __webpack_require__(4443);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const util_defaults_mode_node_1 = __webpack_require__(5435);
|
||||
const smithy_client_2 = __webpack_require__(1411);
|
||||
const getRuntimeConfig = (config) => {
|
||||
(0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
||||
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
||||
(0, core_1.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const loaderConfig = {
|
||||
profile: config?.profile,
|
||||
logger: clientSharedValues.logger,
|
||||
};
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "node",
|
||||
defaultsMode,
|
||||
authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(core_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
(0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
||||
(async (idProps) => await config.credentialDefaultProvider(idProps?.__config || {})()),
|
||||
signer: new core_1.AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new core_2.NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
||||
region: config?.region ??
|
||||
(0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
||||
requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ??
|
||||
(0, node_config_provider_1.loadConfig)({
|
||||
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
||||
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
||||
}, config),
|
||||
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
|
||||
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4443:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const protocols_1 = __webpack_require__(7288);
|
||||
const core_2 = __webpack_require__(402);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const url_parser_1 = __webpack_require__(4494);
|
||||
const util_base64_1 = __webpack_require__(8385);
|
||||
const util_utf8_1 = __webpack_require__(1577);
|
||||
const httpAuthSchemeProvider_1 = __webpack_require__(7851);
|
||||
const endpointResolver_1 = __webpack_require__(9765);
|
||||
const getRuntimeConfig = (config) => {
|
||||
return {
|
||||
apiVersion: "2011-06-15",
|
||||
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
|
||||
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
|
||||
disableHostPrefix: config?.disableHostPrefix ?? false,
|
||||
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
|
||||
extensions: config?.extensions ?? [],
|
||||
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeProvider,
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
||||
signer: new core_1.AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new core_2.NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
|
||||
protocol: config?.protocol ??
|
||||
new protocols_1.AwsQueryProtocol({
|
||||
defaultNamespace: "com.amazonaws.sts",
|
||||
xmlNamespace: "https://sts.amazonaws.com/doc/2011-06-15/",
|
||||
version: "2011-06-15",
|
||||
}),
|
||||
serviceId: config?.serviceId ?? "STS",
|
||||
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
||||
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
|
||||
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7742:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveRuntimeExtensions = void 0;
|
||||
const region_config_resolver_1 = __webpack_require__(6463);
|
||||
const protocol_http_1 = __webpack_require__(2356);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const httpAuthExtensionConfiguration_1 = __webpack_require__(4532);
|
||||
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
||||
const extensionConfiguration = Object.assign((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig), (0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig), (0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig), (0, httpAuthExtensionConfiguration_1.getHttpAuthExtensionConfiguration)(runtimeConfig));
|
||||
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
||||
return Object.assign(runtimeConfig, (0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), (0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), (0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), (0, httpAuthExtensionConfiguration_1.resolveHttpAuthRuntimeConfig)(extensionConfiguration));
|
||||
};
|
||||
exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9955:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","version":"3.933.0","description":"Nested clients for AWS SDK packages.","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"yarn lint && concurrently \'yarn:build:cjs\' \'yarn:build:es\' \'yarn:build:types\'","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","lint":"node ../../scripts/validation/submodules-linter.js --pkg nested-clients","test":"yarn g:vitest run","test:watch":"yarn g:vitest watch"},"engines":{"node":">=18.0.0"},"sideEffects":false,"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.932.0","@aws-sdk/middleware-host-header":"3.930.0","@aws-sdk/middleware-logger":"3.930.0","@aws-sdk/middleware-recursion-detection":"3.933.0","@aws-sdk/middleware-user-agent":"3.932.0","@aws-sdk/region-config-resolver":"3.930.0","@aws-sdk/types":"3.930.0","@aws-sdk/util-endpoints":"3.930.0","@aws-sdk/util-user-agent-browser":"3.930.0","@aws-sdk/util-user-agent-node":"3.932.0","@smithy/config-resolver":"^4.4.3","@smithy/core":"^3.18.2","@smithy/fetch-http-handler":"^5.3.6","@smithy/hash-node":"^4.2.5","@smithy/invalid-dependency":"^4.2.5","@smithy/middleware-content-length":"^4.2.5","@smithy/middleware-endpoint":"^4.3.9","@smithy/middleware-retry":"^4.4.9","@smithy/middleware-serde":"^4.2.5","@smithy/middleware-stack":"^4.2.5","@smithy/node-config-provider":"^4.3.5","@smithy/node-http-handler":"^4.4.5","@smithy/protocol-http":"^5.3.5","@smithy/smithy-client":"^4.9.5","@smithy/types":"^4.9.0","@smithy/url-parser":"^4.2.5","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.8","@smithy/util-defaults-mode-node":"^4.2.11","@smithy/util-endpoints":"^3.2.5","@smithy/util-middleware":"^4.2.5","@smithy/util-retry":"^4.2.5","@smithy/util-utf8":"^4.2.0","tslib":"^2.6.2"},"devDependencies":{"concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.8.3"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["./sso-oidc.d.ts","./sso-oidc.js","./sts.d.ts","./sts.js","dist-*/**"],"browser":{"./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"packages/nested-clients"},"exports":{"./sso-oidc":{"types":"./dist-types/submodules/sso-oidc/index.d.ts","module":"./dist-es/submodules/sso-oidc/index.js","node":"./dist-cjs/submodules/sso-oidc/index.js","import":"./dist-es/submodules/sso-oidc/index.js","require":"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{"types":"./dist-types/submodules/sts/index.d.ts","module":"./dist-es/submodules/sts/index.js","node":"./dist-cjs/submodules/sts/index.js","import":"./dist-es/submodules/sts/index.js","require":"./dist-cjs/submodules/sts/index.js"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
exports.id = 360;
|
||||
exports.ids = [360];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 5360:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var sharedIniFileLoader = __webpack_require__(4964);
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
var child_process = __webpack_require__(5317);
|
||||
var util = __webpack_require__(9023);
|
||||
var client = __webpack_require__(5152);
|
||||
|
||||
const getValidatedProcessCredentials = (profileName, data, profiles) => {
|
||||
if (data.Version !== 1) {
|
||||
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
|
||||
}
|
||||
if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {
|
||||
throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);
|
||||
}
|
||||
if (data.Expiration) {
|
||||
const currentTime = new Date();
|
||||
const expireTime = new Date(data.Expiration);
|
||||
if (expireTime < currentTime) {
|
||||
throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
|
||||
}
|
||||
}
|
||||
let accountId = data.AccountId;
|
||||
if (!accountId && profiles?.[profileName]?.aws_account_id) {
|
||||
accountId = profiles[profileName].aws_account_id;
|
||||
}
|
||||
const credentials = {
|
||||
accessKeyId: data.AccessKeyId,
|
||||
secretAccessKey: data.SecretAccessKey,
|
||||
...(data.SessionToken && { sessionToken: data.SessionToken }),
|
||||
...(data.Expiration && { expiration: new Date(data.Expiration) }),
|
||||
...(data.CredentialScope && { credentialScope: data.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
client.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
|
||||
return credentials;
|
||||
};
|
||||
|
||||
const resolveProcessCredentials = async (profileName, profiles, logger) => {
|
||||
const profile = profiles[profileName];
|
||||
if (profiles[profileName]) {
|
||||
const credentialProcess = profile["credential_process"];
|
||||
if (credentialProcess !== undefined) {
|
||||
const execPromise = util.promisify(sharedIniFileLoader.externalDataInterceptor?.getTokenRecord?.().exec ?? child_process.exec);
|
||||
try {
|
||||
const { stdout } = await execPromise(credentialProcess);
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(stdout.trim());
|
||||
}
|
||||
catch {
|
||||
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
||||
}
|
||||
return getValidatedProcessCredentials(profileName, data, profiles);
|
||||
}
|
||||
catch (error) {
|
||||
throw new propertyProvider.CredentialsProviderError(error.message, { logger });
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
|
||||
logger,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
|
||||
init.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");
|
||||
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
||||
return resolveProcessCredentials(sharedIniFileLoader.getProfileName({
|
||||
profile: init.profile ?? callerClientConfig?.profile,
|
||||
}), profiles, init.logger);
|
||||
};
|
||||
|
||||
exports.fromProcess = fromProcess;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+794
@@ -0,0 +1,794 @@
|
||||
"use strict";
|
||||
exports.id = 443;
|
||||
exports.ids = [443];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 8396:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.resolveHttpAuthSchemeConfig = exports.defaultSSOOIDCHttpAuthSchemeProvider = exports.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_middleware_1 = __webpack_require__(6324);
|
||||
const defaultSSOOIDCHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
|
||||
region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
|
||||
(() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
exports.defaultSSOOIDCHttpAuthSchemeParametersProvider = defaultSSOOIDCHttpAuthSchemeParametersProvider;
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "sso-oauth",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "smithy.api#noAuth",
|
||||
};
|
||||
}
|
||||
const defaultSSOOIDCHttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
case "CreateToken": {
|
||||
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
exports.defaultSSOOIDCHttpAuthSchemeProvider = defaultSSOOIDCHttpAuthSchemeProvider;
|
||||
const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config);
|
||||
return Object.assign(config_0, {
|
||||
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 546:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.defaultEndpointResolver = void 0;
|
||||
const util_endpoints_1 = __webpack_require__(3068);
|
||||
const util_endpoints_2 = __webpack_require__(9674);
|
||||
const ruleset_1 = __webpack_require__(9947);
|
||||
const cache = new util_endpoints_2.EndpointCache({
|
||||
size: 50,
|
||||
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
|
||||
});
|
||||
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
||||
return cache.get(endpointParams, () => (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, {
|
||||
endpointParams: endpointParams,
|
||||
logger: context.logger,
|
||||
}));
|
||||
};
|
||||
exports.defaultEndpointResolver = defaultEndpointResolver;
|
||||
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9947:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.ruleSet = void 0;
|
||||
const u = "required", v = "fn", w = "argv", x = "ref";
|
||||
const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "string" }, j = { [u]: true, "default": false, "type": "boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
|
||||
const _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] };
|
||||
exports.ruleSet = _data;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9443:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
|
||||
var middlewareHostHeader = __webpack_require__(2590);
|
||||
var middlewareLogger = __webpack_require__(5242);
|
||||
var middlewareRecursionDetection = __webpack_require__(1568);
|
||||
var middlewareUserAgent = __webpack_require__(2959);
|
||||
var configResolver = __webpack_require__(9316);
|
||||
var core = __webpack_require__(402);
|
||||
var schema = __webpack_require__(6890);
|
||||
var middlewareContentLength = __webpack_require__(7212);
|
||||
var middlewareEndpoint = __webpack_require__(99);
|
||||
var middlewareRetry = __webpack_require__(9618);
|
||||
var smithyClient = __webpack_require__(1411);
|
||||
var httpAuthSchemeProvider = __webpack_require__(8396);
|
||||
var runtimeConfig = __webpack_require__(6901);
|
||||
var regionConfigResolver = __webpack_require__(6463);
|
||||
var protocolHttp = __webpack_require__(2356);
|
||||
|
||||
const resolveClientEndpointParameters = (options) => {
|
||||
return Object.assign(options, {
|
||||
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
||||
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
||||
defaultSigningName: "sso-oauth",
|
||||
});
|
||||
};
|
||||
const commonParams = {
|
||||
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
||||
Endpoint: { type: "builtInParams", name: "endpoint" },
|
||||
Region: { type: "builtInParams", name: "region" },
|
||||
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
||||
};
|
||||
|
||||
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
|
||||
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
||||
const extensionConfiguration = Object.assign(regionConfigResolver.getAwsRegionExtensionConfiguration(runtimeConfig), smithyClient.getDefaultExtensionConfiguration(runtimeConfig), protocolHttp.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
|
||||
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
||||
return Object.assign(runtimeConfig, regionConfigResolver.resolveAwsRegionExtensionConfiguration(extensionConfiguration), smithyClient.resolveDefaultRuntimeConfig(extensionConfiguration), protocolHttp.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
|
||||
};
|
||||
|
||||
class SSOOIDCClient extends smithyClient.Client {
|
||||
config;
|
||||
constructor(...[configuration]) {
|
||||
const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {});
|
||||
super(_config_0);
|
||||
this.initConfig = _config_0;
|
||||
const _config_1 = resolveClientEndpointParameters(_config_0);
|
||||
const _config_2 = middlewareUserAgent.resolveUserAgentConfig(_config_1);
|
||||
const _config_3 = middlewareRetry.resolveRetryConfig(_config_2);
|
||||
const _config_4 = configResolver.resolveRegionConfig(_config_3);
|
||||
const _config_5 = middlewareHostHeader.resolveHostHeaderConfig(_config_4);
|
||||
const _config_6 = middlewareEndpoint.resolveEndpointConfig(_config_5);
|
||||
const _config_7 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_6);
|
||||
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
||||
this.config = _config_8;
|
||||
this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));
|
||||
this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareHostHeader.getHostHeaderPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareLogger.getLoggerPlugin(this.config));
|
||||
this.middlewareStack.use(middlewareRecursionDetection.getRecursionDetectionPlugin(this.config));
|
||||
this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
||||
httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultSSOOIDCHttpAuthSchemeParametersProvider,
|
||||
identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({
|
||||
"aws.auth#sigv4": config.credentials,
|
||||
}),
|
||||
}));
|
||||
this.middlewareStack.use(core.getHttpSigningPlugin(this.config));
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
let SSOOIDCServiceException$1 = class SSOOIDCServiceException extends smithyClient.ServiceException {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
Object.setPrototypeOf(this, SSOOIDCServiceException.prototype);
|
||||
}
|
||||
};
|
||||
|
||||
const AccessDeniedExceptionReason = {
|
||||
KMS_ACCESS_DENIED: "KMS_AccessDeniedException",
|
||||
};
|
||||
let AccessDeniedException$1 = class AccessDeniedException extends SSOOIDCServiceException$1 {
|
||||
name = "AccessDeniedException";
|
||||
$fault = "client";
|
||||
error;
|
||||
reason;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "AccessDeniedException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
||||
this.error = opts.error;
|
||||
this.reason = opts.reason;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let AuthorizationPendingException$1 = class AuthorizationPendingException extends SSOOIDCServiceException$1 {
|
||||
name = "AuthorizationPendingException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "AuthorizationPendingException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, AuthorizationPendingException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let ExpiredTokenException$1 = class ExpiredTokenException extends SSOOIDCServiceException$1 {
|
||||
name = "ExpiredTokenException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "ExpiredTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InternalServerException$1 = class InternalServerException extends SSOOIDCServiceException$1 {
|
||||
name = "InternalServerException";
|
||||
$fault = "server";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InternalServerException",
|
||||
$fault: "server",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InternalServerException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InvalidClientException$1 = class InvalidClientException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidClientException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidClientException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidClientException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InvalidGrantException$1 = class InvalidGrantException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidGrantException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidGrantException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidGrantException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
const InvalidRequestExceptionReason = {
|
||||
KMS_DISABLED_KEY: "KMS_DisabledException",
|
||||
KMS_INVALID_KEY_USAGE: "KMS_InvalidKeyUsageException",
|
||||
KMS_INVALID_STATE: "KMS_InvalidStateException",
|
||||
KMS_KEY_NOT_FOUND: "KMS_NotFoundException",
|
||||
};
|
||||
let InvalidRequestException$1 = class InvalidRequestException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidRequestException";
|
||||
$fault = "client";
|
||||
error;
|
||||
reason;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidRequestException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidRequestException.prototype);
|
||||
this.error = opts.error;
|
||||
this.reason = opts.reason;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let InvalidScopeException$1 = class InvalidScopeException extends SSOOIDCServiceException$1 {
|
||||
name = "InvalidScopeException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidScopeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidScopeException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let SlowDownException$1 = class SlowDownException extends SSOOIDCServiceException$1 {
|
||||
name = "SlowDownException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "SlowDownException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, SlowDownException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let UnauthorizedClientException$1 = class UnauthorizedClientException extends SSOOIDCServiceException$1 {
|
||||
name = "UnauthorizedClientException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "UnauthorizedClientException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, UnauthorizedClientException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
let UnsupportedGrantTypeException$1 = class UnsupportedGrantTypeException extends SSOOIDCServiceException$1 {
|
||||
name = "UnsupportedGrantTypeException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "UnsupportedGrantTypeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, UnsupportedGrantTypeException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
};
|
||||
|
||||
const _ADE = "AccessDeniedException";
|
||||
const _APE = "AuthorizationPendingException";
|
||||
const _AT = "AccessToken";
|
||||
const _CS = "ClientSecret";
|
||||
const _CT = "CreateToken";
|
||||
const _CTR = "CreateTokenRequest";
|
||||
const _CTRr = "CreateTokenResponse";
|
||||
const _CV = "CodeVerifier";
|
||||
const _ETE = "ExpiredTokenException";
|
||||
const _ICE = "InvalidClientException";
|
||||
const _IGE = "InvalidGrantException";
|
||||
const _IRE = "InvalidRequestException";
|
||||
const _ISE = "InternalServerException";
|
||||
const _ISEn = "InvalidScopeException";
|
||||
const _IT = "IdToken";
|
||||
const _RT = "RefreshToken";
|
||||
const _SDE = "SlowDownException";
|
||||
const _UCE = "UnauthorizedClientException";
|
||||
const _UGTE = "UnsupportedGrantTypeException";
|
||||
const _aT = "accessToken";
|
||||
const _c = "client";
|
||||
const _cI = "clientId";
|
||||
const _cS = "clientSecret";
|
||||
const _cV = "codeVerifier";
|
||||
const _co = "code";
|
||||
const _dC = "deviceCode";
|
||||
const _e = "error";
|
||||
const _eI = "expiresIn";
|
||||
const _ed = "error_description";
|
||||
const _gT = "grantType";
|
||||
const _h = "http";
|
||||
const _hE = "httpError";
|
||||
const _iT = "idToken";
|
||||
const _r = "reason";
|
||||
const _rT = "refreshToken";
|
||||
const _rU = "redirectUri";
|
||||
const _s = "scope";
|
||||
const _se = "server";
|
||||
const _sm = "smithy.ts.sdk.synthetic.com.amazonaws.ssooidc";
|
||||
const _tT = "tokenType";
|
||||
const n0 = "com.amazonaws.ssooidc";
|
||||
var AccessToken = [0, n0, _AT, 8, 0];
|
||||
var ClientSecret = [0, n0, _CS, 8, 0];
|
||||
var CodeVerifier = [0, n0, _CV, 8, 0];
|
||||
var IdToken = [0, n0, _IT, 8, 0];
|
||||
var RefreshToken = [0, n0, _RT, 8, 0];
|
||||
var AccessDeniedException = [
|
||||
-3,
|
||||
n0,
|
||||
_ADE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _r, _ed],
|
||||
[0, 0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(AccessDeniedException, AccessDeniedException$1);
|
||||
var AuthorizationPendingException = [
|
||||
-3,
|
||||
n0,
|
||||
_APE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(AuthorizationPendingException, AuthorizationPendingException$1);
|
||||
var CreateTokenRequest = [
|
||||
3,
|
||||
n0,
|
||||
_CTR,
|
||||
0,
|
||||
[_cI, _cS, _gT, _dC, _co, _rT, _s, _rU, _cV],
|
||||
[0, [() => ClientSecret, 0], 0, 0, 0, [() => RefreshToken, 0], 64 | 0, 0, [() => CodeVerifier, 0]],
|
||||
];
|
||||
var CreateTokenResponse = [
|
||||
3,
|
||||
n0,
|
||||
_CTRr,
|
||||
0,
|
||||
[_aT, _tT, _eI, _rT, _iT],
|
||||
[[() => AccessToken, 0], 0, 1, [() => RefreshToken, 0], [() => IdToken, 0]],
|
||||
];
|
||||
var ExpiredTokenException = [
|
||||
-3,
|
||||
n0,
|
||||
_ETE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(ExpiredTokenException, ExpiredTokenException$1);
|
||||
var InternalServerException = [
|
||||
-3,
|
||||
n0,
|
||||
_ISE,
|
||||
{
|
||||
[_e]: _se,
|
||||
[_hE]: 500,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InternalServerException, InternalServerException$1);
|
||||
var InvalidClientException = [
|
||||
-3,
|
||||
n0,
|
||||
_ICE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 401,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidClientException, InvalidClientException$1);
|
||||
var InvalidGrantException = [
|
||||
-3,
|
||||
n0,
|
||||
_IGE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidGrantException, InvalidGrantException$1);
|
||||
var InvalidRequestException = [
|
||||
-3,
|
||||
n0,
|
||||
_IRE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _r, _ed],
|
||||
[0, 0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidRequestException, InvalidRequestException$1);
|
||||
var InvalidScopeException = [
|
||||
-3,
|
||||
n0,
|
||||
_ISEn,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(InvalidScopeException, InvalidScopeException$1);
|
||||
var SlowDownException = [
|
||||
-3,
|
||||
n0,
|
||||
_SDE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(SlowDownException, SlowDownException$1);
|
||||
var UnauthorizedClientException = [
|
||||
-3,
|
||||
n0,
|
||||
_UCE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(UnauthorizedClientException, UnauthorizedClientException$1);
|
||||
var UnsupportedGrantTypeException = [
|
||||
-3,
|
||||
n0,
|
||||
_UGTE,
|
||||
{
|
||||
[_e]: _c,
|
||||
[_hE]: 400,
|
||||
},
|
||||
[_e, _ed],
|
||||
[0, 0],
|
||||
];
|
||||
schema.TypeRegistry.for(n0).registerError(UnsupportedGrantTypeException, UnsupportedGrantTypeException$1);
|
||||
var SSOOIDCServiceException = [-3, _sm, "SSOOIDCServiceException", 0, [], []];
|
||||
schema.TypeRegistry.for(_sm).registerError(SSOOIDCServiceException, SSOOIDCServiceException$1);
|
||||
var CreateToken = [
|
||||
9,
|
||||
n0,
|
||||
_CT,
|
||||
{
|
||||
[_h]: ["POST", "/token", 200],
|
||||
},
|
||||
() => CreateTokenRequest,
|
||||
() => CreateTokenResponse,
|
||||
];
|
||||
|
||||
class CreateTokenCommand extends smithyClient.Command
|
||||
.classBuilder()
|
||||
.ep(commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
||||
})
|
||||
.s("AWSSSOOIDCService", "CreateToken", {})
|
||||
.n("SSOOIDCClient", "CreateTokenCommand")
|
||||
.sc(CreateToken)
|
||||
.build() {
|
||||
}
|
||||
|
||||
const commands = {
|
||||
CreateTokenCommand,
|
||||
};
|
||||
class SSOOIDC extends SSOOIDCClient {
|
||||
}
|
||||
smithyClient.createAggregatedClient(commands, SSOOIDC);
|
||||
|
||||
__webpack_unused_export__ = ({
|
||||
enumerable: true,
|
||||
get: function () { return smithyClient.Command; }
|
||||
});
|
||||
__webpack_unused_export__ = ({
|
||||
enumerable: true,
|
||||
get: function () { return smithyClient.Client; }
|
||||
});
|
||||
__webpack_unused_export__ = AccessDeniedException$1;
|
||||
__webpack_unused_export__ = AccessDeniedExceptionReason;
|
||||
__webpack_unused_export__ = AuthorizationPendingException$1;
|
||||
exports.CreateTokenCommand = CreateTokenCommand;
|
||||
__webpack_unused_export__ = ExpiredTokenException$1;
|
||||
__webpack_unused_export__ = InternalServerException$1;
|
||||
__webpack_unused_export__ = InvalidClientException$1;
|
||||
__webpack_unused_export__ = InvalidGrantException$1;
|
||||
__webpack_unused_export__ = InvalidRequestException$1;
|
||||
__webpack_unused_export__ = InvalidRequestExceptionReason;
|
||||
__webpack_unused_export__ = InvalidScopeException$1;
|
||||
__webpack_unused_export__ = SSOOIDC;
|
||||
exports.SSOOIDCClient = SSOOIDCClient;
|
||||
__webpack_unused_export__ = SSOOIDCServiceException$1;
|
||||
__webpack_unused_export__ = SlowDownException$1;
|
||||
__webpack_unused_export__ = UnauthorizedClientException$1;
|
||||
__webpack_unused_export__ = UnsupportedGrantTypeException$1;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6901:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const tslib_1 = __webpack_require__(1860);
|
||||
const package_json_1 = tslib_1.__importDefault(__webpack_require__(9955));
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const util_user_agent_node_1 = __webpack_require__(1656);
|
||||
const config_resolver_1 = __webpack_require__(9316);
|
||||
const hash_node_1 = __webpack_require__(5092);
|
||||
const middleware_retry_1 = __webpack_require__(9618);
|
||||
const node_config_provider_1 = __webpack_require__(5704);
|
||||
const node_http_handler_1 = __webpack_require__(1279);
|
||||
const util_body_length_node_1 = __webpack_require__(3638);
|
||||
const util_retry_1 = __webpack_require__(5518);
|
||||
const runtimeConfig_shared_1 = __webpack_require__(1546);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const util_defaults_mode_node_1 = __webpack_require__(5435);
|
||||
const smithy_client_2 = __webpack_require__(1411);
|
||||
const getRuntimeConfig = (config) => {
|
||||
(0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
||||
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
||||
(0, core_1.emitWarningIfUnsupportedVersion)(process.version);
|
||||
const loaderConfig = {
|
||||
profile: config?.profile,
|
||||
logger: clientSharedValues.logger,
|
||||
};
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "node",
|
||||
defaultsMode,
|
||||
authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(core_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
(0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
||||
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
||||
region: config?.region ??
|
||||
(0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
||||
requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ??
|
||||
(0, node_config_provider_1.loadConfig)({
|
||||
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
||||
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
||||
}, config),
|
||||
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
|
||||
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1546:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getRuntimeConfig = void 0;
|
||||
const core_1 = __webpack_require__(8704);
|
||||
const protocols_1 = __webpack_require__(7288);
|
||||
const core_2 = __webpack_require__(402);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const url_parser_1 = __webpack_require__(4494);
|
||||
const util_base64_1 = __webpack_require__(8385);
|
||||
const util_utf8_1 = __webpack_require__(1577);
|
||||
const httpAuthSchemeProvider_1 = __webpack_require__(8396);
|
||||
const endpointResolver_1 = __webpack_require__(546);
|
||||
const getRuntimeConfig = (config) => {
|
||||
return {
|
||||
apiVersion: "2019-06-10",
|
||||
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
|
||||
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
|
||||
disableHostPrefix: config?.disableHostPrefix ?? false,
|
||||
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
|
||||
extensions: config?.extensions ?? [],
|
||||
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSSOOIDCHttpAuthSchemeProvider,
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
||||
signer: new core_1.AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new core_2.NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
|
||||
protocol: config?.protocol ?? new protocols_1.AwsRestJsonProtocol({ defaultNamespace: "com.amazonaws.ssooidc" }),
|
||||
serviceId: config?.serviceId ?? "SSO OIDC",
|
||||
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
||||
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
|
||||
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
|
||||
};
|
||||
};
|
||||
exports.getRuntimeConfig = getRuntimeConfig;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9955:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","version":"3.933.0","description":"Nested clients for AWS SDK packages.","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"yarn lint && concurrently \'yarn:build:cjs\' \'yarn:build:es\' \'yarn:build:types\'","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","lint":"node ../../scripts/validation/submodules-linter.js --pkg nested-clients","test":"yarn g:vitest run","test:watch":"yarn g:vitest watch"},"engines":{"node":">=18.0.0"},"sideEffects":false,"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.932.0","@aws-sdk/middleware-host-header":"3.930.0","@aws-sdk/middleware-logger":"3.930.0","@aws-sdk/middleware-recursion-detection":"3.933.0","@aws-sdk/middleware-user-agent":"3.932.0","@aws-sdk/region-config-resolver":"3.930.0","@aws-sdk/types":"3.930.0","@aws-sdk/util-endpoints":"3.930.0","@aws-sdk/util-user-agent-browser":"3.930.0","@aws-sdk/util-user-agent-node":"3.932.0","@smithy/config-resolver":"^4.4.3","@smithy/core":"^3.18.2","@smithy/fetch-http-handler":"^5.3.6","@smithy/hash-node":"^4.2.5","@smithy/invalid-dependency":"^4.2.5","@smithy/middleware-content-length":"^4.2.5","@smithy/middleware-endpoint":"^4.3.9","@smithy/middleware-retry":"^4.4.9","@smithy/middleware-serde":"^4.2.5","@smithy/middleware-stack":"^4.2.5","@smithy/node-config-provider":"^4.3.5","@smithy/node-http-handler":"^4.4.5","@smithy/protocol-http":"^5.3.5","@smithy/smithy-client":"^4.9.5","@smithy/types":"^4.9.0","@smithy/url-parser":"^4.2.5","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.8","@smithy/util-defaults-mode-node":"^4.2.11","@smithy/util-endpoints":"^3.2.5","@smithy/util-middleware":"^4.2.5","@smithy/util-retry":"^4.2.5","@smithy/util-utf8":"^4.2.0","tslib":"^2.6.2"},"devDependencies":{"concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.8.3"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["./sso-oidc.d.ts","./sso-oidc.js","./sts.d.ts","./sts.js","dist-*/**"],"browser":{"./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"packages/nested-clients"},"exports":{"./sso-oidc":{"types":"./dist-types/submodules/sso-oidc/index.d.ts","module":"./dist-es/submodules/sso-oidc/index.js","node":"./dist-cjs/submodules/sso-oidc/index.js","import":"./dist-es/submodules/sso-oidc/index.js","require":"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{"types":"./dist-types/submodules/sts/index.d.ts","module":"./dist-es/submodules/sts/index.js","node":"./dist-cjs/submodules/sts/index.js","import":"./dist-es/submodules/sts/index.js","require":"./dist-cjs/submodules/sts/index.js"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+387
@@ -0,0 +1,387 @@
|
||||
"use strict";
|
||||
exports.id = 566;
|
||||
exports.ids = [566];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 566:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
var url = __webpack_require__(7016);
|
||||
var buffer = __webpack_require__(181);
|
||||
var http = __webpack_require__(8611);
|
||||
var nodeConfigProvider = __webpack_require__(5704);
|
||||
var urlParser = __webpack_require__(4494);
|
||||
|
||||
function httpRequest(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = http.request({
|
||||
method: "GET",
|
||||
...options,
|
||||
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1"),
|
||||
});
|
||||
req.on("error", (err) => {
|
||||
reject(Object.assign(new propertyProvider.ProviderError("Unable to connect to instance metadata service"), err));
|
||||
req.destroy();
|
||||
});
|
||||
req.on("timeout", () => {
|
||||
reject(new propertyProvider.ProviderError("TimeoutError from instance metadata service"));
|
||||
req.destroy();
|
||||
});
|
||||
req.on("response", (res) => {
|
||||
const { statusCode = 400 } = res;
|
||||
if (statusCode < 200 || 300 <= statusCode) {
|
||||
reject(Object.assign(new propertyProvider.ProviderError("Error response received from instance metadata service"), { statusCode }));
|
||||
req.destroy();
|
||||
}
|
||||
const chunks = [];
|
||||
res.on("data", (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
res.on("end", () => {
|
||||
resolve(buffer.Buffer.concat(chunks));
|
||||
req.destroy();
|
||||
});
|
||||
});
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
|
||||
const isImdsCredentials = (arg) => Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.AccessKeyId === "string" &&
|
||||
typeof arg.SecretAccessKey === "string" &&
|
||||
typeof arg.Token === "string" &&
|
||||
typeof arg.Expiration === "string";
|
||||
const fromImdsCredentials = (creds) => ({
|
||||
accessKeyId: creds.AccessKeyId,
|
||||
secretAccessKey: creds.SecretAccessKey,
|
||||
sessionToken: creds.Token,
|
||||
expiration: new Date(creds.Expiration),
|
||||
...(creds.AccountId && { accountId: creds.AccountId }),
|
||||
});
|
||||
|
||||
const DEFAULT_TIMEOUT = 1000;
|
||||
const DEFAULT_MAX_RETRIES = 0;
|
||||
const providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT, }) => ({ maxRetries, timeout });
|
||||
|
||||
const retry = (toRetry, maxRetries) => {
|
||||
let promise = toRetry();
|
||||
for (let i = 0; i < maxRetries; i++) {
|
||||
promise = promise.catch(toRetry);
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
|
||||
const ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
||||
const ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
||||
const ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
||||
const fromContainerMetadata = (init = {}) => {
|
||||
const { timeout, maxRetries } = providerConfigFromInit(init);
|
||||
return () => retry(async () => {
|
||||
const requestOptions = await getCmdsUri({ logger: init.logger });
|
||||
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
||||
if (!isImdsCredentials(credsResponse)) {
|
||||
throw new propertyProvider.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
||||
logger: init.logger,
|
||||
});
|
||||
}
|
||||
return fromImdsCredentials(credsResponse);
|
||||
}, maxRetries);
|
||||
};
|
||||
const requestFromEcsImds = async (timeout, options) => {
|
||||
if (process.env[ENV_CMDS_AUTH_TOKEN]) {
|
||||
options.headers = {
|
||||
...options.headers,
|
||||
Authorization: process.env[ENV_CMDS_AUTH_TOKEN],
|
||||
};
|
||||
}
|
||||
const buffer = await httpRequest({
|
||||
...options,
|
||||
timeout,
|
||||
});
|
||||
return buffer.toString();
|
||||
};
|
||||
const CMDS_IP = "169.254.170.2";
|
||||
const GREENGRASS_HOSTS = {
|
||||
localhost: true,
|
||||
"127.0.0.1": true,
|
||||
};
|
||||
const GREENGRASS_PROTOCOLS = {
|
||||
"http:": true,
|
||||
"https:": true,
|
||||
};
|
||||
const getCmdsUri = async ({ logger }) => {
|
||||
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
||||
return {
|
||||
hostname: CMDS_IP,
|
||||
path: process.env[ENV_CMDS_RELATIVE_URI],
|
||||
};
|
||||
}
|
||||
if (process.env[ENV_CMDS_FULL_URI]) {
|
||||
const parsed = url.parse(process.env[ENV_CMDS_FULL_URI]);
|
||||
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
||||
throw new propertyProvider.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
||||
tryNextLink: false,
|
||||
logger,
|
||||
});
|
||||
}
|
||||
if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
|
||||
throw new propertyProvider.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
||||
tryNextLink: false,
|
||||
logger,
|
||||
});
|
||||
}
|
||||
return {
|
||||
...parsed,
|
||||
port: parsed.port ? parseInt(parsed.port, 10) : undefined,
|
||||
};
|
||||
}
|
||||
throw new propertyProvider.CredentialsProviderError("The container metadata credential provider cannot be used unless" +
|
||||
` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` +
|
||||
" variable is set", {
|
||||
tryNextLink: false,
|
||||
logger,
|
||||
});
|
||||
};
|
||||
|
||||
class InstanceMetadataV1FallbackError extends propertyProvider.CredentialsProviderError {
|
||||
tryNextLink;
|
||||
name = "InstanceMetadataV1FallbackError";
|
||||
constructor(message, tryNextLink = true) {
|
||||
super(message, tryNextLink);
|
||||
this.tryNextLink = tryNextLink;
|
||||
Object.setPrototypeOf(this, InstanceMetadataV1FallbackError.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
exports.yI = void 0;
|
||||
(function (Endpoint) {
|
||||
Endpoint["IPv4"] = "http://169.254.169.254";
|
||||
Endpoint["IPv6"] = "http://[fd00:ec2::254]";
|
||||
})(exports.yI || (exports.yI = {}));
|
||||
|
||||
const ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
||||
const CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
||||
const ENDPOINT_CONFIG_OPTIONS = {
|
||||
environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],
|
||||
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
|
||||
default: undefined,
|
||||
};
|
||||
|
||||
var EndpointMode;
|
||||
(function (EndpointMode) {
|
||||
EndpointMode["IPv4"] = "IPv4";
|
||||
EndpointMode["IPv6"] = "IPv6";
|
||||
})(EndpointMode || (EndpointMode = {}));
|
||||
|
||||
const ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
|
||||
const CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
|
||||
const ENDPOINT_MODE_CONFIG_OPTIONS = {
|
||||
environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],
|
||||
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
|
||||
default: EndpointMode.IPv4,
|
||||
};
|
||||
|
||||
const getInstanceMetadataEndpoint = async () => urlParser.parseUrl((await getFromEndpointConfig()) || (await getFromEndpointModeConfig()));
|
||||
const getFromEndpointConfig = async () => nodeConfigProvider.loadConfig(ENDPOINT_CONFIG_OPTIONS)();
|
||||
const getFromEndpointModeConfig = async () => {
|
||||
const endpointMode = await nodeConfigProvider.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
||||
switch (endpointMode) {
|
||||
case EndpointMode.IPv4:
|
||||
return exports.yI.IPv4;
|
||||
case EndpointMode.IPv6:
|
||||
return exports.yI.IPv6;
|
||||
default:
|
||||
throw new Error(`Unsupported endpoint mode: ${endpointMode}.` + ` Select from ${Object.values(EndpointMode)}`);
|
||||
}
|
||||
};
|
||||
|
||||
const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
||||
const STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
||||
const STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
||||
const getExtendedInstanceMetadataCredentials = (credentials, logger) => {
|
||||
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS +
|
||||
Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
||||
const newExpiration = new Date(Date.now() + refreshInterval * 1000);
|
||||
logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these " +
|
||||
`credentials will be attempted after ${new Date(newExpiration)}.\nFor more information, please visit: ` +
|
||||
STATIC_STABILITY_DOC_URL);
|
||||
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
||||
return {
|
||||
...credentials,
|
||||
...(originalExpiration ? { originalExpiration } : {}),
|
||||
expiration: newExpiration,
|
||||
};
|
||||
};
|
||||
|
||||
const staticStabilityProvider = (provider, options = {}) => {
|
||||
const logger = options?.logger || console;
|
||||
let pastCredentials;
|
||||
return async () => {
|
||||
let credentials;
|
||||
try {
|
||||
credentials = await provider();
|
||||
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
||||
credentials = getExtendedInstanceMetadataCredentials(credentials, logger);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (pastCredentials) {
|
||||
logger.warn("Credential renew failed: ", e);
|
||||
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
pastCredentials = credentials;
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
|
||||
const IMDS_PATH = "/latest/meta-data/iam/security-credentials/";
|
||||
const IMDS_TOKEN_PATH = "/latest/api/token";
|
||||
const AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED";
|
||||
const PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled";
|
||||
const X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
|
||||
const fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger });
|
||||
const getInstanceMetadataProvider = (init = {}) => {
|
||||
let disableFetchToken = false;
|
||||
const { logger, profile } = init;
|
||||
const { timeout, maxRetries } = providerConfigFromInit(init);
|
||||
const getCredentials = async (maxRetries, options) => {
|
||||
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
||||
if (isImdsV1Fallback) {
|
||||
let fallbackBlockedFromProfile = false;
|
||||
let fallbackBlockedFromProcessEnv = false;
|
||||
const configValue = await nodeConfigProvider.loadConfig({
|
||||
environmentVariableSelector: (env) => {
|
||||
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
||||
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
||||
if (envValue === undefined) {
|
||||
throw new propertyProvider.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
||||
}
|
||||
return fallbackBlockedFromProcessEnv;
|
||||
},
|
||||
configFileSelector: (profile) => {
|
||||
const profileValue = profile[PROFILE_AWS_EC2_METADATA_V1_DISABLED];
|
||||
fallbackBlockedFromProfile = !!profileValue && profileValue !== "false";
|
||||
return fallbackBlockedFromProfile;
|
||||
},
|
||||
default: false,
|
||||
}, {
|
||||
profile,
|
||||
})();
|
||||
if (init.ec2MetadataV1Disabled || configValue) {
|
||||
const causes = [];
|
||||
if (init.ec2MetadataV1Disabled)
|
||||
causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");
|
||||
if (fallbackBlockedFromProfile)
|
||||
causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);
|
||||
if (fallbackBlockedFromProcessEnv)
|
||||
causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);
|
||||
throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(", ")}].`);
|
||||
}
|
||||
}
|
||||
const imdsProfile = (await retry(async () => {
|
||||
let profile;
|
||||
try {
|
||||
profile = await getProfile(options);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.statusCode === 401) {
|
||||
disableFetchToken = false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return profile;
|
||||
}, maxRetries)).trim();
|
||||
return retry(async () => {
|
||||
let creds;
|
||||
try {
|
||||
creds = await getCredentialsFromProfile(imdsProfile, options, init);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.statusCode === 401) {
|
||||
disableFetchToken = false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return creds;
|
||||
}, maxRetries);
|
||||
};
|
||||
return async () => {
|
||||
const endpoint = await getInstanceMetadataEndpoint();
|
||||
if (disableFetchToken) {
|
||||
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
||||
return getCredentials(maxRetries, { ...endpoint, timeout });
|
||||
}
|
||||
else {
|
||||
let token;
|
||||
try {
|
||||
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
||||
}
|
||||
catch (error) {
|
||||
if (error?.statusCode === 400) {
|
||||
throw Object.assign(error, {
|
||||
message: "EC2 Metadata token request returned error",
|
||||
});
|
||||
}
|
||||
else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
||||
disableFetchToken = true;
|
||||
}
|
||||
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
||||
return getCredentials(maxRetries, { ...endpoint, timeout });
|
||||
}
|
||||
return getCredentials(maxRetries, {
|
||||
...endpoint,
|
||||
headers: {
|
||||
[X_AWS_EC2_METADATA_TOKEN]: token,
|
||||
},
|
||||
timeout,
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
const getMetadataToken = async (options) => httpRequest({
|
||||
...options,
|
||||
path: IMDS_TOKEN_PATH,
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"x-aws-ec2-metadata-token-ttl-seconds": "21600",
|
||||
},
|
||||
});
|
||||
const getProfile = async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString();
|
||||
const getCredentialsFromProfile = async (profile, options, init) => {
|
||||
const credentialsResponse = JSON.parse((await httpRequest({
|
||||
...options,
|
||||
path: IMDS_PATH + profile,
|
||||
})).toString());
|
||||
if (!isImdsCredentials(credentialsResponse)) {
|
||||
throw new propertyProvider.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
||||
logger: init.logger,
|
||||
});
|
||||
}
|
||||
return fromImdsCredentials(credentialsResponse);
|
||||
};
|
||||
|
||||
__webpack_unused_export__ = DEFAULT_MAX_RETRIES;
|
||||
__webpack_unused_export__ = DEFAULT_TIMEOUT;
|
||||
__webpack_unused_export__ = ENV_CMDS_AUTH_TOKEN;
|
||||
exports.ENV_CMDS_FULL_URI = ENV_CMDS_FULL_URI;
|
||||
exports.ENV_CMDS_RELATIVE_URI = ENV_CMDS_RELATIVE_URI;
|
||||
exports.fromContainerMetadata = fromContainerMetadata;
|
||||
exports.fromInstanceMetadata = fromInstanceMetadata;
|
||||
exports.getInstanceMetadataEndpoint = getInstanceMetadataEndpoint;
|
||||
exports.httpRequest = httpRequest;
|
||||
__webpack_unused_export__ = providerConfigFromInit;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
"use strict";
|
||||
exports.id = 579;
|
||||
exports.ids = [579];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6579:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var utilUtf8 = __webpack_require__(1577);
|
||||
|
||||
class EventStreamSerde {
|
||||
marshaller;
|
||||
serializer;
|
||||
deserializer;
|
||||
serdeContext;
|
||||
defaultContentType;
|
||||
constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, }) {
|
||||
this.marshaller = marshaller;
|
||||
this.serializer = serializer;
|
||||
this.deserializer = deserializer;
|
||||
this.serdeContext = serdeContext;
|
||||
this.defaultContentType = defaultContentType;
|
||||
}
|
||||
async serializeEventStream({ eventStream, requestSchema, initialRequest, }) {
|
||||
const marshaller = this.marshaller;
|
||||
const eventStreamMember = requestSchema.getEventStreamMember();
|
||||
const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
|
||||
const serializer = this.serializer;
|
||||
const defaultContentType = this.defaultContentType;
|
||||
const initialRequestMarker = Symbol("initialRequestMarker");
|
||||
const eventStreamIterable = {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
if (initialRequest) {
|
||||
const headers = {
|
||||
":event-type": { type: "string", value: "initial-request" },
|
||||
":message-type": { type: "string", value: "event" },
|
||||
":content-type": { type: "string", value: defaultContentType },
|
||||
};
|
||||
serializer.write(requestSchema, initialRequest);
|
||||
const body = serializer.flush();
|
||||
yield {
|
||||
[initialRequestMarker]: true,
|
||||
headers,
|
||||
body,
|
||||
};
|
||||
}
|
||||
for await (const page of eventStream) {
|
||||
yield page;
|
||||
}
|
||||
},
|
||||
};
|
||||
return marshaller.serialize(eventStreamIterable, (event) => {
|
||||
if (event[initialRequestMarker]) {
|
||||
return {
|
||||
headers: event.headers,
|
||||
body: event.body,
|
||||
};
|
||||
}
|
||||
const unionMember = Object.keys(event).find((key) => {
|
||||
return key !== "__type";
|
||||
}) ?? "";
|
||||
const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);
|
||||
const headers = {
|
||||
":event-type": { type: "string", value: eventType },
|
||||
":message-type": { type: "string", value: "event" },
|
||||
":content-type": { type: "string", value: explicitPayloadContentType ?? defaultContentType },
|
||||
...additionalHeaders,
|
||||
};
|
||||
return {
|
||||
headers,
|
||||
body,
|
||||
};
|
||||
});
|
||||
}
|
||||
async deserializeEventStream({ response, responseSchema, initialResponseContainer, }) {
|
||||
const marshaller = this.marshaller;
|
||||
const eventStreamMember = responseSchema.getEventStreamMember();
|
||||
const unionSchema = responseSchema.getMemberSchema(eventStreamMember);
|
||||
const memberSchemas = unionSchema.getMemberSchemas();
|
||||
const initialResponseMarker = Symbol("initialResponseMarker");
|
||||
const asyncIterable = marshaller.deserialize(response.body, async (event) => {
|
||||
const unionMember = Object.keys(event).find((key) => {
|
||||
return key !== "__type";
|
||||
}) ?? "";
|
||||
const body = event[unionMember].body;
|
||||
if (unionMember === "initial-response") {
|
||||
const dataObject = await this.deserializer.read(responseSchema, body);
|
||||
delete dataObject[eventStreamMember];
|
||||
return {
|
||||
[initialResponseMarker]: true,
|
||||
...dataObject,
|
||||
};
|
||||
}
|
||||
else if (unionMember in memberSchemas) {
|
||||
const eventStreamSchema = memberSchemas[unionMember];
|
||||
if (eventStreamSchema.isStructSchema()) {
|
||||
const out = {};
|
||||
let hasBindings = false;
|
||||
for (const [name, member] of eventStreamSchema.structIterator()) {
|
||||
const { eventHeader, eventPayload } = member.getMergedTraits();
|
||||
hasBindings = hasBindings || Boolean(eventHeader || eventPayload);
|
||||
if (eventPayload) {
|
||||
if (member.isBlobSchema()) {
|
||||
out[name] = body;
|
||||
}
|
||||
else if (member.isStringSchema()) {
|
||||
out[name] = (this.serdeContext?.utf8Encoder ?? utilUtf8.toUtf8)(body);
|
||||
}
|
||||
else if (member.isStructSchema()) {
|
||||
out[name] = await this.deserializer.read(member, body);
|
||||
}
|
||||
}
|
||||
else if (eventHeader) {
|
||||
const value = event[unionMember].headers[name]?.value;
|
||||
if (value != null) {
|
||||
if (member.isNumericSchema()) {
|
||||
if (value && typeof value === "object" && "bytes" in value) {
|
||||
out[name] = BigInt(value.toString());
|
||||
}
|
||||
else {
|
||||
out[name] = Number(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
out[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasBindings) {
|
||||
return {
|
||||
[unionMember]: out,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
[unionMember]: await this.deserializer.read(eventStreamSchema, body),
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
$unknown: event,
|
||||
};
|
||||
}
|
||||
});
|
||||
const asyncIterator = asyncIterable[Symbol.asyncIterator]();
|
||||
const firstEvent = await asyncIterator.next();
|
||||
if (firstEvent.done) {
|
||||
return asyncIterable;
|
||||
}
|
||||
if (firstEvent.value?.[initialResponseMarker]) {
|
||||
if (!responseSchema) {
|
||||
throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
|
||||
}
|
||||
for (const [key, value] of Object.entries(firstEvent.value)) {
|
||||
initialResponseContainer[key] = value;
|
||||
}
|
||||
}
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
if (!firstEvent?.value?.[initialResponseMarker]) {
|
||||
yield firstEvent.value;
|
||||
}
|
||||
while (true) {
|
||||
const { done, value } = await asyncIterator.next();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
yield value;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
writeEventBody(unionMember, unionSchema, event) {
|
||||
const serializer = this.serializer;
|
||||
let eventType = unionMember;
|
||||
let explicitPayloadMember = null;
|
||||
let explicitPayloadContentType;
|
||||
const isKnownSchema = (() => {
|
||||
const struct = unionSchema.getSchema();
|
||||
return struct[4].includes(unionMember);
|
||||
})();
|
||||
const additionalHeaders = {};
|
||||
if (!isKnownSchema) {
|
||||
const [type, value] = event[unionMember];
|
||||
eventType = type;
|
||||
serializer.write(15, value);
|
||||
}
|
||||
else {
|
||||
const eventSchema = unionSchema.getMemberSchema(unionMember);
|
||||
if (eventSchema.isStructSchema()) {
|
||||
for (const [memberName, memberSchema] of eventSchema.structIterator()) {
|
||||
const { eventHeader, eventPayload } = memberSchema.getMergedTraits();
|
||||
if (eventPayload) {
|
||||
explicitPayloadMember = memberName;
|
||||
break;
|
||||
}
|
||||
else if (eventHeader) {
|
||||
const value = event[unionMember][memberName];
|
||||
let type = "binary";
|
||||
if (memberSchema.isNumericSchema()) {
|
||||
if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {
|
||||
type = "integer";
|
||||
}
|
||||
else {
|
||||
type = "long";
|
||||
}
|
||||
}
|
||||
else if (memberSchema.isTimestampSchema()) {
|
||||
type = "timestamp";
|
||||
}
|
||||
else if (memberSchema.isStringSchema()) {
|
||||
type = "string";
|
||||
}
|
||||
else if (memberSchema.isBooleanSchema()) {
|
||||
type = "boolean";
|
||||
}
|
||||
if (value != null) {
|
||||
additionalHeaders[memberName] = {
|
||||
type,
|
||||
value,
|
||||
};
|
||||
delete event[unionMember][memberName];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (explicitPayloadMember !== null) {
|
||||
const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);
|
||||
if (payloadSchema.isBlobSchema()) {
|
||||
explicitPayloadContentType = "application/octet-stream";
|
||||
}
|
||||
else if (payloadSchema.isStringSchema()) {
|
||||
explicitPayloadContentType = "text/plain";
|
||||
}
|
||||
serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);
|
||||
}
|
||||
else {
|
||||
serializer.write(eventSchema, event[unionMember]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
|
||||
}
|
||||
}
|
||||
const messageSerialization = serializer.flush();
|
||||
const body = typeof messageSerialization === "string"
|
||||
? (this.serdeContext?.utf8Decoder ?? utilUtf8.fromUtf8)(messageSerialization)
|
||||
: messageSerialization;
|
||||
return {
|
||||
body,
|
||||
eventType,
|
||||
explicitPayloadContentType,
|
||||
additionalHeaders,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.EventStreamSerde = EventStreamSerde;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
exports.id = 605;
|
||||
exports.ids = [605];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 1509:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.checkUrl = void 0;
|
||||
const property_provider_1 = __webpack_require__(1238);
|
||||
const LOOPBACK_CIDR_IPv4 = "127.0.0.0/8";
|
||||
const LOOPBACK_CIDR_IPv6 = "::1/128";
|
||||
const ECS_CONTAINER_HOST = "169.254.170.2";
|
||||
const EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
||||
const EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
||||
const checkUrl = (url, logger) => {
|
||||
if (url.protocol === "https:") {
|
||||
return;
|
||||
}
|
||||
if (url.hostname === ECS_CONTAINER_HOST ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv4 ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
||||
return;
|
||||
}
|
||||
if (url.hostname.includes("[")) {
|
||||
if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (url.hostname === "localhost") {
|
||||
return;
|
||||
}
|
||||
const ipComponents = url.hostname.split(".");
|
||||
const inRange = (component) => {
|
||||
const num = parseInt(component, 10);
|
||||
return 0 <= num && num <= 255;
|
||||
};
|
||||
if (ipComponents[0] === "127" &&
|
||||
inRange(ipComponents[1]) &&
|
||||
inRange(ipComponents[2]) &&
|
||||
inRange(ipComponents[3]) &&
|
||||
ipComponents.length === 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
||||
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
||||
- ECS container host 169.254.170.2
|
||||
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
||||
};
|
||||
exports.checkUrl = checkUrl;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8712:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.fromHttp = void 0;
|
||||
const tslib_1 = __webpack_require__(1860);
|
||||
const client_1 = __webpack_require__(5152);
|
||||
const node_http_handler_1 = __webpack_require__(1279);
|
||||
const property_provider_1 = __webpack_require__(1238);
|
||||
const promises_1 = tslib_1.__importDefault(__webpack_require__(1943));
|
||||
const checkUrl_1 = __webpack_require__(1509);
|
||||
const requestHelpers_1 = __webpack_require__(8914);
|
||||
const retry_wrapper_1 = __webpack_require__(1122);
|
||||
const AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
||||
const DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
|
||||
const AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
||||
const fromHttp = (options = {}) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
||||
let host;
|
||||
const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
||||
const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
||||
const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
||||
const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
||||
const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn
|
||||
? console.warn
|
||||
: options.logger.warn.bind(options.logger);
|
||||
if (relative && full) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
||||
warn("awsContainerCredentialsFullUri will take precedence.");
|
||||
}
|
||||
if (token && tokenFile) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
||||
warn("awsContainerAuthorizationToken will take precedence.");
|
||||
}
|
||||
if (full) {
|
||||
host = full;
|
||||
}
|
||||
else if (relative) {
|
||||
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
||||
}
|
||||
else {
|
||||
throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided.
|
||||
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
||||
}
|
||||
const url = new URL(host);
|
||||
(0, checkUrl_1.checkUrl)(url, options.logger);
|
||||
const requestHandler = node_http_handler_1.NodeHttpHandler.create({
|
||||
requestTimeout: options.timeout ?? 1000,
|
||||
connectionTimeout: options.timeout ?? 1000,
|
||||
});
|
||||
return (0, retry_wrapper_1.retryWrapper)(async () => {
|
||||
const request = (0, requestHelpers_1.createGetRequest)(url);
|
||||
if (token) {
|
||||
request.headers.Authorization = token;
|
||||
}
|
||||
else if (tokenFile) {
|
||||
request.headers.Authorization = (await promises_1.default.readFile(tokenFile)).toString();
|
||||
}
|
||||
try {
|
||||
const result = await requestHandler.handle(request);
|
||||
return (0, requestHelpers_1.getCredentials)(result.response).then((creds) => (0, client_1.setCredentialFeature)(creds, "CREDENTIALS_HTTP", "z"));
|
||||
}
|
||||
catch (e) {
|
||||
throw new property_provider_1.CredentialsProviderError(String(e), { logger: options.logger });
|
||||
}
|
||||
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
||||
};
|
||||
exports.fromHttp = fromHttp;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8914:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.createGetRequest = createGetRequest;
|
||||
exports.getCredentials = getCredentials;
|
||||
const property_provider_1 = __webpack_require__(1238);
|
||||
const protocol_http_1 = __webpack_require__(2356);
|
||||
const smithy_client_1 = __webpack_require__(1411);
|
||||
const util_stream_1 = __webpack_require__(4252);
|
||||
function createGetRequest(url) {
|
||||
return new protocol_http_1.HttpRequest({
|
||||
protocol: url.protocol,
|
||||
hostname: url.hostname,
|
||||
port: Number(url.port),
|
||||
path: url.pathname,
|
||||
query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
|
||||
acc[k] = v;
|
||||
return acc;
|
||||
}, {}),
|
||||
fragment: url.hash,
|
||||
});
|
||||
}
|
||||
async function getCredentials(response, logger) {
|
||||
const stream = (0, util_stream_1.sdkStreamMixin)(response.body);
|
||||
const str = await stream.transformToString();
|
||||
if (response.statusCode === 200) {
|
||||
const parsed = JSON.parse(str);
|
||||
if (typeof parsed.AccessKeyId !== "string" ||
|
||||
typeof parsed.SecretAccessKey !== "string" ||
|
||||
typeof parsed.Token !== "string" ||
|
||||
typeof parsed.Expiration !== "string") {
|
||||
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " +
|
||||
"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
||||
}
|
||||
return {
|
||||
accessKeyId: parsed.AccessKeyId,
|
||||
secretAccessKey: parsed.SecretAccessKey,
|
||||
sessionToken: parsed.Token,
|
||||
expiration: (0, smithy_client_1.parseRfc3339DateTime)(parsed.Expiration),
|
||||
};
|
||||
}
|
||||
if (response.statusCode >= 400 && response.statusCode < 500) {
|
||||
let parsedBody = {};
|
||||
try {
|
||||
parsedBody = JSON.parse(str);
|
||||
}
|
||||
catch (e) { }
|
||||
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
||||
Code: parsedBody.Code,
|
||||
Message: parsedBody.Message,
|
||||
});
|
||||
}
|
||||
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1122:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.retryWrapper = void 0;
|
||||
const retryWrapper = (toRetry, maxRetries, delayMs) => {
|
||||
return async () => {
|
||||
for (let i = 0; i < maxRetries; ++i) {
|
||||
try {
|
||||
return await toRetry();
|
||||
}
|
||||
catch (e) {
|
||||
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
||||
}
|
||||
}
|
||||
return await toRetry();
|
||||
};
|
||||
};
|
||||
exports.retryWrapper = retryWrapper;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8605:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
__webpack_unused_export__ = ({ value: true });
|
||||
exports.fromHttp = void 0;
|
||||
var fromHttp_1 = __webpack_require__(8712);
|
||||
Object.defineProperty(exports, "fromHttp", ({ enumerable: true, get: function () { return fromHttp_1.fromHttp; } }));
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
exports.id = 869;
|
||||
exports.ids = [869];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 5869:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
var sharedIniFileLoader = __webpack_require__(4964);
|
||||
var propertyProvider = __webpack_require__(1238);
|
||||
var client = __webpack_require__(5152);
|
||||
|
||||
const resolveCredentialSource = (credentialSource, profileName, logger) => {
|
||||
const sourceProvidersMap = {
|
||||
EcsContainer: async (options) => {
|
||||
const { fromHttp } = await __webpack_require__.e(/* import() */ 605).then(__webpack_require__.bind(__webpack_require__, 8605));
|
||||
const { fromContainerMetadata } = await __webpack_require__.e(/* import() */ 566).then(__webpack_require__.t.bind(__webpack_require__, 566, 19));
|
||||
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
||||
return async () => propertyProvider.chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
|
||||
},
|
||||
Ec2InstanceMetadata: async (options) => {
|
||||
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
||||
const { fromInstanceMetadata } = await __webpack_require__.e(/* import() */ 566).then(__webpack_require__.t.bind(__webpack_require__, 566, 19));
|
||||
return async () => fromInstanceMetadata(options)().then(setNamedProvider);
|
||||
},
|
||||
Environment: async (options) => {
|
||||
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
||||
const { fromEnv } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 5606, 19));
|
||||
return async () => fromEnv(options)().then(setNamedProvider);
|
||||
},
|
||||
};
|
||||
if (credentialSource in sourceProvidersMap) {
|
||||
return sourceProvidersMap[credentialSource];
|
||||
}
|
||||
else {
|
||||
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, ` +
|
||||
`expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
||||
}
|
||||
};
|
||||
const setNamedProvider = (creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
||||
|
||||
const isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
||||
return (Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.role_arn === "string" &&
|
||||
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 &&
|
||||
["undefined", "string"].indexOf(typeof arg.external_id) > -1 &&
|
||||
["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 &&
|
||||
(isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })));
|
||||
};
|
||||
const isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
|
||||
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
||||
if (withSourceProfile) {
|
||||
logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
|
||||
}
|
||||
return withSourceProfile;
|
||||
};
|
||||
const isCredentialSourceProfile = (arg, { profile, logger }) => {
|
||||
const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
||||
if (withProviderProfile) {
|
||||
logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
|
||||
}
|
||||
return withProviderProfile;
|
||||
};
|
||||
const resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}, resolveProfileData) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
|
||||
const profileData = profiles[profileName];
|
||||
const { source_profile, region } = profileData;
|
||||
if (!options.roleAssumer) {
|
||||
const { getDefaultRoleAssumer } = await __webpack_require__.e(/* import() */ 136).then(__webpack_require__.t.bind(__webpack_require__, 1136, 23));
|
||||
options.roleAssumer = getDefaultRoleAssumer({
|
||||
...options.clientConfig,
|
||||
credentialProviderLogger: options.logger,
|
||||
parentClientConfig: {
|
||||
...options?.parentClientConfig,
|
||||
region: region ?? options?.parentClientConfig?.region,
|
||||
},
|
||||
}, options.clientPlugins);
|
||||
}
|
||||
if (source_profile && source_profile in visitedProfiles) {
|
||||
throw new propertyProvider.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile` +
|
||||
` ${sharedIniFileLoader.getProfileName(options)}. Profiles visited: ` +
|
||||
Object.keys(visitedProfiles).join(", "), { logger: options.logger });
|
||||
}
|
||||
options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
|
||||
const sourceCredsProvider = source_profile
|
||||
? resolveProfileData(source_profile, profiles, options, {
|
||||
...visitedProfiles,
|
||||
[source_profile]: true,
|
||||
}, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {}))
|
||||
: (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
|
||||
if (isCredentialSourceWithoutRoleArn(profileData)) {
|
||||
return sourceCredsProvider.then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
||||
}
|
||||
else {
|
||||
const params = {
|
||||
RoleArn: profileData.role_arn,
|
||||
RoleSessionName: profileData.role_session_name || `aws-sdk-js-${Date.now()}`,
|
||||
ExternalId: profileData.external_id,
|
||||
DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10),
|
||||
};
|
||||
const { mfa_serial } = profileData;
|
||||
if (mfa_serial) {
|
||||
if (!options.mfaCodeProvider) {
|
||||
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
|
||||
}
|
||||
params.SerialNumber = mfa_serial;
|
||||
params.TokenCode = await options.mfaCodeProvider(mfa_serial);
|
||||
}
|
||||
const sourceCreds = await sourceCredsProvider;
|
||||
return options.roleAssumer(sourceCreds, params).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
||||
}
|
||||
};
|
||||
const isCredentialSourceWithoutRoleArn = (section) => {
|
||||
return !section.role_arn && !!section.credential_source;
|
||||
};
|
||||
|
||||
const isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
|
||||
const resolveProcessCredentials = async (options, profile) => __webpack_require__.e(/* import() */ 360).then(__webpack_require__.t.bind(__webpack_require__, 5360, 19)).then(({ fromProcess }) => fromProcess({
|
||||
...options,
|
||||
profile,
|
||||
})().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v")));
|
||||
|
||||
const resolveSsoCredentials = async (profile, profileData, options = {}) => {
|
||||
const { fromSSO } = await __webpack_require__.e(/* import() */ 998).then(__webpack_require__.t.bind(__webpack_require__, 998, 19));
|
||||
return fromSSO({
|
||||
profile,
|
||||
logger: options.logger,
|
||||
parentClientConfig: options.parentClientConfig,
|
||||
clientConfig: options.clientConfig,
|
||||
})().then((creds) => {
|
||||
if (profileData.sso_session) {
|
||||
return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
||||
}
|
||||
else {
|
||||
return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
|
||||
}
|
||||
});
|
||||
};
|
||||
const isSsoProfile = (arg) => arg &&
|
||||
(typeof arg.sso_start_url === "string" ||
|
||||
typeof arg.sso_account_id === "string" ||
|
||||
typeof arg.sso_session === "string" ||
|
||||
typeof arg.sso_region === "string" ||
|
||||
typeof arg.sso_role_name === "string");
|
||||
|
||||
const isStaticCredsProfile = (arg) => Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.aws_access_key_id === "string" &&
|
||||
typeof arg.aws_secret_access_key === "string" &&
|
||||
["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 &&
|
||||
["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1;
|
||||
const resolveStaticCredentials = async (profile, options) => {
|
||||
options?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
|
||||
const credentials = {
|
||||
accessKeyId: profile.aws_access_key_id,
|
||||
secretAccessKey: profile.aws_secret_access_key,
|
||||
sessionToken: profile.aws_session_token,
|
||||
...(profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }),
|
||||
...(profile.aws_account_id && { accountId: profile.aws_account_id }),
|
||||
};
|
||||
return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
|
||||
};
|
||||
|
||||
const isWebIdentityProfile = (arg) => Boolean(arg) &&
|
||||
typeof arg === "object" &&
|
||||
typeof arg.web_identity_token_file === "string" &&
|
||||
typeof arg.role_arn === "string" &&
|
||||
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
|
||||
const resolveWebIdentityCredentials = async (profile, options) => __webpack_require__.e(/* import() */ 956).then(__webpack_require__.t.bind(__webpack_require__, 9956, 23)).then(({ fromTokenFile }) => fromTokenFile({
|
||||
webIdentityTokenFile: profile.web_identity_token_file,
|
||||
roleArn: profile.role_arn,
|
||||
roleSessionName: profile.role_session_name,
|
||||
roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
|
||||
logger: options.logger,
|
||||
parentClientConfig: options.parentClientConfig,
|
||||
})().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q")));
|
||||
|
||||
const resolveProfileData = async (profileName, profiles, options, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
|
||||
const data = profiles[profileName];
|
||||
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
||||
return resolveStaticCredentials(data, options);
|
||||
}
|
||||
if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
|
||||
return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles, resolveProfileData);
|
||||
}
|
||||
if (isStaticCredsProfile(data)) {
|
||||
return resolveStaticCredentials(data, options);
|
||||
}
|
||||
if (isWebIdentityProfile(data)) {
|
||||
return resolveWebIdentityCredentials(data, options);
|
||||
}
|
||||
if (isProcessProfile(data)) {
|
||||
return resolveProcessCredentials(options, profileName);
|
||||
}
|
||||
if (isSsoProfile(data)) {
|
||||
return await resolveSsoCredentials(profileName, data, options);
|
||||
}
|
||||
throw new propertyProvider.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
|
||||
};
|
||||
|
||||
const fromIni = (_init = {}) => async ({ callerClientConfig } = {}) => {
|
||||
const init = {
|
||||
..._init,
|
||||
parentClientConfig: {
|
||||
...callerClientConfig,
|
||||
..._init.parentClientConfig,
|
||||
},
|
||||
};
|
||||
init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
|
||||
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
||||
return resolveProfileData(sharedIniFileLoader.getProfileName({
|
||||
profile: _init.profile ?? callerClientConfig?.profile,
|
||||
}), profiles, init);
|
||||
};
|
||||
|
||||
exports.fromIni = fromIni;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
+1039
File diff suppressed because it is too large
Load Diff
+1455
File diff suppressed because it is too large
Load Diff
+15095
-20161
File diff suppressed because one or more lines are too long
-14
@@ -1,14 +0,0 @@
|
||||
import { STSClient } from '@aws-sdk/client-sts';
|
||||
export interface CredentialsClientProps {
|
||||
region?: string;
|
||||
proxyServer?: string;
|
||||
}
|
||||
export declare class CredentialsClient {
|
||||
region?: string;
|
||||
private _stsClient?;
|
||||
private readonly requestHandler?;
|
||||
constructor(props: CredentialsClientProps);
|
||||
get stsClient(): STSClient;
|
||||
validateCredentials(expectedAccessKeyId?: string, roleChaining?: boolean): Promise<void>;
|
||||
private loadCredentials;
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
import type { CredentialsClient } from './CredentialsClient';
|
||||
export interface assumeRoleParams {
|
||||
credentialsClient: CredentialsClient;
|
||||
roleToAssume: string;
|
||||
roleDuration: number;
|
||||
roleSessionName: string;
|
||||
roleSkipSessionTagging?: boolean;
|
||||
sourceAccountId?: string;
|
||||
roleExternalId?: string;
|
||||
webIdentityTokenFile?: string;
|
||||
webIdentityToken?: string;
|
||||
inlineSessionPolicy?: string;
|
||||
managedSessionPolicies?: {
|
||||
arn: string;
|
||||
}[];
|
||||
}
|
||||
export declare function assumeRole(params: assumeRoleParams): Promise<import("@aws-sdk/client-sts").AssumeRoleCommandOutput>;
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* When the GitHub Actions job is done, clean up any environment variables that
|
||||
* may have been set by the configure-aws-credentials steps in the job.
|
||||
*
|
||||
* Environment variables are not intended to be shared across different jobs in
|
||||
* the same GitHub Actions workflow: GitHub Actions documentation states that
|
||||
* each job runs in a fresh instance. However, doing our own cleanup will
|
||||
* give us additional assurance that these environment variables are not shared
|
||||
* with any other jobs.
|
||||
*/
|
||||
export declare function cleanup(): void;
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
import type { Credentials } from '@aws-sdk/client-sts';
|
||||
import type { CredentialsClient } from './CredentialsClient';
|
||||
export declare function exportCredentials(creds?: Partial<Credentials>, outputCredentials?: boolean): void;
|
||||
export declare function unsetCredentials(): void;
|
||||
export declare function exportRegion(region: string): void;
|
||||
export declare function exportAccountId(credentialsClient: CredentialsClient, maskAccountId?: boolean): Promise<string>;
|
||||
export declare function sanitizeGitHubVariables(name: string): string;
|
||||
export declare function defaultSleep(ms: number): Promise<unknown>;
|
||||
declare let sleep: typeof defaultSleep;
|
||||
export declare function withsleep(s: typeof sleep): void;
|
||||
export declare function reset(): void;
|
||||
export declare function verifyKeys(creds: Partial<Credentials> | undefined): boolean;
|
||||
export declare function retryAndBackoff<T>(fn: () => Promise<T>, isRetryable: boolean, maxRetries?: number, retries?: number, base?: number): Promise<T>;
|
||||
export declare function errorMessage(error: unknown): string;
|
||||
export declare function isDefined<T>(i: T | undefined | null): i is T;
|
||||
export {};
|
||||
-1
@@ -1 +0,0 @@
|
||||
export declare function run(): Promise<void>;
|
||||
-1
@@ -1 +0,0 @@
|
||||
export {};
|
||||
-1
@@ -1 +0,0 @@
|
||||
export {};
|
||||
-1
@@ -1 +0,0 @@
|
||||
export {};
|
||||
-74
@@ -1,74 +0,0 @@
|
||||
import type * as core from '@actions/core';
|
||||
declare const _default: {
|
||||
readonly outputs: {
|
||||
STS_CREDENTIALS: {
|
||||
Credentials: {
|
||||
AccessKeyId: string;
|
||||
SecretAccessKey: string;
|
||||
SessionToken: string;
|
||||
Expiration: Date;
|
||||
};
|
||||
AssumedRoleUser: {
|
||||
Arn: string;
|
||||
AssumedRoleId: string;
|
||||
};
|
||||
};
|
||||
GET_CALLER_IDENTITY: {
|
||||
Account: string;
|
||||
Arn: string;
|
||||
};
|
||||
FAKE_STS_ACCESS_KEY_ID: string;
|
||||
FAKE_STS_SECRET_ACCESS_KEY: string;
|
||||
FAKE_STS_SESSION_TOKEN: string;
|
||||
ODD_CHARACTER_CREDENTIALS: {
|
||||
Credentials: {
|
||||
AccessKeyId: string;
|
||||
SecretAccessKey: string;
|
||||
SessionToken: string;
|
||||
Expiration: Date;
|
||||
};
|
||||
AssumedRoleUser: {
|
||||
Arn: string;
|
||||
AssumedRoleId: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
readonly envs: {
|
||||
GITHUB_REPOSITORY: string;
|
||||
GITHUB_WORKFLOW: string;
|
||||
GITHUB_ACTION: string;
|
||||
GITHUB_ACTOR: string;
|
||||
GITHUB_SHA: string;
|
||||
GITHUB_WORKSPACE: string;
|
||||
GITHUB_ACTIONS: string;
|
||||
};
|
||||
readonly GH_OIDC_INPUTS: {
|
||||
'role-to-assume': string;
|
||||
'aws-region': string;
|
||||
'special-characters-workaround': string;
|
||||
};
|
||||
readonly IAM_USER_INPUTS: {
|
||||
'aws-access-key-id': string;
|
||||
'aws-secret-access-key': string;
|
||||
'aws-region': string;
|
||||
};
|
||||
readonly IAM_ASSUMEROLE_INPUTS: {
|
||||
'aws-access-key-id': string;
|
||||
'aws-secret-access-key': string;
|
||||
'role-to-assume': string;
|
||||
'aws-region': string;
|
||||
};
|
||||
readonly WEBIDENTITY_TOKEN_FILE_INPUTS: {
|
||||
'web-identity-token-file': string;
|
||||
'role-to-assume': string;
|
||||
'aws-region': string;
|
||||
};
|
||||
readonly EXISTING_ROLE_INPUTS: {
|
||||
'role-to-assume': string;
|
||||
'role-chaining': string;
|
||||
'aws-region': string;
|
||||
};
|
||||
readonly getInput: (fakeEnv: Record<string, string>) => (name: string, options?: core.InputOptions) => string;
|
||||
readonly getMultilineInput: (fakeEnv: Record<string, string[]>) => (name: string, options?: core.InputOptions) => string[];
|
||||
};
|
||||
export default _default;
|
||||
+47709
-21835
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@ jobs:
|
||||
sast-guard:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- uses: grolston/guard-action@main
|
||||
with:
|
||||
data_directory: './cloudformation/' ## change to your template directory
|
||||
|
||||
@@ -18,9 +18,9 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
uses: aws-actions/configure-aws-credentials@v5
|
||||
with:
|
||||
aws-region: us-east-1
|
||||
## the following creates an ARN based on the values entered into github secrets
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/** @type {import('jest').Config} */
|
||||
const config = {
|
||||
verbose: true,
|
||||
transform: {
|
||||
'^.+\\.m?[tj]sx?$': ['ts-jest'],
|
||||
},
|
||||
testMatch: [
|
||||
'<rootDir>/src/**/__tests__/**/*.ts?(x)',
|
||||
'<rootDir>/(test|src)/**/*(*.)@(spec|test).ts?(x)',
|
||||
'<rootDir>/test/**/*.(test|spec).(js|jsx|ts|tsx)',
|
||||
],
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
coverageReporters: ['json', 'lcov', 'clover', 'cobertura', 'text'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['/node_modules/'],
|
||||
testPathIgnorePatterns: ['/node_modules/'],
|
||||
watchPathIgnorePatterns: ['/node_modules/'],
|
||||
reporters: [
|
||||
'default',
|
||||
[
|
||||
'jest-junit',
|
||||
{
|
||||
outputDirectory: 'test-reports',
|
||||
},
|
||||
],
|
||||
],
|
||||
preset: 'ts-jest/presets/default-legacy',
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
Generated
+1851
-1600
File diff suppressed because it is too large
Load Diff
+19
-17
@@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "configure-aws-credentials",
|
||||
"description": "A GitHub Action to configure AWS credentials",
|
||||
"version": "4.0.3",
|
||||
"version": "5.1.1",
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.build.json",
|
||||
"build": "tsc",
|
||||
"lint": "biome check --error-on-warnings ./src",
|
||||
"lint:fix": "biome check --write ./src",
|
||||
"package": "npm run build && ncc build --license THIRD-PARTY -o dist && ncc build src/cleanup/index.ts -o dist/cleanup && cpy dist/THIRD-PARTY . && del-cli dist/THIRD-PARTY",
|
||||
"test": "npm run lint && vitest run"
|
||||
"test": "npm run lint && vitest run && npm run build",
|
||||
"clean": "del-cli coverage test-reports node_modules"
|
||||
},
|
||||
"author": {
|
||||
"name": "Amazon.com, Inc. or its affiliates",
|
||||
@@ -14,26 +16,26 @@
|
||||
"organization": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aws-sdk/credential-provider-env": "^3.515.0",
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@smithy/property-provider": "^3.1.7",
|
||||
"@types/node": "^22.9.0",
|
||||
"@vercel/ncc": "^0.38.2",
|
||||
"@vitest/coverage-v8": "^2.1.3",
|
||||
"@aws-sdk/credential-provider-env": "^3.928.0",
|
||||
"@biomejs/biome": "2.3.6",
|
||||
"@smithy/property-provider": "^4.2.5",
|
||||
"@types/node": "^24.10.1",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"aws-sdk-client-mock": "^4.1.0",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"del-cli": "^6.0.0",
|
||||
"cpy-cli": "^6.0.0",
|
||||
"del-cli": "^7.0.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"memfs": "^4.14.0",
|
||||
"memfs": "^4.51.0",
|
||||
"standard-version": "^9.5.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vitest": "^2.1.3"
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.11.1",
|
||||
"@aws-sdk/client-sts": "^3.675.0",
|
||||
"@smithy/node-http-handler": "^4.0.1",
|
||||
"https-proxy-agent": "^5.0.1"
|
||||
"@aws-sdk/client-sts": "^3.933.0",
|
||||
"@smithy/node-http-handler": "^4.4.5",
|
||||
"proxy-agent": "^6.5.0"
|
||||
},
|
||||
"keywords": [
|
||||
"aws",
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"bump-minor-pre-major": false,
|
||||
"bump-patch-for-minor-pre-major": false,
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
"prerelease": false,
|
||||
"exclude-paths": [".github", "dist"]
|
||||
}
|
||||
},
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
||||
|
||||
+49
-16
@@ -2,14 +2,16 @@ import { info } from '@actions/core';
|
||||
import { STSClient } from '@aws-sdk/client-sts';
|
||||
import type { AwsCredentialIdentity } from '@aws-sdk/types';
|
||||
import { NodeHttpHandler } from '@smithy/node-http-handler';
|
||||
import { HttpsProxyAgent } from 'https-proxy-agent';
|
||||
import { errorMessage } from './helpers';
|
||||
import { ProxyAgent } from 'proxy-agent';
|
||||
import { errorMessage, getCallerIdentity } from './helpers';
|
||||
import { ProxyResolver } from './ProxyResolver';
|
||||
|
||||
const USER_AGENT = 'configure-aws-credentials-for-github-actions';
|
||||
|
||||
export interface CredentialsClientProps {
|
||||
region?: string;
|
||||
proxyServer?: string;
|
||||
noProxy?: string;
|
||||
}
|
||||
|
||||
export class CredentialsClient {
|
||||
@@ -18,29 +20,46 @@ export class CredentialsClient {
|
||||
private readonly requestHandler?: NodeHttpHandler;
|
||||
|
||||
constructor(props: CredentialsClientProps) {
|
||||
this.region = props.region;
|
||||
if (props.region !== undefined) {
|
||||
this.region = props.region;
|
||||
}
|
||||
if (props.proxyServer) {
|
||||
info('Configuring proxy handler for STS client');
|
||||
const handler = new HttpsProxyAgent(props.proxyServer);
|
||||
const proxyOptions: { httpProxy: string; httpsProxy: string; noProxy?: string } = {
|
||||
httpProxy: props.proxyServer,
|
||||
httpsProxy: props.proxyServer,
|
||||
};
|
||||
if (props.noProxy !== undefined) {
|
||||
proxyOptions.noProxy = props.noProxy;
|
||||
}
|
||||
const getProxyForUrl = new ProxyResolver(proxyOptions).getProxyForUrl;
|
||||
const handler = new ProxyAgent({ getProxyForUrl });
|
||||
this.requestHandler = new NodeHttpHandler({
|
||||
httpAgent: handler,
|
||||
httpsAgent: handler,
|
||||
httpAgent: handler,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public get stsClient(): STSClient {
|
||||
if (!this._stsClient) {
|
||||
this._stsClient = new STSClient({
|
||||
region: this.region,
|
||||
customUserAgent: USER_AGENT,
|
||||
requestHandler: this.requestHandler ? this.requestHandler : undefined,
|
||||
});
|
||||
const config = { customUserAgent: USER_AGENT } as {
|
||||
customUserAgent: string;
|
||||
region?: string;
|
||||
requestHandler?: NodeHttpHandler;
|
||||
};
|
||||
if (this.region !== undefined) config.region = this.region;
|
||||
if (this.requestHandler !== undefined) config.requestHandler = this.requestHandler;
|
||||
this._stsClient = new STSClient(config);
|
||||
}
|
||||
return this._stsClient;
|
||||
}
|
||||
|
||||
public async validateCredentials(expectedAccessKeyId?: string, roleChaining?: boolean) {
|
||||
public async validateCredentials(
|
||||
expectedAccessKeyId?: string,
|
||||
roleChaining?: boolean,
|
||||
expectedAccountIds?: string[],
|
||||
) {
|
||||
let credentials: AwsCredentialIdentity;
|
||||
try {
|
||||
credentials = await this.loadCredentials();
|
||||
@@ -50,22 +69,36 @@ export class CredentialsClient {
|
||||
} catch (error) {
|
||||
throw new Error(`Credentials could not be loaded, please check your action inputs: ${errorMessage(error)}`);
|
||||
}
|
||||
if (expectedAccountIds && expectedAccountIds.length > 0 && expectedAccountIds[0] !== '') {
|
||||
let callerIdentity: Awaited<ReturnType<typeof getCallerIdentity>>;
|
||||
try {
|
||||
callerIdentity = await getCallerIdentity(this.stsClient);
|
||||
} catch (error) {
|
||||
throw new Error(`Could not validate account ID of credentials: ${errorMessage(error)}`);
|
||||
}
|
||||
if (!callerIdentity.Account || !expectedAccountIds.includes(callerIdentity.Account)) {
|
||||
throw new Error(
|
||||
`The account ID of the provided credentials (${
|
||||
callerIdentity.Account ?? 'unknown'
|
||||
}) does not match any of the expected account IDs: ${expectedAccountIds.join(', ')}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!roleChaining) {
|
||||
const actualAccessKeyId = credentials.accessKeyId;
|
||||
|
||||
if (expectedAccessKeyId && expectedAccessKeyId !== actualAccessKeyId) {
|
||||
throw new Error(
|
||||
'Unexpected failure: Credentials loaded by the SDK do not match the access key ID configured by the action',
|
||||
'Credentials loaded by the SDK do not match the expected access key ID configured by the action',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async loadCredentials() {
|
||||
const client = new STSClient({
|
||||
requestHandler: this.requestHandler ? this.requestHandler : undefined,
|
||||
});
|
||||
const config = {} as { requestHandler?: NodeHttpHandler };
|
||||
if (this.requestHandler !== undefined) config.requestHandler = this.requestHandler;
|
||||
const client = new STSClient(config);
|
||||
return client.config.credentials();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// Based on https://github.com/Rob--W/proxy-from-env/tree/caf8c32301afdac8b5feaf346028bd8240690144
|
||||
// See https://github.com/Rob--W/proxy-from-env/blob/caf8c32301afdac8b5feaf346028bd8240690144/LICENSE
|
||||
import type * as http from 'node:http';
|
||||
|
||||
const DEFAULT_PORTS: Record<string, number> = {
|
||||
http: 80,
|
||||
https: 443,
|
||||
};
|
||||
export interface ProxyOptions {
|
||||
readonly noProxy?: string;
|
||||
readonly httpsProxy?: string;
|
||||
readonly httpProxy?: string;
|
||||
}
|
||||
|
||||
export class ProxyResolver {
|
||||
options: ProxyOptions;
|
||||
constructor(options: ProxyOptions) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
// This method matches the interface expected by 'proxy-agent'. It is an arrow function to bind 'this'.
|
||||
public readonly getProxyForUrl = (url: string, _req: http.ClientRequest): string => {
|
||||
return this.getProxyForUrlOptions(url, this.options);
|
||||
};
|
||||
|
||||
private getProxyForUrlOptions(url: string | URL, options?: ProxyOptions): string {
|
||||
let parsedUrl: URL;
|
||||
try {
|
||||
parsedUrl = typeof url === 'string' ? new URL(url) : url;
|
||||
} catch (_) {
|
||||
return ''; // Don't proxy invalid URLs.
|
||||
}
|
||||
const proto = parsedUrl.protocol.split(':', 1)[0];
|
||||
if (!proto) return ''; // Don't proxy URLs without a protocol.
|
||||
const hostname = parsedUrl.host;
|
||||
const port = parseInt(parsedUrl.port || '') || DEFAULT_PORTS[proto] || 0;
|
||||
|
||||
if (options?.noProxy && !this.shouldProxy(hostname, port, options.noProxy)) return '';
|
||||
if (proto === 'http' && options?.httpProxy) return options.httpProxy;
|
||||
if (proto === 'https' && options?.httpsProxy) return options.httpsProxy;
|
||||
return ''; // No proxy configured for this protocol or unknown protocol
|
||||
}
|
||||
|
||||
private shouldProxy(hostname: string, port: number, noProxy: string): boolean {
|
||||
if (!noProxy) return true;
|
||||
if (noProxy === '*') return false; // Never proxy if wildcard is set.
|
||||
|
||||
return noProxy.split(/[,\s]/).every((proxy) => {
|
||||
if (!proxy) return true; // Skip zero-length hosts.
|
||||
|
||||
const parsedProxy = proxy.match(/^(.+):(\d+)$/);
|
||||
const parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
|
||||
const parsedProxyPort = parsedProxy?.[2] ? parseInt(parsedProxy[2]) : 0;
|
||||
|
||||
if (parsedProxyPort && parsedProxyPort !== port) return true; // Skip if ports don't match.
|
||||
|
||||
if (parsedProxyHostname && !/^[.*]/.test(parsedProxyHostname)) {
|
||||
// No wildcards, so stop proxying if there is an exact match.
|
||||
return hostname !== parsedProxyHostname;
|
||||
}
|
||||
|
||||
let cleanProxyHostname = parsedProxyHostname;
|
||||
if (parsedProxyHostname && parsedProxyHostname.charAt(0) === '*') {
|
||||
// Remove leading wildcard.
|
||||
cleanProxyHostname = parsedProxyHostname.slice(1);
|
||||
}
|
||||
// Stop proxying if the hostname ends with the no_proxy host.
|
||||
return !cleanProxyHostname || !hostname.endsWith(cleanProxyHostname);
|
||||
});
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -142,8 +142,11 @@ export async function assumeRole(params: assumeRoleParams) {
|
||||
PolicyArns: managedSessionPolicies?.length ? managedSessionPolicies : undefined,
|
||||
};
|
||||
const keys = Object.keys(commonAssumeRoleParams) as Array<keyof typeof commonAssumeRoleParams>;
|
||||
// biome-ignore lint/complexity/noForEach: Legacy code
|
||||
keys.forEach((k) => commonAssumeRoleParams[k] === undefined && delete commonAssumeRoleParams[k]);
|
||||
keys.forEach((k) => {
|
||||
if (commonAssumeRoleParams[k] === undefined) {
|
||||
delete commonAssumeRoleParams[k];
|
||||
}
|
||||
});
|
||||
|
||||
// Instantiate STS client
|
||||
const stsClient = credentialsClient.stsClient;
|
||||
|
||||
+17
-13
@@ -1,5 +1,5 @@
|
||||
import * as core from '@actions/core';
|
||||
import { errorMessage } from '../helpers';
|
||||
import { errorMessage, getBooleanInput } from '../helpers';
|
||||
|
||||
/**
|
||||
* When the GitHub Actions job is done, clean up any environment variables that
|
||||
@@ -13,20 +13,24 @@ import { errorMessage } from '../helpers';
|
||||
*/
|
||||
|
||||
export function cleanup() {
|
||||
try {
|
||||
// The GitHub Actions toolkit does not have an option to completely unset
|
||||
// environment variables, so we overwrite the current value with an empty
|
||||
// string. The AWS CLI and AWS SDKs will behave correctly: they treat an
|
||||
// empty string value as if the environment variable does not exist.
|
||||
core.exportVariable('AWS_ACCESS_KEY_ID', '');
|
||||
core.exportVariable('AWS_SECRET_ACCESS_KEY', '');
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
core.exportVariable('AWS_DEFAULT_REGION', '');
|
||||
core.exportVariable('AWS_REGION', '');
|
||||
} catch (error) {
|
||||
core.setFailed(errorMessage(error));
|
||||
// Only attempt to change environment variables if we changed them in the first place
|
||||
if (getBooleanInput('output-env-credentials', { required: false, default: true })) {
|
||||
try {
|
||||
// The GitHub Actions toolkit does not have an option to completely unset
|
||||
// environment variables, so we overwrite the current value with an empty
|
||||
// string. The AWS CLI and AWS SDKs will behave correctly: they treat an
|
||||
// empty string value as if the environment variable does not exist.
|
||||
core.exportVariable('AWS_ACCESS_KEY_ID', '');
|
||||
core.exportVariable('AWS_SECRET_ACCESS_KEY', '');
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
core.exportVariable('AWS_DEFAULT_REGION', '');
|
||||
core.exportVariable('AWS_REGION', '');
|
||||
} catch (error) {
|
||||
core.setFailed(errorMessage(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* c8 ignore start */
|
||||
if (require.main === module) {
|
||||
try {
|
||||
|
||||
+149
-27
@@ -1,5 +1,5 @@
|
||||
import * as core from '@actions/core';
|
||||
import type { Credentials } from '@aws-sdk/client-sts';
|
||||
import type { Credentials, STSClient } from '@aws-sdk/client-sts';
|
||||
import { GetCallerIdentityCommand } from '@aws-sdk/client-sts';
|
||||
import type { CredentialsClient } from './CredentialsClient';
|
||||
|
||||
@@ -7,25 +7,74 @@ const MAX_TAG_VALUE_LENGTH = 256;
|
||||
const SANITIZATION_CHARACTER = '_';
|
||||
const SPECIAL_CHARS_REGEX = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]+/;
|
||||
|
||||
export function translateEnvVariables() {
|
||||
const envVars = [
|
||||
'AWS_REGION',
|
||||
'ROLE_TO_ASSUME',
|
||||
'WEB_IDENTITY_TOKEN_FILE',
|
||||
'ROLE_CHAINING',
|
||||
'AUDIENCE',
|
||||
'HTTP_PROXY',
|
||||
'MASK_AWS_ACCOUNT_ID',
|
||||
'ROLE_DURATION_SECONDS',
|
||||
'ROLE_EXTERNAL_ID',
|
||||
'ROLE_SESSION_NAME',
|
||||
'ROLE_SKIP_SESSION_TAGGING',
|
||||
'INLINE_SESSION_POLICY',
|
||||
'MANAGED_SESSION_POLICIES',
|
||||
'OUTPUT_CREDENTIALS',
|
||||
'UNSET_CURRENT_CREDENTIALS',
|
||||
'DISABLE_RETRY',
|
||||
'RETRY_MAX_ATTEMPTS',
|
||||
'SPECIAL_CHARACTERS_WORKAROUND',
|
||||
'USE_EXISTING_CREDENTIALS',
|
||||
'NO_PROXY',
|
||||
];
|
||||
// Treat HTTPS_PROXY as HTTP_PROXY. Precedence is HTTPS_PROXY > HTTP_PROXY
|
||||
if (process.env.HTTPS_PROXY) process.env.HTTP_PROXY = process.env.HTTPS_PROXY;
|
||||
|
||||
for (const envVar of envVars) {
|
||||
if (process.env[envVar]) {
|
||||
const inputKey = `INPUT_${envVar.replace(/_/g, '-')}`;
|
||||
process.env[inputKey] = process.env[inputKey] || process.env[envVar];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configure the AWS CLI and AWS SDKs using environment variables and set them as secrets.
|
||||
// Setting the credentials as secrets masks them in Github Actions logs
|
||||
export function exportCredentials(creds?: Partial<Credentials>, outputCredentials?: boolean) {
|
||||
export function exportCredentials(
|
||||
creds?: Partial<Credentials>,
|
||||
outputCredentials?: boolean,
|
||||
outputEnvCredentials?: boolean,
|
||||
) {
|
||||
if (creds?.AccessKeyId) {
|
||||
core.setSecret(creds.AccessKeyId);
|
||||
core.exportVariable('AWS_ACCESS_KEY_ID', creds.AccessKeyId);
|
||||
}
|
||||
|
||||
if (creds?.SecretAccessKey) {
|
||||
core.setSecret(creds.SecretAccessKey);
|
||||
core.exportVariable('AWS_SECRET_ACCESS_KEY', creds.SecretAccessKey);
|
||||
}
|
||||
|
||||
if (creds?.SessionToken) {
|
||||
core.setSecret(creds.SessionToken);
|
||||
core.exportVariable('AWS_SESSION_TOKEN', creds.SessionToken);
|
||||
} else if (process.env.AWS_SESSION_TOKEN) {
|
||||
// clear session token from previous credentials action
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
}
|
||||
|
||||
if (outputEnvCredentials) {
|
||||
if (creds?.AccessKeyId) {
|
||||
core.exportVariable('AWS_ACCESS_KEY_ID', creds.AccessKeyId);
|
||||
}
|
||||
|
||||
if (creds?.SecretAccessKey) {
|
||||
core.exportVariable('AWS_SECRET_ACCESS_KEY', creds.SecretAccessKey);
|
||||
}
|
||||
|
||||
if (creds?.SessionToken) {
|
||||
core.exportVariable('AWS_SESSION_TOKEN', creds.SessionToken);
|
||||
} else if (process.env.AWS_SESSION_TOKEN) {
|
||||
// clear session token from previous credentials action
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
}
|
||||
}
|
||||
|
||||
if (outputCredentials) {
|
||||
@@ -38,34 +87,55 @@ export function exportCredentials(creds?: Partial<Credentials>, outputCredential
|
||||
if (creds?.SessionToken) {
|
||||
core.setOutput('aws-session-token', creds.SessionToken);
|
||||
}
|
||||
if (creds?.Expiration) {
|
||||
core.setOutput('aws-expiration', creds.Expiration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function unsetCredentials() {
|
||||
core.exportVariable('AWS_ACCESS_KEY_ID', '');
|
||||
core.exportVariable('AWS_SECRET_ACCESS_KEY', '');
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
core.exportVariable('AWS_REGION', '');
|
||||
core.exportVariable('AWS_DEFAULT_REGION', '');
|
||||
export function unsetCredentials(outputEnvCredentials?: boolean) {
|
||||
if (outputEnvCredentials) {
|
||||
core.exportVariable('AWS_ACCESS_KEY_ID', '');
|
||||
core.exportVariable('AWS_SECRET_ACCESS_KEY', '');
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
core.exportVariable('AWS_REGION', '');
|
||||
core.exportVariable('AWS_DEFAULT_REGION', '');
|
||||
}
|
||||
}
|
||||
|
||||
export function exportRegion(region: string) {
|
||||
core.exportVariable('AWS_DEFAULT_REGION', region);
|
||||
core.exportVariable('AWS_REGION', region);
|
||||
export function exportRegion(region: string, outputEnvCredentials?: boolean) {
|
||||
if (outputEnvCredentials) {
|
||||
core.exportVariable('AWS_DEFAULT_REGION', region);
|
||||
core.exportVariable('AWS_REGION', region);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getCallerIdentity(client: STSClient): Promise<{ Account: string; Arn: string; UserId?: string }> {
|
||||
const identity = await client.send(new GetCallerIdentityCommand({}));
|
||||
if (!identity.Account || !identity.Arn) {
|
||||
throw new Error('Could not get Account ID or ARN from STS. Did you set credentials?');
|
||||
}
|
||||
const result: { Account: string; Arn: string; UserId?: string } = {
|
||||
Account: identity.Account,
|
||||
Arn: identity.Arn,
|
||||
};
|
||||
if (identity.UserId !== undefined) {
|
||||
result.UserId = identity.UserId;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Obtains account ID from STS Client and sets it as output
|
||||
export async function exportAccountId(credentialsClient: CredentialsClient, maskAccountId?: boolean) {
|
||||
const client = credentialsClient.stsClient;
|
||||
const identity = await client.send(new GetCallerIdentityCommand({}));
|
||||
const identity = await getCallerIdentity(credentialsClient.stsClient);
|
||||
const accountId = identity.Account;
|
||||
if (!accountId) {
|
||||
throw new Error('Could not get Account ID from STS. Did you set credentials?');
|
||||
}
|
||||
const arn = identity.Arn;
|
||||
if (maskAccountId) {
|
||||
core.setSecret(accountId);
|
||||
core.setSecret(arn);
|
||||
}
|
||||
core.setOutput('aws-account-id', accountId);
|
||||
core.setOutput('authenticated-arn', arn);
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@@ -122,16 +192,26 @@ export async function retryAndBackoff<T>(
|
||||
return await fn();
|
||||
} catch (err) {
|
||||
if (!isRetryable) {
|
||||
core.debug(`retryAndBackoff: error is not retryable: ${errorMessage(err)}`);
|
||||
throw err;
|
||||
}
|
||||
// It's retryable, so sleep and retry.
|
||||
await sleep(Math.random() * (2 ** retries * base));
|
||||
// biome-ignore lint/style/noParameterAssign: This is a loop variable
|
||||
retries += 1;
|
||||
if (retries >= maxRetries) {
|
||||
const delay = Math.random() * (2 ** retries * base);
|
||||
const nextRetry = retries + 1;
|
||||
|
||||
core.debug(
|
||||
`retryAndBackoff: attempt ${nextRetry} of ${maxRetries} failed: ${errorMessage(err)}. ` +
|
||||
`Retrying after ${Math.floor(delay)}ms.`,
|
||||
);
|
||||
|
||||
await sleep(delay);
|
||||
|
||||
if (nextRetry >= maxRetries) {
|
||||
core.debug('retryAndBackoff: reached max retries; giving up.');
|
||||
throw err;
|
||||
}
|
||||
return await retryAndBackoff(fn, isRetryable, maxRetries, retries, base);
|
||||
|
||||
return await retryAndBackoff(fn, isRetryable, maxRetries, nextRetry, base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,3 +224,45 @@ export function isDefined<T>(i: T | undefined | null): i is T {
|
||||
return i !== undefined && i !== null;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
|
||||
export async function areCredentialsValid(credentialsClient: CredentialsClient) {
|
||||
const client = credentialsClient.stsClient;
|
||||
try {
|
||||
const identity = await client.send(new GetCallerIdentityCommand({}));
|
||||
if (identity.Account) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Like core.getBooleanInput, but respects the required option.
|
||||
*
|
||||
* From https://github.com/actions/toolkit/blob/6876e2a664ec02908178087905b9155e9892a437/packages/core/src/core.ts
|
||||
*
|
||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||
* The return value is also in boolean type.
|
||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See core.InputOptions. Also supports optional 'default' if the input is not set
|
||||
* @returns boolean
|
||||
*/
|
||||
export function getBooleanInput(name: string, options?: core.InputOptions & { default?: boolean }): boolean {
|
||||
const trueValue = ['true', 'True', 'TRUE'];
|
||||
const falseValue = ['false', 'False', 'FALSE'];
|
||||
const optionsWithoutDefault = { ...options };
|
||||
delete optionsWithoutDefault.default;
|
||||
const val = core.getInput(name, optionsWithoutDefault);
|
||||
if (trueValue.includes(val)) return true;
|
||||
if (falseValue.includes(val)) return false;
|
||||
if (val === '') return options?.default ?? false;
|
||||
throw new TypeError(
|
||||
`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
||||
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``,
|
||||
);
|
||||
}
|
||||
|
||||
+84
-54
@@ -1,13 +1,16 @@
|
||||
import * as core from '@actions/core';
|
||||
import type { AssumeRoleCommandOutput } from '@aws-sdk/client-sts';
|
||||
import { CredentialsClient } from './CredentialsClient';
|
||||
import { assumeRole } from './assumeRole';
|
||||
import { CredentialsClient } from './CredentialsClient';
|
||||
import {
|
||||
areCredentialsValid,
|
||||
errorMessage,
|
||||
exportAccountId,
|
||||
exportCredentials,
|
||||
exportRegion,
|
||||
getBooleanInput,
|
||||
retryAndBackoff,
|
||||
translateEnvVariables,
|
||||
unsetCredentials,
|
||||
verifyKeys,
|
||||
} from './helpers';
|
||||
@@ -18,65 +21,70 @@ const REGION_REGEX = /^[a-z0-9-]+$/g;
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
translateEnvVariables();
|
||||
// Get inputs
|
||||
// Undefined inputs are empty strings ( or empty arrays)
|
||||
const AccessKeyId = core.getInput('aws-access-key-id', { required: false });
|
||||
const SecretAccessKey = core.getInput('aws-secret-access-key', {
|
||||
required: false,
|
||||
});
|
||||
const sessionTokenInput = core.getInput('aws-session-token', {
|
||||
required: false,
|
||||
});
|
||||
const SecretAccessKey = core.getInput('aws-secret-access-key', { required: false });
|
||||
const sessionTokenInput = core.getInput('aws-session-token', { required: false });
|
||||
const SessionToken = sessionTokenInput === '' ? undefined : sessionTokenInput;
|
||||
const region = core.getInput('aws-region', { required: true });
|
||||
const roleToAssume = core.getInput('role-to-assume', { required: false });
|
||||
const audience = core.getInput('audience', { required: false });
|
||||
const maskAccountIdInput = core.getInput('mask-aws-account-id', { required: false }) || 'false';
|
||||
const maskAccountId = maskAccountIdInput.toLowerCase() === 'true';
|
||||
const roleExternalId = core.getInput('role-external-id', {
|
||||
required: false,
|
||||
});
|
||||
const webIdentityTokenFile = core.getInput('web-identity-token-file', {
|
||||
required: false,
|
||||
});
|
||||
const maskAccountId = getBooleanInput('mask-aws-account-id', { required: false });
|
||||
const roleExternalId = core.getInput('role-external-id', { required: false });
|
||||
const webIdentityTokenFile = core.getInput('web-identity-token-file', { required: false });
|
||||
const roleDuration =
|
||||
Number.parseInt(core.getInput('role-duration-seconds', { required: false })) || DEFAULT_ROLE_DURATION;
|
||||
const roleSessionName = core.getInput('role-session-name', { required: false }) || ROLE_SESSION_NAME;
|
||||
const roleSkipSessionTaggingInput = core.getInput('role-skip-session-tagging', { required: false }) || 'false';
|
||||
const roleSkipSessionTagging = roleSkipSessionTaggingInput.toLowerCase() === 'true';
|
||||
const proxyServer = core.getInput('http-proxy', { required: false });
|
||||
const inlineSessionPolicy = core.getInput('inline-session-policy', {
|
||||
required: false,
|
||||
const roleSkipSessionTagging = getBooleanInput('role-skip-session-tagging', { required: false });
|
||||
const proxyServer = core.getInput('http-proxy', { required: false }) || process.env.HTTP_PROXY;
|
||||
const inlineSessionPolicy = core.getInput('inline-session-policy', { required: false });
|
||||
const managedSessionPolicies = core.getMultilineInput('managed-session-policies', { required: false }).map((p) => {
|
||||
return { arn: p };
|
||||
});
|
||||
const managedSessionPoliciesInput = core.getMultilineInput('managed-session-policies', { required: false });
|
||||
const managedSessionPolicies: { arn: string }[] = [];
|
||||
const roleChainingInput = core.getInput('role-chaining', { required: false }) || 'false';
|
||||
const roleChaining = roleChainingInput.toLowerCase() === 'true';
|
||||
const outputCredentialsInput = core.getInput('output-credentials', { required: false }) || 'false';
|
||||
const outputCredentials = outputCredentialsInput.toLowerCase() === 'true';
|
||||
const unsetCurrentCredentialsInput = core.getInput('unset-current-credentials', { required: false }) || 'false';
|
||||
const unsetCurrentCredentials = unsetCurrentCredentialsInput.toLowerCase() === 'true';
|
||||
const disableRetryInput = core.getInput('disable-retry', { required: false }) || 'false';
|
||||
let disableRetry = disableRetryInput.toLowerCase() === 'true';
|
||||
const specialCharacterWorkaroundInput =
|
||||
core.getInput('special-characters-workaround', { required: false }) || 'false';
|
||||
const specialCharacterWorkaround = specialCharacterWorkaroundInput.toLowerCase() === 'true';
|
||||
const roleChaining = getBooleanInput('role-chaining', { required: false });
|
||||
const outputCredentials = getBooleanInput('output-credentials', { required: false });
|
||||
const outputEnvCredentials = getBooleanInput('output-env-credentials', { required: false, default: true });
|
||||
const unsetCurrentCredentials = getBooleanInput('unset-current-credentials', { required: false });
|
||||
let disableRetry = getBooleanInput('disable-retry', { required: false });
|
||||
const specialCharacterWorkaround = getBooleanInput('special-characters-workaround', { required: false });
|
||||
const useExistingCredentials = core.getInput('use-existing-credentials', { required: false });
|
||||
let maxRetries = Number.parseInt(core.getInput('retry-max-attempts', { required: false })) || 12;
|
||||
switch (true) {
|
||||
case specialCharacterWorkaround:
|
||||
// 😳
|
||||
disableRetry = false;
|
||||
maxRetries = 12;
|
||||
break;
|
||||
case maxRetries < 1:
|
||||
maxRetries = 1;
|
||||
break;
|
||||
const expectedAccountIds = core
|
||||
.getInput('allowed-account-ids', { required: false })
|
||||
.split(',')
|
||||
.map((s) => s.trim());
|
||||
const forceSkipOidc = getBooleanInput('force-skip-oidc', { required: false });
|
||||
const noProxy = core.getInput('no-proxy', { required: false });
|
||||
const globalTimeout = Number.parseInt(core.getInput('action-timeout-s', { required: false })) || 0;
|
||||
|
||||
let timeoutId: NodeJS.Timeout | undefined;
|
||||
if (globalTimeout > 0) {
|
||||
core.info(`Setting a global timeout of ${globalTimeout} seconds for the action`);
|
||||
timeoutId = setTimeout(() => {
|
||||
core.setFailed(`Action timed out after ${globalTimeout} seconds`);
|
||||
process.exit(1);
|
||||
}, globalTimeout * 1000);
|
||||
}
|
||||
for (const managedSessionPolicy of managedSessionPoliciesInput) {
|
||||
managedSessionPolicies.push({ arn: managedSessionPolicy });
|
||||
|
||||
if (forceSkipOidc && roleToAssume && !AccessKeyId && !webIdentityTokenFile) {
|
||||
throw new Error(
|
||||
"If 'force-skip-oidc' is true and 'role-to-assume' is set, 'aws-access-key-id' or 'web-identity-token-file' must be set",
|
||||
);
|
||||
}
|
||||
|
||||
if (specialCharacterWorkaround) {
|
||||
// 😳
|
||||
disableRetry = false;
|
||||
maxRetries = 12;
|
||||
} else if (maxRetries < 1) {
|
||||
maxRetries = 1;
|
||||
}
|
||||
|
||||
// Logic to decide whether to attempt to use OIDC or not
|
||||
const useGitHubOIDCProvider = () => {
|
||||
if (forceSkipOidc) return false;
|
||||
// The `ACTIONS_ID_TOKEN_REQUEST_TOKEN` environment variable is set when the `id-token` permission is granted.
|
||||
// This is necessary to authenticate with OIDC, but not strictly set just for OIDC. If it is not set and all other
|
||||
// checks pass, it is likely but not guaranteed that the user needs but lacks this permission in their workflow.
|
||||
@@ -103,19 +111,33 @@ export async function run() {
|
||||
};
|
||||
|
||||
if (unsetCurrentCredentials) {
|
||||
unsetCredentials();
|
||||
unsetCredentials(outputEnvCredentials);
|
||||
}
|
||||
|
||||
if (!region.match(REGION_REGEX)) {
|
||||
throw new Error(`Region is not valid: ${region}`);
|
||||
}
|
||||
exportRegion(region);
|
||||
exportRegion(region, outputEnvCredentials);
|
||||
|
||||
// Instantiate credentials client
|
||||
const credentialsClient = new CredentialsClient({ region, proxyServer });
|
||||
const clientProps: { region: string; proxyServer?: string; noProxy?: string } = { region };
|
||||
if (proxyServer) clientProps.proxyServer = proxyServer;
|
||||
if (noProxy) clientProps.noProxy = noProxy;
|
||||
const credentialsClient = new CredentialsClient(clientProps);
|
||||
let sourceAccountId: string;
|
||||
let webIdentityToken: string;
|
||||
|
||||
//if the user wants to attempt to use existing credentials, check if we have some already
|
||||
if (useExistingCredentials) {
|
||||
const validCredentials = await areCredentialsValid(credentialsClient);
|
||||
if (validCredentials) {
|
||||
core.notice('Pre-existing credentials are valid. No need to generate new ones.');
|
||||
if (timeoutId) clearTimeout(timeoutId);
|
||||
return;
|
||||
}
|
||||
core.notice('No valid credentials exist. Running as normal.');
|
||||
}
|
||||
|
||||
// If OIDC is being used, generate token
|
||||
// Else, export credentials provided as input
|
||||
if (useGitHubOIDCProvider()) {
|
||||
@@ -138,10 +160,10 @@ export async function run() {
|
||||
// Plus, in the assume role case, if the AssumeRole call fails, we want
|
||||
// the source credentials to already be masked as secrets
|
||||
// in any error messages.
|
||||
exportCredentials({ AccessKeyId, SecretAccessKey, SessionToken });
|
||||
exportCredentials({ AccessKeyId, SecretAccessKey, SessionToken }, outputCredentials, outputEnvCredentials);
|
||||
} else if (!webIdentityTokenFile && !roleChaining) {
|
||||
// Proceed only if credentials can be picked up
|
||||
await credentialsClient.validateCredentials();
|
||||
await credentialsClient.validateCredentials(undefined, roleChaining, expectedAccountIds);
|
||||
sourceAccountId = await exportAccountId(credentialsClient, maskAccountId);
|
||||
}
|
||||
|
||||
@@ -149,7 +171,7 @@ export async function run() {
|
||||
// Validate that the SDK can actually pick up credentials.
|
||||
// This validates cases where this action is using existing environment credentials,
|
||||
// and cases where the user intended to provide input credentials but the secrets inputs resolved to empty strings.
|
||||
await credentialsClient.validateCredentials(AccessKeyId, roleChaining);
|
||||
await credentialsClient.validateCredentials(AccessKeyId, roleChaining, expectedAccountIds);
|
||||
sourceAccountId = await exportAccountId(credentialsClient, maskAccountId);
|
||||
}
|
||||
|
||||
@@ -178,23 +200,31 @@ export async function run() {
|
||||
);
|
||||
} while (specialCharacterWorkaround && !verifyKeys(roleCredentials.Credentials));
|
||||
core.info(`Authenticated as assumedRoleId ${roleCredentials.AssumedRoleUser?.AssumedRoleId}`);
|
||||
exportCredentials(roleCredentials.Credentials, outputCredentials);
|
||||
exportCredentials(roleCredentials.Credentials, outputCredentials, outputEnvCredentials);
|
||||
// We need to validate the credentials in 2 of our use-cases
|
||||
// First: self-hosted runners. If the GITHUB_ACTIONS environment variable
|
||||
// is set to `true` then we are NOT in a self-hosted runner.
|
||||
// Second: Customer provided credentials manually (IAM User keys stored in GH Secrets)
|
||||
if (!process.env.GITHUB_ACTIONS || AccessKeyId) {
|
||||
await credentialsClient.validateCredentials(roleCredentials.Credentials?.AccessKeyId);
|
||||
await credentialsClient.validateCredentials(
|
||||
roleCredentials.Credentials?.AccessKeyId,
|
||||
roleChaining,
|
||||
expectedAccountIds,
|
||||
);
|
||||
}
|
||||
if (outputEnvCredentials) {
|
||||
await exportAccountId(credentialsClient, maskAccountId);
|
||||
}
|
||||
await exportAccountId(credentialsClient, maskAccountId);
|
||||
} else {
|
||||
core.info('Proceeding with IAM user credentials');
|
||||
}
|
||||
|
||||
// Clear timeout on successful completion
|
||||
if (timeoutId) clearTimeout(timeoutId);
|
||||
} catch (error) {
|
||||
core.setFailed(errorMessage(error));
|
||||
|
||||
const showStackTrace = process.env.SHOW_STACK_TRACE;
|
||||
|
||||
if (showStackTrace === 'true') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
import type * as http from 'node:http';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { type ProxyOptions, ProxyResolver } from '../src/ProxyResolver';
|
||||
|
||||
describe('ProxyResolver', () => {
|
||||
const mockReq = {} as http.ClientRequest;
|
||||
|
||||
test('returns http proxy for http URLs', () => {
|
||||
const options: ProxyOptions = { httpProxy: 'http://proxy:8080' };
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('http://proxy:8080');
|
||||
});
|
||||
|
||||
test('returns https proxy for https URLs', () => {
|
||||
const options: ProxyOptions = { httpsProxy: 'https://proxy:8080' };
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('https://example.com', mockReq)).toBe('https://proxy:8080');
|
||||
});
|
||||
|
||||
test('returns empty string when no proxy configured', () => {
|
||||
const resolver = new ProxyResolver({});
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('');
|
||||
});
|
||||
|
||||
test('respects noProxy setting', () => {
|
||||
const options: ProxyOptions = {
|
||||
httpProxy: 'http://proxy:8080',
|
||||
noProxy: 'example.com',
|
||||
};
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('');
|
||||
expect(resolver.getProxyForUrl('http://other.com', mockReq)).toBe('http://proxy:8080');
|
||||
});
|
||||
|
||||
test('handles invalid URLs', () => {
|
||||
const resolver = new ProxyResolver({ httpProxy: 'http://proxy:8080' });
|
||||
|
||||
expect(resolver.getProxyForUrl('invalid-url', mockReq)).toBe('');
|
||||
});
|
||||
|
||||
test('handles wildcard noProxy', () => {
|
||||
const options: ProxyOptions = {
|
||||
httpProxy: 'http://proxy:8080',
|
||||
noProxy: '*',
|
||||
};
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('');
|
||||
});
|
||||
|
||||
test('handles comma-separated noProxy list', () => {
|
||||
const options: ProxyOptions = {
|
||||
httpProxy: 'http://proxy:8080',
|
||||
noProxy: 'example.com,test.com',
|
||||
};
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('');
|
||||
expect(resolver.getProxyForUrl('http://test.com', mockReq)).toBe('');
|
||||
expect(resolver.getProxyForUrl('http://other.com', mockReq)).toBe('http://proxy:8080');
|
||||
});
|
||||
|
||||
test('handles port-specific noProxy', () => {
|
||||
const options: ProxyOptions = {
|
||||
httpProxy: 'http://proxy:8080',
|
||||
noProxy: 'example.com:80',
|
||||
};
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('');
|
||||
expect(resolver.getProxyForUrl('http://example.com:8080', mockReq)).toBe('http://proxy:8080');
|
||||
});
|
||||
|
||||
test('handles wildcard domain noProxy', () => {
|
||||
const options: ProxyOptions = {
|
||||
httpProxy: 'http://proxy:8080',
|
||||
noProxy: '*.example.com',
|
||||
};
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://sub.example.com', mockReq)).toBe('');
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('http://proxy:8080');
|
||||
expect(resolver.getProxyForUrl('http://other.com', mockReq)).toBe('http://proxy:8080');
|
||||
});
|
||||
|
||||
test('handles empty noProxy entries', () => {
|
||||
const options: ProxyOptions = {
|
||||
httpProxy: 'http://proxy:8080',
|
||||
noProxy: 'example.com, ,test.com',
|
||||
};
|
||||
const resolver = new ProxyResolver(options);
|
||||
|
||||
expect(resolver.getProxyForUrl('http://example.com', mockReq)).toBe('');
|
||||
expect(resolver.getProxyForUrl('http://test.com', mockReq)).toBe('');
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { cleanup } from '../src/cleanup';
|
||||
import * as core from '@actions/core';
|
||||
import { mockClient } from 'aws-sdk-client-mock';
|
||||
import { STSClient } from '@aws-sdk/client-sts';
|
||||
import { mockClient } from 'aws-sdk-client-mock';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { cleanup } from '../src/cleanup';
|
||||
import mocks from './mockinputs.test';
|
||||
|
||||
const mockedSTSClient = mockClient(STSClient);
|
||||
@@ -45,4 +45,9 @@ describe('Configure AWS Credentials cleanup', {}, () => {
|
||||
cleanup();
|
||||
expect(core.setFailed).toHaveBeenCalled();
|
||||
});
|
||||
it(`doesn't export credentials as empty env variables if asked not to`, {}, () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.NO_ENV_CREDS_INPUTS));
|
||||
cleanup();
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
+61
-7
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import * as helpers from '../src/helpers';
|
||||
import { beforeEach } from 'node:test';
|
||||
import * as core from '@actions/core';
|
||||
import { before, beforeEach } from 'node:test';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import * as helpers from '../src/helpers';
|
||||
|
||||
describe('Configure AWS Credentials helpers', {}, () => {
|
||||
beforeEach(() => {
|
||||
@@ -11,9 +11,9 @@ describe('Configure AWS Credentials helpers', {}, () => {
|
||||
const actor = 'actor[bot]';
|
||||
expect(helpers.sanitizeGitHubVariables(actor)).toBe('actor_bot_');
|
||||
});
|
||||
it('can sleep', {}, () => {
|
||||
it('can sleep', {}, async () => {
|
||||
const sleep = helpers.defaultSleep(10);
|
||||
expect(Promise.race([sleep, new Promise((_, reject) => setTimeout(reject, 20))])).resolves.toBe(undefined);
|
||||
await expect(Promise.race([sleep, new Promise((_, reject) => setTimeout(reject, 20))])).resolves.toBe(undefined);
|
||||
});
|
||||
it('removes special characters from workflow names', {}, () => {
|
||||
expect(helpers.sanitizeGitHubVariables('sdf234@#$%$^&*()_+{}|:"<>?')).toEqual('sdf234@__________+___:____');
|
||||
@@ -27,8 +27,12 @@ describe('Configure AWS Credentials helpers', {}, () => {
|
||||
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
|
||||
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
|
||||
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
||||
helpers.exportCredentials({ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test' }, true);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(3);
|
||||
helpers.exportCredentials(
|
||||
{ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) },
|
||||
true,
|
||||
true,
|
||||
);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
@@ -42,4 +46,54 @@ describe('Configure AWS Credentials helpers', {}, () => {
|
||||
expect(process.env.AWS_DEFAULT_REGION).toBeUndefined;
|
||||
process.env = env;
|
||||
});
|
||||
it(`won't output credentials to env if told not to`, {}, () => {
|
||||
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
|
||||
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
|
||||
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
||||
helpers.exportCredentials(
|
||||
{ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) },
|
||||
true,
|
||||
false,
|
||||
);
|
||||
helpers.unsetCredentials(false);
|
||||
helpers.exportRegion('fake-test-region', false);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('verifies credentials without special characters', {}, () => {
|
||||
expect(helpers.verifyKeys({ AccessKeyId: 'AKIATEST', SecretAccessKey: 'secretkey' })).toBe(true);
|
||||
expect(helpers.verifyKeys({ AccessKeyId: 'AKIA!@#$', SecretAccessKey: 'secret' })).toBe(false);
|
||||
expect(helpers.verifyKeys(undefined)).toBe(false);
|
||||
});
|
||||
|
||||
it('translates environment variables', {}, () => {
|
||||
process.env.AWS_REGION = 'us-east-1';
|
||||
process.env.HTTPS_PROXY = 'https://proxy:8080';
|
||||
helpers.translateEnvVariables();
|
||||
expect(process.env['INPUT_AWS-REGION']).toBe('us-east-1');
|
||||
expect(process.env.HTTP_PROXY).toBe('https://proxy:8080');
|
||||
});
|
||||
|
||||
it('handles getBooleanInput correctly', {}, () => {
|
||||
vi.spyOn(core, 'getInput').mockReturnValue('true');
|
||||
expect(helpers.getBooleanInput('test')).toBe(true);
|
||||
|
||||
vi.spyOn(core, 'getInput').mockReturnValue('false');
|
||||
expect(helpers.getBooleanInput('test')).toBe(false);
|
||||
|
||||
vi.spyOn(core, 'getInput').mockReturnValue('');
|
||||
expect(helpers.getBooleanInput('test', { default: true })).toBe(true);
|
||||
|
||||
vi.spyOn(core, 'getInput').mockReturnValue('invalid');
|
||||
expect(() => helpers.getBooleanInput('test')).toThrow();
|
||||
});
|
||||
|
||||
it('clears session token when not provided', {}, () => {
|
||||
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
||||
process.env.AWS_SESSION_TOKEN = 'old-token';
|
||||
helpers.exportCredentials({ AccessKeyId: 'test', SecretAccessKey: 'test' }, false, true);
|
||||
expect(core.exportVariable).toHaveBeenCalledWith('AWS_SESSION_TOKEN', '');
|
||||
});
|
||||
});
|
||||
|
||||
+535
-13
@@ -1,17 +1,16 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import * as core from '@actions/core';
|
||||
import {
|
||||
AssumeRoleCommand,
|
||||
AssumeRoleWithWebIdentityCommand,
|
||||
GetCallerIdentityCommand,
|
||||
STSClient,
|
||||
} from '@aws-sdk/client-sts';
|
||||
import { fs, vol } from 'memfs';
|
||||
import * as core from '@actions/core';
|
||||
import mocks from './mockinputs.test';
|
||||
import { mockClient } from 'aws-sdk-client-mock';
|
||||
import { run } from '../src/index';
|
||||
import { fs, vol } from 'memfs';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { CredentialsClient } from '../src/CredentialsClient';
|
||||
import { before } from 'node:test';
|
||||
import { run } from '../src/index';
|
||||
import mocks from './mockinputs.test';
|
||||
|
||||
const mockedSTSClient = mockClient(STSClient);
|
||||
|
||||
@@ -27,6 +26,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
vi.spyOn(core, 'setOutput').mockImplementation((_n, _v) => {});
|
||||
vi.spyOn(core, 'debug').mockImplementation((_m) => {});
|
||||
vi.spyOn(core, 'info').mockImplementation((_m) => {});
|
||||
vi.spyOn(core, 'notice').mockImplementation((_m) => {});
|
||||
// Remove any existing environment variables before each test to prevent the
|
||||
// SDK from picking them up
|
||||
process.env = { ...mocks.envs };
|
||||
@@ -47,7 +47,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.info).toHaveBeenCalledWith('Authenticated as assumedRoleId AROAFAKEASSUMEDROLEID');
|
||||
expect(core.info).toHaveBeenCalledTimes(2);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledOnce();
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSACCESSKEYID');
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSECRETACCESSKEY');
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSESSIONTOKEN');
|
||||
@@ -71,7 +71,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.info).toHaveBeenCalledWith('Authenticated as assumedRoleId AROAFAKEASSUMEDROLEID');
|
||||
expect(core.info).toHaveBeenCalledTimes(3);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledOnce();
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSACCESSKEYID');
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSECRETACCESSKEY');
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSESSIONTOKEN');
|
||||
@@ -106,7 +106,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.setSecret).toHaveBeenCalledWith('MYAWSSECRETACCESSKEY');
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(2);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledOnce();
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.info).toHaveBeenCalledWith('Proceeding with IAM user credentials');
|
||||
expect(core.info).toHaveBeenCalledOnce();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
@@ -140,7 +140,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.setSecret).toHaveBeenCalledWith('MYAWSSECRETACCESSKEY');
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(5);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.info).toHaveBeenCalledWith('Assuming role with user credentials');
|
||||
expect(core.info).toHaveBeenCalledWith('Authenticated as assumedRoleId AROAFAKEASSUMEDROLEID');
|
||||
expect(core.info).toHaveBeenCalledTimes(2);
|
||||
@@ -173,7 +173,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSESSIONTOKEN');
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(1);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -204,7 +204,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSESSIONTOKEN');
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
it('exports environment variables from inputs', {}, async () => {
|
||||
@@ -237,7 +237,7 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
expect(core.setSecret).toHaveBeenCalledWith('STSAWSSESSIONTOKEN');
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(6);
|
||||
expect(core.setOutput).toHaveBeenCalledWith('aws-account-id', '111111111111');
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(2);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -299,5 +299,527 @@ describe('Configure AWS Credentials', {}, () => {
|
||||
await run();
|
||||
expect(core.setFailed).toHaveBeenCalled();
|
||||
});
|
||||
it("gets new creds if told to reuse existing but they're invalid", {}, async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.USE_EXISTING_CREDENTIALS_INPUTS));
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).rejects();
|
||||
await run();
|
||||
expect(core.notice).toHaveBeenCalledWith('No valid credentials exist. Running as normal.');
|
||||
});
|
||||
it("doesn't get new creds if there are already valid ones and we said use them", {}, async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.USE_EXISTING_CREDENTIALS_INPUTS));
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves(mocks.outputs.GET_CALLER_IDENTITY);
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
it("doesn't export credentials as environment variables if told not to", {}, async () => {
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.NO_ENV_CREDS_INPUTS));
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
await run();
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
it('can export creds as step outputs without exporting as env variables', {}, async () => {
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.STEP_BUT_NO_ENV_INPUTS));
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
await run();
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Force Skip OIDC', {}, () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockedSTSClient.reset();
|
||||
});
|
||||
|
||||
it('skips OIDC when force-skip-oidc is true with IAM credentials', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_ASSUMEROLE_INPUTS,
|
||||
'force-skip-oidc': 'true',
|
||||
}),
|
||||
);
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(AssumeRoleCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials')
|
||||
.mockResolvedValueOnce({ accessKeyId: 'MYAWSACCESSKEYID' })
|
||||
.mockResolvedValueOnce({ accessKeyId: 'STSAWSACCESSKEYID' });
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.getIDToken).not.toHaveBeenCalled();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('skips OIDC when force-skip-oidc is true with web identity token file', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.WEBIDENTITY_TOKEN_FILE_INPUTS,
|
||||
'force-skip-oidc': 'true',
|
||||
}),
|
||||
);
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
vi.mock('node:fs');
|
||||
vol.reset();
|
||||
fs.mkdirSync('/home/github', { recursive: true });
|
||||
fs.writeFileSync('/home/github/file.txt', 'test-token');
|
||||
|
||||
await run();
|
||||
expect(core.getIDToken).not.toHaveBeenCalled();
|
||||
expect(core.info).toHaveBeenCalledWith('Assuming role with web identity token file');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('fails when force-skip-oidc is true but no alternative credentials provided', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
'force-skip-oidc': 'true',
|
||||
}),
|
||||
);
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).toHaveBeenCalledWith(
|
||||
"If 'force-skip-oidc' is true and 'role-to-assume' is set, 'aws-access-key-id' or 'web-identity-token-file' must be set",
|
||||
);
|
||||
});
|
||||
|
||||
it('allows force-skip-oidc without role-to-assume', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'force-skip-oidc': 'true',
|
||||
}),
|
||||
);
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.getIDToken).not.toHaveBeenCalled();
|
||||
expect(core.info).toHaveBeenCalledWith('Proceeding with IAM user credentials');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('uses OIDC when force-skip-oidc is false (default behavior)', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.GH_OIDC_INPUTS,
|
||||
'force-skip-oidc': 'false',
|
||||
}),
|
||||
);
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.getIDToken).toHaveBeenCalledWith('');
|
||||
expect(core.info).toHaveBeenCalledWith('Assuming role with OIDC');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('uses OIDC when force-skip-oidc is not set (default behavior)', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.GH_OIDC_INPUTS));
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.getIDToken).toHaveBeenCalledWith('');
|
||||
expect(core.info).toHaveBeenCalledWith('Assuming role with OIDC');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('works with role chaining when force-skip-oidc is true', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.EXISTING_ROLE_INPUTS,
|
||||
'force-skip-oidc': 'true',
|
||||
'aws-access-key-id': 'MYAWSACCESSKEYID',
|
||||
'aws-secret-access-key': 'MYAWSSECRETACCESSKEY',
|
||||
}),
|
||||
);
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(AssumeRoleCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials')
|
||||
.mockResolvedValueOnce({ accessKeyId: 'MYAWSACCESSKEYID' })
|
||||
.mockResolvedValueOnce({ accessKeyId: 'STSAWSACCESSKEYID' });
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.getIDToken).not.toHaveBeenCalled();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Account ID Validation', {}, () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockedSTSClient.reset();
|
||||
});
|
||||
|
||||
it('succeeds when account ID matches allowed list', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': '111111111111',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
expect(core.info).toHaveBeenCalledWith('Proceeding with IAM user credentials');
|
||||
});
|
||||
|
||||
it('succeeds with multiple allowed account IDs when account matches', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': '999999999999,111111111111,222222222222',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('fails when account ID does not match allowed list', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': '999999999999',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).toHaveBeenCalledWith(
|
||||
'The account ID of the provided credentials (111111111111) does not match any of the expected account IDs: 999999999999',
|
||||
);
|
||||
});
|
||||
|
||||
it('fails when account ID does not match any in multiple allowed accounts', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': '999999999999,888888888888',
|
||||
}),
|
||||
);
|
||||
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).toHaveBeenCalledWith(
|
||||
'The account ID of the provided credentials (111111111111) does not match any of the expected account IDs: 999999999999, 888888888888',
|
||||
);
|
||||
});
|
||||
|
||||
it('works with assume role when account ID matches', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_ASSUMEROLE_INPUTS,
|
||||
'allowed-account-ids': '111111111111',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(AssumeRoleCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials')
|
||||
.mockResolvedValueOnce({ accessKeyId: 'MYAWSACCESSKEYID' })
|
||||
.mockResolvedValueOnce({ accessKeyId: 'STSAWSACCESSKEYID' });
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
expect(core.info).toHaveBeenCalledWith('Authenticated as assumedRoleId AROAFAKEASSUMEDROLEID');
|
||||
});
|
||||
|
||||
it('works with OIDC when account ID matches', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.GH_OIDC_INPUTS,
|
||||
'allowed-account-ids': '111111111111',
|
||||
}),
|
||||
);
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolves(mocks.outputs.STS_CREDENTIALS);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
expect(core.info).toHaveBeenCalledWith('Authenticated as assumedRoleId AROAFAKEASSUMEDROLEID');
|
||||
});
|
||||
|
||||
it('handles GetCallerIdentity API failure gracefully', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': '111111111111',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).rejects(new Error('API Error'));
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).toHaveBeenCalledWith('Could not validate account ID of credentials: API Error');
|
||||
});
|
||||
|
||||
it('ignores validation when allowed-account-ids is empty', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': '',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
expect(core.info).toHaveBeenCalledWith('Proceeding with IAM user credentials');
|
||||
});
|
||||
|
||||
it('handles whitespace in allowed-account-ids input', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'allowed-account-ids': ' 111111111111 , 222222222222 ',
|
||||
}),
|
||||
);
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValue({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
|
||||
await run();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Global Timeout Configuration', {}, () => {
|
||||
beforeEach(() => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.IAM_USER_INPUTS));
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolvesOnce({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
// biome-ignore lint/suspicious/noExplicitAny: any required to mock private method
|
||||
vi.spyOn(CredentialsClient.prototype as any, 'loadCredentials').mockResolvedValueOnce({
|
||||
accessKeyId: 'MYAWSACCESSKEYID',
|
||||
});
|
||||
});
|
||||
|
||||
it('sets timeout when action-timeout-s is provided', async () => {
|
||||
const setTimeoutSpy = vi.spyOn(global, 'setTimeout');
|
||||
const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'action-timeout-s': '30',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).toHaveBeenCalledWith('Setting a global timeout of 30 seconds for the action');
|
||||
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 30000);
|
||||
expect(clearTimeoutSpy).toHaveBeenCalledWith(expect.any(Object));
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not set timeout when action-timeout-s is 0', async () => {
|
||||
const setTimeoutSpy = vi.spyOn(global, 'setTimeout');
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'action-timeout-s': '0',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).not.toHaveBeenCalledWith(expect.stringContaining('Setting a global timeout'));
|
||||
expect(setTimeoutSpy).not.toHaveBeenCalled();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not set timeout when action-timeout-s is not provided', async () => {
|
||||
const setTimeoutSpy = vi.spyOn(global, 'setTimeout');
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).not.toHaveBeenCalledWith(expect.stringContaining('Setting a global timeout'));
|
||||
expect(setTimeoutSpy).not.toHaveBeenCalled();
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('timeout callback calls setFailed and exits process', async () => {
|
||||
const setTimeoutSpy = vi.spyOn(global, 'setTimeout');
|
||||
const processExitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined as never);
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.IAM_USER_INPUTS,
|
||||
'action-timeout-s': '5',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
// Get the timeout callback function
|
||||
const timeoutCallback = setTimeoutSpy.mock.calls[0][0] as () => void;
|
||||
|
||||
// Execute the timeout callback
|
||||
timeoutCallback();
|
||||
|
||||
expect(core.setFailed).toHaveBeenCalledWith('Action timed out after 5 seconds');
|
||||
expect(processExitSpy).toHaveBeenCalledWith(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('HTTP Proxy Configuration', {}, () => {
|
||||
beforeEach(() => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.GH_OIDC_INPUTS));
|
||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||
mockedSTSClient.on(GetCallerIdentityCommand).resolvesOnce({ ...mocks.outputs.GET_CALLER_IDENTITY });
|
||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'fake-token';
|
||||
});
|
||||
|
||||
it('configures proxy from http-proxy input', async () => {
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.GH_OIDC_INPUTS,
|
||||
'http-proxy': 'http://proxy.example.com:8080',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).toHaveBeenCalledWith('Configuring proxy handler for STS client');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('configures proxy from HTTP_PROXY environment variable', async () => {
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).toHaveBeenCalledWith('Configuring proxy handler for STS client');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('configures proxy from HTTPS_PROXY environment variable', async () => {
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
process.env.HTTPS_PROXY = 'https://proxy.example.com:8080';
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).toHaveBeenCalledWith('Configuring proxy handler for STS client');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('prioritizes http-proxy input over environment variables', async () => {
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
process.env.HTTP_PROXY = 'http://env-proxy.example.com:8080';
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.GH_OIDC_INPUTS,
|
||||
'http-proxy': 'http://input-proxy.example.com:8080',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).toHaveBeenCalledWith('Configuring proxy handler for STS client');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('properly configures proxy agent in STS client', async () => {
|
||||
const infoSpy = vi.spyOn(core, 'info');
|
||||
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.GH_OIDC_INPUTS,
|
||||
'http-proxy': 'http://proxy.example.com:8080',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(infoSpy).toHaveBeenCalledWith('Configuring proxy handler for STS client');
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('configures no-proxy setting', async () => {
|
||||
vi.spyOn(core, 'getInput').mockImplementation(
|
||||
mocks.getInput({
|
||||
...mocks.GH_OIDC_INPUTS,
|
||||
'http-proxy': 'http://proxy.example.com:8080',
|
||||
'no-proxy': 'localhost,127.0.0.1',
|
||||
}),
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('works without proxy configuration', async () => {
|
||||
await run();
|
||||
|
||||
expect(core.setFailed).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,6 +27,22 @@ const inputs = {
|
||||
'role-chaining': 'true',
|
||||
'aws-region': 'fake-region-1',
|
||||
},
|
||||
USE_EXISTING_CREDENTIALS_INPUTS: {
|
||||
'aws-region': 'fake-region-1',
|
||||
'use-existing-credentials': 'true',
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
},
|
||||
NO_ENV_CREDS_INPUTS: {
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
'output-env-credentials': 'false',
|
||||
},
|
||||
STEP_BUT_NO_ENV_INPUTS: {
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
'output-env-credentials': 'false',
|
||||
'output-credentials': 'true',
|
||||
},
|
||||
};
|
||||
|
||||
const envs = {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"rootDir": "src"
|
||||
},
|
||||
}
|
||||
+7
-10
@@ -3,7 +3,7 @@
|
||||
"allowUnreachableCode": false,
|
||||
"allowUnusedLabels": false,
|
||||
"strict": true,
|
||||
"exactOptionalPropertyTypes": false,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
@@ -13,21 +13,18 @@
|
||||
"module": "CommonJS",
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "build",
|
||||
"declaration": true,
|
||||
"declaration": false,
|
||||
"newLine": "lf",
|
||||
"noEmitOnError": true,
|
||||
"sourceMap": true,
|
||||
"disableSizeLimit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": [ "ES2020" ],
|
||||
"lib": ["ES2020"],
|
||||
"target": "ES2020",
|
||||
"noErrorTruncation": true,
|
||||
"esModuleInterop": true
|
||||
"esModuleInterop": true,
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"test/**/*.test.ts"
|
||||
],
|
||||
"exclude": [],
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**/*.ts"]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["test/**/*.ts", "src/**/*.ts"],
|
||||
"exclude": [],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./"
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,6 @@ export default defineConfig({
|
||||
passWithNoTests: true,
|
||||
include: ['test/**/*.test.ts'],
|
||||
coverage: { enabled: true },
|
||||
typecheck: { tsconfig: './tsconfig.test.json' },
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user