mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-08-25 04:35:06 +09:00
Compare commits
394 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 4fc4975a85 | |||
| 47ce154311 | |||
| d700acbb22 | |||
| ca00fd4d38 | |||
| 0f88004d9c | |||
| f171d5c895 | |||
| 2c187c9a63 | |||
| 97834a484a | |||
| 16ffc4e9d9 | |||
| b47a85173f | |||
| 7ec02fdd4f | |||
| bfd218503e | |||
| 83b5a56547 | |||
| ccbdafa425 | |||
| d90c1f89e1 | |||
| 8ce5662dcb | |||
| 132df1605a | |||
| c3eecb10dc | |||
| b06d1612cc | |||
| 3610e7477c | |||
| 2cefa29f87 | |||
| a70163716a | |||
| 074f3e3ed6 | |||
| cfdc9e618a | |||
| f0b286ee81 | |||
| 978afc099f | |||
| 73daff1b20 | |||
| a9a462e707 | |||
| c02032282e | |||
| 050bf7aae9 | |||
| 1ff999ed11 | |||
| cf0a0ec4cc | |||
| f9195c8403 | |||
| da5122d981 | |||
| aab03b4eeb | |||
| 909c963c25 | |||
| 35f8f79dc2 | |||
| e402f5e2c3 | |||
| 45d446aaa3 | |||
| 835806a903 | |||
| bd1354327e | |||
| 1ceaabc2d4 | |||
| 2ecdac5a31 | |||
| 21013c6ea2 | |||
| 1c492975ae | |||
| e46110bca8 | |||
| 17842ca385 | |||
| e26e190428 | |||
| 0fc95ed935 | |||
| d23081dda5 | |||
| 3ce4859d07 | |||
| 779816abba | |||
| ead1e6af28 | |||
| 55f725fcb5 | |||
| 39228ca2bf | |||
| 8179d389e2 | |||
| 9edadd368f | |||
| e57d9b2db1 | |||
| 3802ea987a | |||
| 12e3392609 | |||
| 46b3b9326a | |||
| c6bba96e8b | |||
| ca8fe1c3f8 | |||
| 6116f2b953 | |||
| 02217eeb8c | |||
| 1ef78072ef | |||
| 1dc2e06aed | |||
| 96589f5dfc | |||
| 66cc13c21a | |||
| 89b4925657 | |||
| b6cea2df1f | |||
| febab93d02 | |||
| 556dab0aae | |||
| 884bdab0d8 | |||
| 6c6ac55798 | |||
| af7e7d4f5c | |||
| a5e454b255 | |||
| 9fc3c1681a | |||
| b4ffe2aa11 | |||
| 1b9c66a165 | |||
| 7e510d6542 | |||
| 61a110527d | |||
| 826aaf0064 | |||
| 294a79b668 | |||
| 994ed19d9f | |||
| 2e63828dd3 | |||
| c7680c3252 | |||
| c03b90f3c2 | |||
| cf3f053829 | |||
| bd07581024 | |||
| bb85fe0f29 | |||
| 29d24b9c2f | |||
| 7bcde6a7fc | |||
| e79c24214a | |||
| 43c891271e | |||
| db27a042ea | |||
| fff2104678 | |||
| b7b582623b | |||
| 045613fde5 | |||
| 1a40b8cd5a | |||
| 09f4416695 | |||
| ffc9011218 | |||
| a78e788c51 | |||
| f36b88236d | |||
| 6f06e4dfb7 | |||
| f2e29018a3 | |||
| c458ab2cb0 | |||
| aca3ce3e45 | |||
| e9cf1db62a | |||
| ad2daec542 | |||
| 4397372e5c | |||
| 0f2f0dac6a | |||
| 587276aa2b | |||
| dd3458040d | |||
| db5bf1fe97 | |||
| a955e86dca | |||
| f2e859a9be | |||
| cb66b82ec8 | |||
| 9a9e6b7961 | |||
| 4fe8125b4f | |||
| 18f29abc49 | |||
| 69786f15ae | |||
| d234546a96 | |||
| 773f9c2d3f | |||
| d0421aed0f | |||
| 304d8d7e94 | |||
| e0fc2428cc | |||
| 1b1cca71d5 | |||
| 3f2fb6dc54 | |||
| a3cf0463b1 | |||
| d29f260a27 | |||
| 5c47d180b4 | |||
| 7f3226aee9 | |||
| 3bd0e77022 | |||
| 2ec0c7d68f | |||
| 858acd4186 | |||
| a206705a9c | |||
| 8a3c6172d2 | |||
| b140ab7b24 | |||
| 16efdbdbee | |||
| ce974c0f53 | |||
| 75ac214068 | |||
| 859ce83a76 | |||
| e821ee1878 | |||
| c754bf3531 | |||
| 0a785df9d6 | |||
| 5393920a08 | |||
| 72072f2ea6 | |||
| dc381ded38 | |||
| 8b493da9a6 | |||
| 03de6e7db9 | |||
| 75a5a83a24 | |||
| 2e34541e3b | |||
| a5dceb9b44 | |||
| f6445e06fc | |||
| 40c1389cab | |||
| 01c96af67c | |||
| 486457dc46 | |||
| e3dd6a429d | |||
| c6c400fca4 | |||
| c38ab417a3 | |||
| 2071ebe8a6 | |||
| 44112af7fc | |||
| 492c455782 | |||
| 13e074e8f2 | |||
| 5a676ce81e | |||
| e43a696754 | |||
| eb98af56d5 | |||
| a3c5dd2542 | |||
| 0bd285c4bc | |||
| 2119c3b075 | |||
| 07a8ea5f5a | |||
| 70e62de715 | |||
| 2319a89145 | |||
| 6956a71853 | |||
| ec22c895de | |||
| b7005563a6 | |||
| 9bca4288d8 | |||
| f945fa0a83 | |||
| 84ca8797c4 | |||
| ba029e74a9 | |||
| f0e4044a3c | |||
| 122203e88a | |||
| a3b1b77678 | |||
| ad6ca71e8d | |||
| a7e8a89908 | |||
| e250046fbb | |||
| a30bce87e0 | |||
| dca3818681 | |||
| 9f96a62d52 | |||
| 3cb3bf0095 | |||
| 9c0b2871d4 | |||
| 6e4af399de | |||
| c3ef853d76 | |||
| 59816a5350 | |||
| 32eebaca97 | |||
| 5327a0856f | |||
| 09698e3cea | |||
| 90d9aa46ae | |||
| 97bb7c6f07 | |||
| f749619a9b | |||
| 0ac17889e0 | |||
| b869ebdc58 | |||
| c717194ceb | |||
| 35b4008f8f | |||
| 37ecf4fbc7 | |||
| 1c6511baff | |||
| 9d8e57c0d9 | |||
| a6effa60e1 | |||
| 6129f329e6 | |||
| 0d2b0aeb3e | |||
| 072214f33c | |||
| c6d659a7a6 | |||
| 189f0d36c9 | |||
| dc2fab50ae | |||
| 7ca194810a | |||
| d949774e13 | |||
| 888a363842 | |||
| 8525ed299e | |||
| a3eb21e817 | |||
| 5b4e5446b4 | |||
| 8a62607f2e | |||
| b7c230fa4e | |||
| 90cd6b2dfa | |||
| e5170cf58c | |||
| cd299def7b | |||
| 8cc39946cb | |||
| 8b1e0b8ceb | |||
| e18f32a64a | |||
| 90a38202c9 | |||
| fba7546d2e | |||
| 8b0d1efc6a | |||
| 91b74540ba | |||
| f8e37234b2 | |||
| 46d4327865 | |||
| 0a640cb1ea | |||
| 3e19f1cabc | |||
| 41b08e5079 | |||
| 16f170c61f | |||
| 848e088e68 | |||
| d1892e5ca0 | |||
| a4d92546ef | |||
| 3a23e8d51e | |||
| eb2eeb6916 | |||
| e6c766a518 | |||
| c452cdabc6 | |||
| d7edf5202e | |||
| 57806dc9dc | |||
| 342788401b | |||
| e31c779480 | |||
| 20f218d030 | |||
| 2dbd7dd8d8 | |||
| 43312bc545 | |||
| ada31760af | |||
| 14d98c717c | |||
| b6768fa48a | |||
| ca9cb67cf8 | |||
| e49c9972c2 | |||
| dccdfaee7e | |||
| 837b5c8e7e | |||
| d5dadc6a5e | |||
| fa3da08deb | |||
| f427477498 | |||
| feab0f2d40 | |||
| 78aae820bb | |||
| 010d0da01d | |||
| b48e2ee5c6 | |||
| 183b94a269 | |||
| 1d4ae371e5 | |||
| 6a430ce1a4 | |||
| 8402193770 | |||
| f31c158843 | |||
| 164817a8f8 | |||
| e2c335e163 | |||
| a1a09b7ff2 | |||
| 53bf02c02f | |||
| 6960539309 | |||
| 83ceb16ee1 | |||
| 5cb52d02e4 | |||
| fbaaea8490 | |||
| 0d9b446851 | |||
| 51e898662e | |||
| dc894b4148 | |||
| 4f8ea089cf | |||
| ff5c452440 | |||
| 96cd64d434 | |||
| 3d11655d76 | |||
| e50f96d7c7 | |||
| 8025ae060f | |||
| bc2200e43c | |||
| 155b315cee | |||
| 59d2ad0a59 | |||
| 1067f72d75 | |||
| 393929845e | |||
| 8c3f20df09 | |||
| 50ac8dd1e1 | |||
| a2593d09d1 | |||
| 7a8dec84bd | |||
| 2b89f8a0da | |||
| 6488aec6e7 | |||
| 856a411d27 | |||
| 7e7ee94419 | |||
| 8ad39aa824 | |||
| 2014030530 | |||
| 3aeb7ba662 | |||
| 3994f1aeae | |||
| a3412312b9 | |||
| ef2571b57d | |||
| 8e373defe9 | |||
| 9555344752 | |||
| 72f2c7b9a3 | |||
| b0cb02aa90 | |||
| 7bac5f98a7 | |||
| 922470e4ee | |||
| d3c2317d0a | |||
| f0ede74cf3 | |||
| 8afcd6259e | |||
| 84a8fd5e77 | |||
| d78f55b1db | |||
| 6c962b9fd3 | |||
| 14b6c355ca | |||
| 22617f9706 | |||
| 622237c36a | |||
| 014a5f9adc | |||
| 44cffa5fa8 | |||
| 19f0360930 | |||
| fd194eccd1 | |||
| 7f32242eff | |||
| 7e430f7278 |
@@ -1,2 +0,0 @@
|
||||
build
|
||||
dist
|
||||
-168
@@ -1,168 +0,0 @@
|
||||
env:
|
||||
jest: true
|
||||
node: true
|
||||
root: true
|
||||
plugins:
|
||||
- import
|
||||
- prettier
|
||||
parserOptions:
|
||||
ecmaVersion: 2021
|
||||
sourceType: module
|
||||
extends:
|
||||
- plugin:prettier/recommended
|
||||
- prettier
|
||||
rules:
|
||||
prettier/prettier: [error]
|
||||
import/no-extraneous-dependencies:
|
||||
- error
|
||||
- devDependencies:
|
||||
- "**/test/**"
|
||||
- "**/build-tools/**"
|
||||
optionalDependencies: false
|
||||
peerDependencies: true
|
||||
import/no-unresolved: [error]
|
||||
import/order:
|
||||
- warn
|
||||
- groups:
|
||||
- builtin
|
||||
- external
|
||||
alphabetize:
|
||||
order: asc
|
||||
caseInsensitive: true
|
||||
array-callback-return: [warn]
|
||||
no-await-in-loop: [warn]
|
||||
no-constant-binary-expression: [error]
|
||||
no-constructor-return: [error]
|
||||
no-duplicate-imports: [error]
|
||||
no-self-compare: [warn]
|
||||
no-template-curly-in-string: [error]
|
||||
no-unmodified-loop-condition: [error]
|
||||
no-unreachable-loop: [error]
|
||||
no-unused-private-class-members: [error]
|
||||
no-use-before-define: [error]
|
||||
require-atomic-updates: [error]
|
||||
block-scoped-var: [warn]
|
||||
camelcase: [warn]
|
||||
class-methods-use-this: [error]
|
||||
consistent-return: [warn]
|
||||
consistent-this: [warn]
|
||||
default-case-last: [warn]
|
||||
default-param-last: [warn]
|
||||
dot-notation: [error]
|
||||
eqeqeq: [error]
|
||||
guard-for-in: [warn]
|
||||
logical-assignment-operators:
|
||||
- error
|
||||
- always
|
||||
- enforceForIfStatements: false
|
||||
no-array-constructor: [error]
|
||||
no-bitwise: [error]
|
||||
no-console: [warn]
|
||||
no-empty-function: [warn]
|
||||
no-eval: [error]
|
||||
no-extra-bind: [error]
|
||||
no-labels: [error]
|
||||
no-implicit-globals: [error]
|
||||
no-invalid-this: [error]
|
||||
key-spacing: [error]
|
||||
no-multiple-empty-lines: [error]
|
||||
no-return-await: [warn]
|
||||
no-trailing-spaces: [error]
|
||||
no-lonely-if: [error]
|
||||
no-nested-ternary: [warn]
|
||||
no-mixed-operators: [warn]
|
||||
no-proto: [error]
|
||||
no-sequences: [error]
|
||||
no-throw-literal: [error]
|
||||
no-useless-call: [error]
|
||||
no-useless-concat: [warn]
|
||||
no-var: [error]
|
||||
one-var-declaration-per-line: [error]
|
||||
prefer-const: [warn]
|
||||
prefer-arrow-callback: [warn]
|
||||
prefer-regex-literals: [warn]
|
||||
prefer-promise-reject-errors: [warn]
|
||||
prefer-spread: [warn]
|
||||
prefer-template: [warn]
|
||||
require-await: [error]
|
||||
overrides:
|
||||
- files:
|
||||
- '**/*.ts'
|
||||
parser: '@typescript-eslint/parser'
|
||||
parserOptions:
|
||||
ecmaVersion: 2021
|
||||
sourceType: module
|
||||
project: ./tsconfig.json
|
||||
extends:
|
||||
- plugin:@typescript-eslint/recommended
|
||||
- plugin:@typescript-eslint/recommended-requiring-type-checking
|
||||
- plugin:import/typescript
|
||||
rules:
|
||||
'@typescript-eslint/array-type':
|
||||
- warn
|
||||
- default: array-simple
|
||||
'@typescript-eslint/ban-tslint-comment': [error]
|
||||
'@typescript-eslint/consistent-indexed-object-style': [warn]
|
||||
'@typescript-eslint/consistent-type-assertions': [warn]
|
||||
'@typescript-eslint/prefer-includes': [warn]
|
||||
dot-notation: [off]
|
||||
'@typescript-eslint/dot-notation': [error]
|
||||
'@typescript-eslint/no-explicit-any': [off]
|
||||
'@typescript-eslint/consistent-type-exports': [warn]
|
||||
'@typescript-eslint/consistent-type-imports': [warn]
|
||||
'@typescript-eslint/no-base-to-string': [error]
|
||||
'@typescript-eslint/no-confusing-non-null-assertion': [warn]
|
||||
'@typescript-eslint/no-invalid-void-type': [error]
|
||||
'@typescript-eslint/no-meaningless-void-operator': [warn]
|
||||
'@typescript-eslint/no-redundant-type-constituents': [warn]
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': [warn]
|
||||
'@typescript-eslint/no-unnecessary-condition': [warn]
|
||||
'@typescript-eslint/no-unnecessary-qualifier': [warn]
|
||||
'@typescript-eslint/no-unnecessary-type-arguments': [warn]
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': [warn]
|
||||
'@typescript-eslint/prefer-for-of': [error]
|
||||
'@typescript-eslint/prefer-literal-enum-member': [warn]
|
||||
'@typescript-eslint/prefer-optional-chain': [warn]
|
||||
'@typescript-eslint/prefer-readonly': [warn]
|
||||
'@typescript-eslint/prefer-regexp-exec': [warn]
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': [warn]
|
||||
'@typescript-eslint/prefer-ts-expect-error': [error]
|
||||
'@typescript-eslint/promise-function-async': [warn]
|
||||
'@typescript-eslint/require-array-sort-compare': [error]
|
||||
default-param-last: [off]
|
||||
'@typescript-eslint/default-param-last': [warn]
|
||||
no-array-constructor: [off]
|
||||
'@typescript-eslint/no-array-constructor': [error]
|
||||
no-dupe-class-members: [off]
|
||||
'@typescript-eslint/no-dupe-class-members': [warn]
|
||||
no-invalid-this: [off]
|
||||
'@typescript-eslint/no-invalid-this': [warn]
|
||||
no-unused-vars: [off]
|
||||
'@typescript-eslint/no-unused-vars':
|
||||
- error
|
||||
- varsIgnorePattern: '^_'
|
||||
argsIgnorePattern: '^_'
|
||||
caughtErrorsIgnorePattern: '^_'
|
||||
'@typescript-eslint/no-non-null-assertion': [off]
|
||||
'@typescript-eslint/no-require-imports':
|
||||
- error
|
||||
no-return-await: [off]
|
||||
'@typescript-eslint/return-await': [error]
|
||||
no-shadow: [off]
|
||||
'@typescript-eslint/no-shadow': [error]
|
||||
'@typescript-eslint/no-floating-promises': [error]
|
||||
"@typescript-eslint/member-ordering":
|
||||
- error
|
||||
- default:
|
||||
- public-static-field
|
||||
- public-static-method
|
||||
- protected-static-field
|
||||
- protected-static-method
|
||||
- private-static-field
|
||||
- private-static-method
|
||||
- field
|
||||
- constructor
|
||||
- method
|
||||
no-use-before-define: [off]
|
||||
'@typescript-eslint/no-use-before-define': [error]
|
||||
no-duplicate-imports: [off]
|
||||
@@ -12,6 +12,14 @@ body:
|
||||
description: What is the problem? A clear and concise description of the bug.
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: regression
|
||||
attributes:
|
||||
label: Regression Issue
|
||||
description: What is a regression? If it worked in a previous version but doesn't in the latest version, it's considered a regression. In this case, please provide specific version number in the report.
|
||||
options:
|
||||
- label: Select this option if this issue appears to be a regression.
|
||||
required: false
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
on:
|
||||
pull_request_review:
|
||||
types: submitted
|
||||
|
||||
jobs:
|
||||
approved_pr:
|
||||
name: Automerge approved PRs
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
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
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
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
|
||||
- name: Enable PR automerge
|
||||
run: gh pr merge --auto --squash "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GITHUB_TOKEN: ${{ env.OSDS_ACCESS_TOKEN }}
|
||||
@@ -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
|
||||
@@ -0,0 +1,51 @@
|
||||
name: "Close Stale Issues"
|
||||
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 */4 * * *"
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
permissions:
|
||||
issues: write
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
name: Stale issue job
|
||||
steps:
|
||||
- uses: aws-actions/stale-issue-cleanup@v6
|
||||
with:
|
||||
# Setting messages to an empty string will cause the automation to skip
|
||||
# that category
|
||||
ancient-issue-message: This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
|
||||
stale-issue-message: This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
|
||||
stale-pr-message: This PR has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
|
||||
|
||||
# These labels are required
|
||||
stale-issue-label: closing-soon
|
||||
exempt-issue-labels: no-autoclose
|
||||
stale-pr-label: closing-soon
|
||||
exempt-pr-labels: no-autoclose
|
||||
response-requested-label: response-requested
|
||||
|
||||
# Don't set closed-for-staleness label to skip closing very old issues
|
||||
# regardless of label
|
||||
closed-for-staleness-label: closed-for-staleness
|
||||
|
||||
# Issue timing
|
||||
days-before-stale: 5
|
||||
days-before-close: 2
|
||||
days-before-ancient: 36500
|
||||
|
||||
# If you don't want to mark a issue as being ancient based on a
|
||||
# threshold of "upvotes", you can set this here. An "upvote" is
|
||||
# the total number of +1, heart, hooray, and rocket reactions
|
||||
# on an issue.
|
||||
minimum-upvotes-to-exempt: 5
|
||||
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
loglevel: DEBUG
|
||||
# Set dry-run to true to not perform label or close actions.
|
||||
dry-run: false
|
||||
@@ -13,7 +13,5 @@ jobs:
|
||||
# These inputs are both required
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
message: |
|
||||
** Note **
|
||||
Comments on closed issues are hard for our team to see.
|
||||
If you need more assistance, please either tag a team member or open a new issue that references this one.
|
||||
If you wish to keep having a conversation with other community members under this issue feel free to do so.
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Dependabot auto-approve
|
||||
on:
|
||||
pull_request:
|
||||
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-actions/configure-aws-credentials' }}
|
||||
steps:
|
||||
- name: Get Metadata
|
||||
id: dependabot-metadata
|
||||
uses: dependabot/fetch-metadata@v2
|
||||
- uses: actions/checkout@v4
|
||||
name: Clone repo
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: arn:aws:iam::206735643321:role/ConfigureAwsCredentialsPackageRole
|
||||
role-duration-seconds: 900
|
||||
- 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
|
||||
- name: Approve PR if not already approved
|
||||
run: |
|
||||
gh pr checkout "$PR_URL"
|
||||
if [ "$(gh pr status --json reviewDecision - q .currentBranch.reviewDecision)" != "APPROVED" ]; then
|
||||
gh pr review "$PR_URL" --approve
|
||||
else echo "PR already approved"
|
||||
fi
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GITHUB_TOKEN: ${{ env.OSDS_ACCESS_TOKEN }}
|
||||
@@ -0,0 +1,32 @@
|
||||
# Apply potential regression label on issues
|
||||
name: issue-regression-label
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
jobs:
|
||||
add-regression-label:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Fetch template body
|
||||
id: check_regression
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TEMPLATE_BODY: ${{ github.event.issue.body }}
|
||||
with:
|
||||
script: |
|
||||
const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i;
|
||||
const template = `${process.env.TEMPLATE_BODY}`
|
||||
const match = regressionPattern.test(template);
|
||||
core.setOutput('is_regression', match);
|
||||
- name: Manage regression label
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
|
||||
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
|
||||
else
|
||||
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}
|
||||
fi
|
||||
@@ -6,6 +6,7 @@ on:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'dist/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
package:
|
||||
@@ -16,7 +17,7 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref_name }}
|
||||
@@ -27,18 +28,18 @@ jobs:
|
||||
npm test
|
||||
npm run package
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_ROLE_TO_ASSUME }}
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
role-duration-seconds: 900
|
||||
role-session-name: SecretsManagerFetch
|
||||
- name: Get bot user token
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@v1
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@v2
|
||||
with:
|
||||
parse-json-secrets: true
|
||||
secret-ids: |
|
||||
OSDS,arn:aws:secretsmanager:us-west-2:294535624312:secret:github-aws-sdk-osds-automation-ZHNalp
|
||||
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
|
||||
- name: Commit
|
||||
run: |
|
||||
echo "::add-mask::${{ env.OSDS_ACCESS_TOKEN }}"
|
||||
@@ -47,4 +48,4 @@ jobs:
|
||||
git remote set-url origin https://${{ env.OSDS_ACCESS_TOKEN }}@github.com/aws-actions/configure-aws-credentials.git
|
||||
git add dist
|
||||
git commit -m "chore: Update dist" || echo "No changes to commit"
|
||||
git push origin
|
||||
git push --force origin
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@v4.5.0
|
||||
- uses: amannn/action-semantic-pull-request@v5.5.3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
name: Release Please
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
|
||||
role-duration-seconds: 900
|
||||
role-session-name: ${{ github.run_id }}
|
||||
|
||||
- name: Get git credentials
|
||||
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
|
||||
|
||||
- name: Run release-please
|
||||
uses: googleapis/release-please-action@v4
|
||||
with:
|
||||
release-type: node
|
||||
token: ${{ env.OSDS_ACCESS_TOKEN }}
|
||||
config-file: release-please-config.json
|
||||
manifest-file: .release-please-manifest.json
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Run tests
|
||||
name: Run Integ tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -12,13 +12,38 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
node: [14, 16, 18]
|
||||
name: Run OIDC integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v3
|
||||
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:
|
||||
@@ -32,13 +57,12 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
node: [14, 16, 18]
|
||||
name: Run access key integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for access keys
|
||||
uses: ./
|
||||
with:
|
||||
@@ -53,13 +77,12 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
node: [14, 16, 18]
|
||||
name: Run access key from env integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for access keys
|
||||
uses: ./
|
||||
env:
|
||||
@@ -75,13 +98,12 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [[self-hosted, linux-fargate], windows-latest, ubuntu-latest, macos-latest]
|
||||
node: [14, 16, 18]
|
||||
name: Run IAM User integ tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Integ test for IAM user
|
||||
uses: ./
|
||||
with:
|
||||
|
||||
@@ -9,17 +9,16 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
node: [14, 16, 18]
|
||||
name: Run unit tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
node-version: 20
|
||||
- name: "Install dependencies"
|
||||
uses: bahmutov/npm-install@v1
|
||||
- name: "Run tests"
|
||||
@@ -30,11 +29,11 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: "Checkout repostiory"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
- name: "Install dependencies"
|
||||
uses: bahmutov/npm-install@v1
|
||||
- name: "Lint code"
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
queue_rules:
|
||||
- name: default
|
||||
conditions:
|
||||
# Conditions to get out of the queue (= merged)
|
||||
- status-success=Run Unit Tests
|
||||
|
||||
pull_request_rules:
|
||||
- name: Automatically merge on CI success and review approval
|
||||
conditions:
|
||||
- base~=main|integ-tests
|
||||
- "#approved-reviews-by>=1"
|
||||
- -approved-reviews-by~=author
|
||||
- status-success=Run Unit Tests
|
||||
- label!=work-in-progress
|
||||
- -title~=(WIP|wip)
|
||||
- -merged
|
||||
- -closed
|
||||
- author!=dependabot[bot]
|
||||
actions:
|
||||
queue:
|
||||
method: squash
|
||||
name: default
|
||||
|
||||
- name: Automatically approve and merge Dependabot PRs
|
||||
conditions:
|
||||
- base~=main
|
||||
- author=dependabot[bot]
|
||||
- status-success=Run Unit Tests
|
||||
- -title~=(WIP|wip)
|
||||
- -label~=(blocked|do-not-merge)
|
||||
- -merged
|
||||
- -closed
|
||||
actions:
|
||||
review:
|
||||
type: APPROVE
|
||||
queue:
|
||||
method: squash
|
||||
name: default
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5",
|
||||
"bracketSpacing": true,
|
||||
"overrides": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
".release-please-manifest.json": "4.0.2",
|
||||
"package.json": "4.0.2",
|
||||
".": "4.2.1"
|
||||
}
|
||||
@@ -2,6 +2,81 @@
|
||||
|
||||
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.
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added release-please action config ([0f88004](https://github.com/aws-actions/configure-aws-credentials/commit/0f88004d9c27e0bdbbc254b3f7c8053cb38f04d7))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add id-token permission to automerge ([97834a4](https://github.com/aws-actions/configure-aws-credentials/commit/97834a484a5ab3c40fa9e2eb40fcf8041105a573))
|
||||
* cpy syntax on npm package ([#1195](https://github.com/aws-actions/configure-aws-credentials/issues/1195)) ([83b5a56](https://github.com/aws-actions/configure-aws-credentials/commit/83b5a565471214aec459e234bef606339fe07111))
|
||||
* force push packaged files to main ([bfd2185](https://github.com/aws-actions/configure-aws-credentials/commit/bfd218503eb87938c29603a551e19c6b594f5fe5))
|
||||
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
* release 4.0.3 ([ca00fd4](https://github.com/aws-actions/configure-aws-credentials/commit/ca00fd4d3842ad58c3c21ebfe69defa1f0e7bdc4))
|
||||
|
||||
## [4.0.2](https://github.com/aws-actions/configure-aws-credentials/compare/v4.0.1...v4.0.2) (2024-02-09)
|
||||
|
||||
* Revert 4.0.1 to remove warning
|
||||
|
||||
## [4.0.1](https://github.com/aws-actions/configure-aws-credentials/compare/v4.0.0...v4.0.1) (2023-10-03)
|
||||
|
||||
### Documentation
|
||||
* Throw a warning when customers use long-term credentials.
|
||||
|
||||
## [4.0.0](https://github.com/aws-actions/configure-aws-credentials/compare/v3.0.2...v4.0.0) (2023-09-11)
|
||||
|
||||
* Upgraded runtime to `node20` from `node16`
|
||||
|
||||
## [3.0.2](https://github.com/aws-actions/configure-aws-credentials/compare/v3.0.1...v3.0.2) (2023-09-07)
|
||||
|
||||
### Bug Fixes
|
||||
* fixes #817 #819: validation logic throwing unwanted errors [d78f55b](https://github.com/aws-actions/configure-aws-credentials/commit/d78f55b1db65186cb251a8504ae9527af06fc5fd)
|
||||
|
||||
## [3.0.1](https://github.com/aws-actions/configure-aws-credentials/compare/v3.0.0...v3.0.1) (2023-08-24)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,141 +1,47 @@
|
||||
## Configure AWS Credentials for GitHub Actions
|
||||
Configure your AWS credentials and region environment variables for use in other
|
||||
GitHub Actions. This action implements the AWS SDK credential resolution chain
|
||||
and exports 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.
|
||||
GitHub Actions.
|
||||
|
||||
---
|
||||
|
||||
### News
|
||||
|
||||
We have recently released `v3` of Configure AWS Credentials! With this new
|
||||
release we have migrated the code to TypeScript, and have also migrated away
|
||||
from using `v2` of the JavaScript AWS SDK. This should eliminate the warning you
|
||||
have seen in your workflow logs about `v2` deprecation.
|
||||
|
||||
In addition to the refactored codebase, we have also introduced some changes to
|
||||
existing functionality, added some new features, and fixed some bugs. These
|
||||
changes should be backwards compatible with your existing workflows.
|
||||
|
||||
**Notable changes to existing functionality**
|
||||
|
||||
- By default, the assumed role credentials will only be valid for one hour in
|
||||
_all_ use cases. This is changed from 6 hours in `v2`. You can adjust this value
|
||||
with the `role-duration-seconds` input.
|
||||
- By default, your account ID will not be masked in workflow logs. This was
|
||||
changed from being masked by default in the previous version. AWS does consider
|
||||
account IDs as sensitive information, so this change reflects that stance. You
|
||||
can revert to the old default and mask your account ID in workflow logs by
|
||||
setting the `mask-aws-account-id` input to `true`.
|
||||
|
||||
**New features**
|
||||
|
||||
- You can now configure retry settings in case your STS call fails. By default,
|
||||
we retry with exponential backoff twelve times. You can disable this behavior
|
||||
altogether by setting the `disable-retry` input to `true`, or you can configure
|
||||
the number of times the action will retry with the `retry-max-attempts` input.
|
||||
- You can now set the returned credentials as action step outputs. To do this,
|
||||
you can set the `output-credentials` prop to `true`.
|
||||
- There's now an option to clear the AWS-related environment variables at the
|
||||
start of the action. Clearing these variables is often a workaround for
|
||||
problems, so enabling this can be helpful if existing credentials or environment
|
||||
variables are interfering with the action. You can enable this by setting the
|
||||
`unset-current-credentials` input to `true`.
|
||||
|
||||
**Bug fixes**
|
||||
|
||||
You can find a list of bugs that have been fixed in v3 in the
|
||||
[changelog](./changelog.md).
|
||||
|
||||
---
|
||||
|
||||
### Table of Contents
|
||||
<!-- toc -->
|
||||
- [Overview](#overview)
|
||||
- [Security recommendations](#security-recommendations)
|
||||
- [Using this action](#using-this-action)
|
||||
+ [Credential Lifetime](#credential-lifetime)
|
||||
+ [External ID](#external-id)
|
||||
+ [Session tagging](#session-tagging-and-name)
|
||||
+ [Sample IAM Role Permissions](#sample-iam-role-cloudformation-template)
|
||||
+ [Misc](#misc)
|
||||
- [OIDC](#OIDC)
|
||||
+ [Audience](#audience)
|
||||
+ [Sample IAM OIDC CloudFormation Template](#sample-iam-oidc-cloudformation-template)
|
||||
+ [Claims and scoping permissions](#claims-and-scoping-permissions)
|
||||
+ [Further info](#further-info)
|
||||
- [Self-Hosted Runners](#self-hosted-runners)
|
||||
+ [Proxy Configuration](#proxy-configuration)
|
||||
+ [Use with the AWS CLI](#use-with-the-aws-cli)
|
||||
- [Examples](#examples)
|
||||
- [License Summary](#license-summary)
|
||||
- [Security Disclosures](#security-disclosures)
|
||||
<!-- tocstop -->
|
||||
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.
|
||||
|
||||
## 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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
To do that, you would add the following step to your workflow:
|
||||
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
aws-region: us-east-2
|
||||
```
|
||||
This will cause the action to perform an [`AssumeRoleWithWebIdentity`](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html) call and
|
||||
return temporary security credentials for use by other steps in your workflow. In order for
|
||||
this to work, you'll need to preconfigure the IAM Identity Provider in your AWS account
|
||||
(see [Assuming a Role](#assuming-a-role) for details).
|
||||
|
||||
You can use this action with the AWS CLI available in
|
||||
[GitHub's hosted virtual environments](https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners) or run this action multiple times
|
||||
to use different AWS accounts, regions, or IAM roles in the same GitHub Actions
|
||||
workflow. As an example, here is a complete workflow file that uploads artifacts
|
||||
to Amazon S3.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
deploy:
|
||||
name: Upload to Amazon S3
|
||||
runs-on: ubuntu-latest
|
||||
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Configure AWS credentials from Test account
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::111111111111:role/my-github-actions-role-test
|
||||
aws-region: us-east-1
|
||||
- name: Copy files to the test website with the AWS CLI
|
||||
run: |
|
||||
aws s3 sync . s3://my-s3-test-website-bucket
|
||||
- name: Configure AWS credentials from Production account
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::222222222222:role/my-github-actions-role-prod
|
||||
aws-region: us-west-2
|
||||
- name: Copy files to the production website with the AWS CLI
|
||||
run: |
|
||||
aws s3 sync . s3://my-s3-prod-website-bucket
|
||||
```
|
||||
|
||||
See [action.yml](action.yml) for the full documentation for this action's inputs
|
||||
and outputs.
|
||||
For more information on how to do that, read on.
|
||||
|
||||
### Note about GHES
|
||||
|
||||
Some of this documentation may be inaccurate if you are using GHES (GitHub Enterprise Servers), please take note to review the GitHub documentation when relevant.
|
||||
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 `tokens.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.
|
||||
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
|
||||
|
||||
@@ -143,10 +49,14 @@ 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.
|
||||
* [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.
|
||||
* [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:
|
||||
@@ -157,9 +67,17 @@ There are five different supported ways to retrieve credentials:
|
||||
- Using a WebIdentity Token File (`AssumeRoleWithWebIdentity`)
|
||||
- Using existing credentials in your runner (`AssumeRole`)
|
||||
|
||||
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. See [OIDC](#OIDC) for more information on how to setup your AWS account to assume a role with OIDC.
|
||||
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.
|
||||
|
||||
The following table describes which method is used based on which values are supplied to the Action:
|
||||
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.
|
||||
|
||||
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
|
||||
| --------------------------------------------------------------- | ------------------- | ---------------- | ------------------------- | - | - |
|
||||
@@ -169,20 +87,59 @@ The following table describes which method is used based on which values are sup
|
||||
| Assume Role using WebIdentity Token File credentials | | ✔ | ✔ | | |
|
||||
| Assume Role using existing credentials | | ✔ | | ✔ | |
|
||||
|
||||
*Note: `role-chaining` is not necessary to use existing credentials in every use case. If you're getting a "Credentials loaded by the SDK do not match" error, try enabling this prop.
|
||||
*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.*
|
||||
|
||||
### Credential Lifetime
|
||||
### Options
|
||||
See [action.yml](./action.yml) for more detail.
|
||||
|
||||
| Option | Description | Required |
|
||||
|---------------------------|---------------------------------------------------------------------------------------------------|----------|
|
||||
| aws-region | Which AWS region to use | Yes |
|
||||
| role-to-assume | Role for which to fetch credentials. Only required for some authentication types. | No |
|
||||
| aws-access-key-id | AWS access key to use. Only required for some authentication types. | No |
|
||||
| aws-secret-access-key | AWS secret key to use. Only required for some authentication types. | No |
|
||||
| aws-session-token | AWS session token to use. Used in uncommon authentication scenarios. | No |
|
||||
| role-chaining | Use existing credentials from the environment to assume a new role. | No |
|
||||
| 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 (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. (Outputs access-key-id, secret-access-key, session-token, and expiration). Defaults to false. | 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 |
|
||||
|
||||
#### Credential Lifetime
|
||||
The default session duration is **1 hour**.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
### External ID
|
||||
If your role requires an external ID to assume, you can provide the external ID with the `role-external-id` input
|
||||
#### External ID
|
||||
If your role requires an external ID to assume, you can provide the external ID
|
||||
with the `role-external-id` input
|
||||
|
||||
### Session tagging and name
|
||||
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 following tags: (`GITHUB_` environment variable definitions can be
|
||||
[found here](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables))
|
||||
#### Session tagging and name
|
||||
The default session name is "GitHubActions", and you can modify it by specifying
|
||||
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))
|
||||
|
||||
| Key | Value |
|
||||
| ---------- | ----------------- |
|
||||
@@ -195,38 +152,45 @@ The session will be tagged with the following tags: (`GITHUB_` environment varia
|
||||
| Commit | GITHUB_SHA |
|
||||
|
||||
_Note: all tag values must conform to
|
||||
[the requirements](https://docs.aws.amazon.com/STS/latest/APIReference/API_Tag.html).
|
||||
[the tag requirements](https://docs.aws.amazon.com/STS/latest/APIReference/API_Tag.html).
|
||||
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 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 [issue 419](https://github.com/aws-actions/configure-aws-credentials/issues/419) for more info
|
||||
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@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-skip-session-tagging: true
|
||||
```
|
||||
|
||||
### Session policies
|
||||
Session policies are not required, but they allow you to limit the scope of the
|
||||
fetched credentials without making changes to IAM roles. You can specify inline
|
||||
session policies right in your workflow file, or refer to an existing managed
|
||||
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:
|
||||
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:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
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@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
inline-session-policy: >-
|
||||
{
|
||||
@@ -243,16 +207,17 @@ Or we can have a nicely formatted JSON as well:
|
||||
```
|
||||
|
||||
#### 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 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:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.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@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
managed-session-policies: |
|
||||
arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
|
||||
@@ -262,13 +227,20 @@ And we can pass multiple managed policies likes this:
|
||||
### 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.
|
||||
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.
|
||||
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, and the recommended solution is to include another step in your workflow which unsets the environment variables set by this action. Now if you set the `unset-current-credentials` input to `true`, the workaround is made eaiser
|
||||
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
|
||||
@@ -277,11 +249,32 @@ contains special characters. For more information, please see the
|
||||
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.
|
||||
`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
|
||||
|
||||
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, this action will create a JWT unique to the workflow run, and it will use this JWT to assume the role. For this action to create the JWT, it is required for your workflow to have the `id-token: write` permission:
|
||||
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
|
||||
configure IAM to accept JWTs from GitHub's OIDC endpoint. This action will
|
||||
then create a JWT unique to the workflow run using the OIDC endpoint, and it
|
||||
will use the JWT to assume the specified role with short-term credentials.
|
||||
|
||||
To get this to work
|
||||
1. Configure your workflow to use the `id-token: write` permission.
|
||||
2. Configure your audience, if required.
|
||||
3. In your AWS account, configure IAM to trust GitHub's OIDC identity provider.
|
||||
4. Configure an IAM role with appropriate claim limits and permission scope.
|
||||
|
||||
*Note*: Naming your role "GitHubActions" has been reported to not work. See
|
||||
[#953](https://github.com/aws-actions/configure-aws-credentials/issues/953).
|
||||
|
||||
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:
|
||||
@@ -289,32 +282,37 @@ We recommend using [GitHub's OIDC provider](https://docs.github.com/en/actions/d
|
||||
contents: read
|
||||
```
|
||||
|
||||
### Audience
|
||||
### OIDC Audience
|
||||
|
||||
When the JWT is created, an audience needs to be specified. By default, the audience is `sts.amazon.com` and this will work for most cases. Changing the default audience may be necessary when using non-default AWS partitions. You can specify the audience through the `audience` input:
|
||||
When the JWT is created, an audience needs to be specified. Normally, you would
|
||||
use `sts.amazonaws.com`, and this action uses this by default if you don't
|
||||
specify one. This will work for most cases. Changing the default audience may
|
||||
be necessary when using non-default AWS partitions, such as China regions.
|
||||
You can specify the audience through the `audience` input:
|
||||
|
||||
```yaml
|
||||
- name: Configure AWS Credentials for China region audience
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
audience: sts.amazonaws.com.cn
|
||||
aws-region: us-east-3
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
role-to-assume: arn:aws-cn:iam::123456789100:role/my-github-actions-role
|
||||
```
|
||||
|
||||
### Sample IAM OIDC CloudFormation Template
|
||||
### Configuring IAM to trust GitHub
|
||||
To use GitHub's OIDC provider, you must first set up federation
|
||||
with the provider in as an IAM IdP. The GitHub OIDC provider only needs to be
|
||||
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).
|
||||
GitHub's OIDC can share a single OIDC Provider). Here is a sample CloudFormation
|
||||
template that will configure this trust for you.
|
||||
|
||||
Note that the thumbprint has been set to all F's because the thumbprint is not
|
||||
used when authenticating `tokens.actions.githubusercontent.com`. Instead, IAM
|
||||
uses its library of trusted CAs to authenticate. However, this value is still
|
||||
required by the API.
|
||||
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.
|
||||
|
||||
This CloudFormation template will configure the IdP for you. You can copy the
|
||||
template below, or load it from here:
|
||||
You can copy the template below, or load it from here:
|
||||
https://d38mtn6aq9zhn6.cloudfront.net/configure-aws-credentials-latest.yml
|
||||
|
||||
```yaml
|
||||
@@ -374,13 +372,35 @@ Outputs:
|
||||
```
|
||||
|
||||
### Claims and scoping permissions
|
||||
To align with the Amazon IAM best practice of [granting least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege), the assume role policy document should contain a [`Condition`](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) that specifies a subject (`sub`) allowed to assume the role. [GitHub also recommends](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#defining-trust-conditions-on-cloud-roles-using-oidc-claims) filtering for the correct audience (`aud`). See [AWS IAM documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#condition-keys-wif) on which claims you can filter for in your trust policies.
|
||||
To align with the Amazon IAM best practice of [granting least
|
||||
privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege),
|
||||
the assume role policy document should contain a
|
||||
[`Condition`](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)
|
||||
that specifies a subject (`sub`) allowed to assume the role. [GitHub also
|
||||
recommends](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#defining-trust-conditions-on-cloud-roles-using-oidc-claims)
|
||||
filtering for the correct audience (`aud`). See [AWS IAM
|
||||
documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#condition-keys-wif)
|
||||
on which claims you can filter for in your trust policies.
|
||||
|
||||
Without a subject (`sub`) condition, any GitHub user or repository could potentially assume the role. The subject can be scoped to a GitHub organization and repository as shown in the CloudFormation template. However, scoping it down to your org and repo may cause the role assumption to fail in some cases. See [Example subject claims](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#example-subject-claims) for specific details on what the subject value will be depending on your workflow. You can also [customize your subject claim](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-token-claims) if you want full control over the information you can filter for in your trust policy. If you aren't sure what your subject (`sub`) key is, you can add the [`actions-oidc-debugger`](https://github.com/github/actions-oidc-debugger) action to your workflow to see the value of the subject (`sub`) key, as well as other claims.
|
||||
Without a subject (`sub`) condition, any GitHub user or repository could
|
||||
potentially assume the role. The subject can be scoped to a GitHub organization
|
||||
and repository as shown in the CloudFormation template. However, scoping it down
|
||||
to your org and repo may cause the role assumption to fail in some cases. See
|
||||
[Example subject claims](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#example-subject-claims)
|
||||
for specific details on what the subject value will be depending on your
|
||||
workflow. You can also [customize your subject claim](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-token-claims)
|
||||
if you want full control over the information you can filter for in your trust
|
||||
policy. If you aren't sure what your subject (`sub`) key is, you can add the
|
||||
[`actions-oidc-debugger`](https://github.com/github/actions-oidc-debugger)
|
||||
action to your workflow to see the value of the subject (`sub`) key, as well as
|
||||
other claims.
|
||||
|
||||
Additional claim conditions can be added for higher specificity as explained in the [GitHub documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). Due to implementation details, not every OIDC claim is presently supported by IAM.
|
||||
Additional claim conditions can be added for higher specificity as explained in
|
||||
the [GitHub documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect).
|
||||
Due to implementation details, not every OIDC claim is presently supported by
|
||||
IAM.
|
||||
|
||||
### Further info
|
||||
### Further information about OIDC
|
||||
|
||||
For further information on OIDC and GitHub Actions, please see:
|
||||
|
||||
@@ -407,7 +427,7 @@ 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@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
```
|
||||
@@ -417,7 +437,7 @@ 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@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: my-github-actions-role
|
||||
@@ -432,15 +452,14 @@ web identity.
|
||||
|
||||
### Proxy Configuration
|
||||
|
||||
If you run in self-hosted environments and in secured environment where you need
|
||||
use a specific proxy you can set it in the action manually.
|
||||
If need use a HTTP proxy you can set it in the action manually.
|
||||
|
||||
Additionally this action will always consider already configured proxy in the
|
||||
environment.
|
||||
Additionally this action will always consider the `HTTP_PROXY` environment
|
||||
variable.
|
||||
|
||||
Manually configured proxy:
|
||||
```yaml
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: my-github-actions-role
|
||||
@@ -453,9 +472,6 @@ Proxy configured in the environment variable:
|
||||
HTTP_PROXY="http://companydomain.com:3128"
|
||||
```
|
||||
|
||||
The action will read the underlying proxy configuration from the environment and
|
||||
you don't need to configure it in the action.
|
||||
|
||||
### 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
|
||||
@@ -470,36 +486,42 @@ should include the AWS CLI by default.
|
||||
### AssumeRoleWithWebIdentity (recommended)
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
role-session-name: MySessionName
|
||||
```
|
||||
In this example, the Action will load the OIDC token from the GitHub-provided environment variable and use it to assume the role `arn:aws:iam::123456789100:role/my-github-actions-role` with the session name `MySessionName`.
|
||||
In this example, the Action will load the OIDC token from the GitHub-provided
|
||||
environment variable and use it to assume the role
|
||||
`arn:aws:iam::123456789100:role/my-github-actions-role` with the session name
|
||||
`MySessionName`.
|
||||
|
||||
### AssumeRole with role previously assumed by action in same workflow
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.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@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::987654321000:role/my-second-role
|
||||
role-session-name: MySessionName
|
||||
role-chaining: true
|
||||
```
|
||||
In this two-step example, the first step will use OIDC to assume the role `arn:aws:iam::123456789100:role/my-github-actions-role` just as in the prior example. Following that, a second step will use this role to assume a different role, `arn:aws:iam::987654321000:role/my-second-role`.
|
||||
In this two-step example, the first step will use OIDC to assume the role
|
||||
`arn:aws:iam::123456789100:role/my-github-actions-role` just as in the prior
|
||||
example. Following that, a second step will use this role to assume a different
|
||||
role, `arn:aws:iam::987654321000:role/my-second-role`.
|
||||
|
||||
### AssumeRole with static IAM credentials in repository secrets
|
||||
```yaml
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
@@ -509,13 +531,16 @@ In this two-step example, the first step will use OIDC to assume the role `arn:a
|
||||
role-duration-seconds: 1200
|
||||
role-session-name: MySessionName
|
||||
```
|
||||
In this example, the secret `AWS_ROLE_TO_ASSUME` contains a string like `arn:aws:iam::123456789100:role/my-github-actions-role`. To assume a role in the same account as the static credentials, you can simply specify the role name, like `role-to-assume: my-github-actions-role`.
|
||||
In this example, the secret `AWS_ROLE_TO_ASSUME` contains a string like
|
||||
`arn:aws:iam::123456789100:role/my-github-actions-role`. To assume a role in
|
||||
the same account as the static credentials, you can simply specify the role
|
||||
name, like `role-to-assume: my-github-actions-role`.
|
||||
|
||||
### Retrieving credentials from step output, AssumeRole with temporary credentials
|
||||
```yaml
|
||||
- name: Configure AWS Credentials 1
|
||||
id: creds
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
@@ -524,7 +549,7 @@ In this example, the secret `AWS_ROLE_TO_ASSUME` contains a string like `arn:aws
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
- name: Configure AWS Credentials 2
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4.1.0
|
||||
with:
|
||||
aws-region: us-east-2
|
||||
aws-access-key-id: ${{ steps.creds.outputs.aws-access-key-id }}
|
||||
@@ -535,10 +560,16 @@ In this example, the secret `AWS_ROLE_TO_ASSUME` contains a string like `arn:aws
|
||||
run: |
|
||||
aws sts get-caller-identity
|
||||
```
|
||||
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.
|
||||
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
|
||||
This code is made available under the MIT license.
|
||||
|
||||
## 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).
|
||||
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).
|
||||
|
||||
+208
-215
@@ -855,6 +855,9 @@ Apache-2.0
|
||||
limitations under the License.
|
||||
|
||||
|
||||
@aws-sdk/core
|
||||
Apache-2.0
|
||||
|
||||
@aws-sdk/credential-provider-env
|
||||
Apache-2.0
|
||||
Apache License
|
||||
@@ -3307,7 +3310,7 @@ Apache-2.0
|
||||
limitations under the License.
|
||||
|
||||
|
||||
@aws-sdk/node-http-handler
|
||||
@aws-sdk/region-config-resolver
|
||||
Apache-2.0
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -3715,210 +3718,6 @@ Apache License
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@aws-sdk/types
|
||||
Apache-2.0
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@aws-sdk/util-endpoints
|
||||
Apache-2.0
|
||||
Apache License
|
||||
@@ -10051,6 +9850,210 @@ Apache-2.0
|
||||
limitations under the License.
|
||||
|
||||
|
||||
@smithy/util-endpoints
|
||||
Apache-2.0
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@smithy/util-hex-encoding
|
||||
Apache-2.0
|
||||
Apache License
|
||||
@@ -11275,16 +11278,6 @@ Apache License
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@vercel/ncc
|
||||
MIT
|
||||
Copyright 2018 ZEIT, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
agent-base
|
||||
MIT
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
const { fs } = require('memfs')
|
||||
module.exports = fs
|
||||
+3
-1
@@ -2,7 +2,7 @@
|
||||
name: '"Configure AWS Credentials" Action for GitHub Actions'
|
||||
description: Configures AWS credentials for use in subsequent steps in a GitHub Action workflow
|
||||
runs:
|
||||
using: node16
|
||||
using: node20
|
||||
main: dist/index.js
|
||||
post: dist/cleanup/index.js
|
||||
branding:
|
||||
@@ -73,6 +73,8 @@ 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:
|
||||
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.
|
||||
outputs:
|
||||
aws-account-id:
|
||||
description: The AWS account ID for the provided credentials
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"formatter": {
|
||||
"indentStyle": "space",
|
||||
"lineWidth": 120,
|
||||
"indentWidth": 2,
|
||||
"lineEnding": "lf",
|
||||
"enabled": true,
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"performance": {
|
||||
"noDelete": "off",
|
||||
},
|
||||
"complexity": {
|
||||
"noExtraBooleanCast": "off",
|
||||
}
|
||||
},
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"trailingCommas": "all",
|
||||
"jsxQuoteStyle": "double",
|
||||
"quoteStyle": "single",
|
||||
"bracketSpacing": true,
|
||||
"arrowParentheses": "always",
|
||||
},
|
||||
},
|
||||
"json": {
|
||||
"formatter": {
|
||||
"trailingCommas": "all",
|
||||
},
|
||||
},
|
||||
}
|
||||
+42341
-14506
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;
|
||||
}
|
||||
-15
@@ -1,15 +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?: any[];
|
||||
}
|
||||
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 {};
|
||||
+42570
-16124
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@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: grolston/guard-action@main
|
||||
with:
|
||||
data_directory: './cloudformation/' ## change to your template directory
|
||||
|
||||
@@ -18,16 +18,16 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: us-east-1
|
||||
## the following creates an ARN based on the values entered into github secrets
|
||||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
|
||||
role-session-name: myGitHubActions
|
||||
- name: Deploy EC2 Bastion
|
||||
uses: aws-actions/aws-cloudformation-github-deploy@v1.0.3
|
||||
uses: aws-actions/aws-cloudformation-github-deploy@v1.3.0
|
||||
with:
|
||||
name: myEC2bastion
|
||||
## change to path to template in your github repo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# federated-setup
|
||||
|
||||
## [github-action-oidc-federation](./github-actions-odic-federation.yml)
|
||||
## [github-action-oidc-federation](./github-actions-oidc-federation.yml)
|
||||
|
||||
Setup of the OIDC federation between your GitHub Organization/repository and your AWS account.
|
||||
|
||||
|
||||
Generated
+4254
-15152
File diff suppressed because it is too large
Load Diff
+22
-32
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "configure-aws-credentials",
|
||||
"description": "A GitHub Action to configure AWS credentials",
|
||||
"version": "4.2.1",
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.build.json",
|
||||
"lint": "eslint .",
|
||||
"package": "npm run build && ncc build --license THIRD-PARTY -o dist && ncc build src/cleanup/index.ts -o dist/cleanup && copyup -E dist/THIRD-PARTY . && del-cli dist/THIRD-PARTY",
|
||||
"test": "npm run lint && jest --verbose"
|
||||
"build": "tsc",
|
||||
"lint": "biome check --error-on-warnings ./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 && npm run build"
|
||||
},
|
||||
"author": {
|
||||
"name": "Amazon.com, Inc. or its affiliates",
|
||||
@@ -13,36 +14,26 @@
|
||||
"organization": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aws-sdk/credential-provider-env": "^3.186.0",
|
||||
"@aws-sdk/property-provider": "^3.188.0",
|
||||
"@jest/globals": "^29.1.2",
|
||||
"@types/jest": "^29.1.2",
|
||||
"@types/node": "^14",
|
||||
"@typescript-eslint/eslint-plugin": "^5",
|
||||
"@typescript-eslint/parser": "^5",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"aws-sdk-client-mock": "^2.0.0",
|
||||
"copyfiles": "^2.4.1",
|
||||
"del-cli": "^5.0.0",
|
||||
"eslint": "^8",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-import-resolver-node": "^0.3.6",
|
||||
"eslint-import-resolver-typescript": "^3.5.1",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^29.1.2",
|
||||
"jest-junit": "^13",
|
||||
"@aws-sdk/credential-provider-env": "^3.808.0",
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@smithy/property-provider": "^4.0.1",
|
||||
"@types/node": "^22.15.17",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"@vitest/coverage-v8": "^3.1.2",
|
||||
"aws-sdk-client-mock": "^4.1.0",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"del-cli": "^6.0.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"prettier": "^2.7.1",
|
||||
"standard-version": "^9",
|
||||
"ts-jest": "^29.0.3",
|
||||
"typescript": "^4.8.4"
|
||||
"memfs": "^4.17.1",
|
||||
"standard-version": "^9.5.0",
|
||||
"typescript": "^5.8.3",
|
||||
"vitest": "^3.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@aws-sdk/client-sts": "^3",
|
||||
"@aws-sdk/node-http-handler": "^3",
|
||||
"https-proxy-agent": "^5.0.0"
|
||||
"@actions/core": "^1.11.1",
|
||||
"@aws-sdk/client-sts": "^3.808.0",
|
||||
"@smithy/node-http-handler": "^4.0.1",
|
||||
"https-proxy-agent": "^5.0.1"
|
||||
},
|
||||
"keywords": [
|
||||
"aws",
|
||||
@@ -55,7 +46,6 @@
|
||||
"main": "build/index.js",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/aws-actions/configure-aws-credentials",
|
||||
"version": "0.0.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/aws-actions/configure-aws-credentials/issues"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"packages": {
|
||||
".": {
|
||||
"changelog-path": "CHANGELOG.md",
|
||||
"release-type": "node",
|
||||
"bump-minor-pre-major": false,
|
||||
"bump-patch-for-minor-pre-major": false,
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}
|
||||
},
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { info } from '@actions/core';
|
||||
import { STSClient } from '@aws-sdk/client-sts';
|
||||
import { NodeHttpHandler } from '@aws-sdk/node-http-handler';
|
||||
import type { AwsCredentialIdentity } from '@aws-sdk/types';
|
||||
import { NodeHttpHandler } from '@smithy/node-http-handler';
|
||||
import { HttpsProxyAgent } from 'https-proxy-agent';
|
||||
import { errorMessage } from './helpers';
|
||||
|
||||
@@ -40,7 +41,7 @@ export class CredentialsClient {
|
||||
}
|
||||
|
||||
public async validateCredentials(expectedAccessKeyId?: string, roleChaining?: boolean) {
|
||||
let credentials;
|
||||
let credentials: AwsCredentialIdentity;
|
||||
try {
|
||||
credentials = await this.loadCredentials();
|
||||
if (!credentials.accessKeyId) {
|
||||
@@ -55,7 +56,7 @@ export class CredentialsClient {
|
||||
|
||||
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'
|
||||
'Unexpected failure: Credentials loaded by the SDK do not match the access key ID configured by the action',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-28
@@ -1,6 +1,6 @@
|
||||
import assert from 'assert';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import assert from 'node:assert';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import * as core from '@actions/core';
|
||||
import type { AssumeRoleCommandInput, STSClient, Tag } from '@aws-sdk/client-sts';
|
||||
import { AssumeRoleCommand, AssumeRoleWithWebIdentityCommand } from '@aws-sdk/client-sts';
|
||||
@@ -15,7 +15,7 @@ async function assumeRoleWithOIDC(params: AssumeRoleCommandInput, client: STSCli
|
||||
new AssumeRoleWithWebIdentityCommand({
|
||||
...params,
|
||||
WebIdentityToken: webIdentityToken,
|
||||
})
|
||||
}),
|
||||
);
|
||||
return creds;
|
||||
} catch (error) {
|
||||
@@ -27,10 +27,10 @@ async function assumeRoleWithWebIdentityTokenFile(
|
||||
params: AssumeRoleCommandInput,
|
||||
client: STSClient,
|
||||
webIdentityTokenFile: string,
|
||||
workspace: string
|
||||
workspace: string,
|
||||
) {
|
||||
core.debug(
|
||||
'webIdentityTokenFile provided. Will call sts:AssumeRoleWithWebIdentity and take session tags from token contents.'
|
||||
'webIdentityTokenFile provided. Will call sts:AssumeRoleWithWebIdentity and take session tags from token contents.',
|
||||
);
|
||||
const webIdentityTokenFilePath = path.isAbsolute(webIdentityTokenFile)
|
||||
? webIdentityTokenFile
|
||||
@@ -46,7 +46,7 @@ async function assumeRoleWithWebIdentityTokenFile(
|
||||
new AssumeRoleWithWebIdentityCommand({
|
||||
...params,
|
||||
WebIdentityToken: webIdentityToken,
|
||||
})
|
||||
}),
|
||||
);
|
||||
return creds;
|
||||
} catch (error) {
|
||||
@@ -75,7 +75,7 @@ export interface assumeRoleParams {
|
||||
webIdentityTokenFile?: string;
|
||||
webIdentityToken?: string;
|
||||
inlineSessionPolicy?: string;
|
||||
managedSessionPolicies?: any[];
|
||||
managedSessionPolicies?: { arn: string }[];
|
||||
}
|
||||
|
||||
export async function assumeRole(params: assumeRoleParams) {
|
||||
@@ -108,8 +108,11 @@ export async function assumeRole(params: assumeRoleParams) {
|
||||
{ Key: 'Actor', Value: sanitizeGitHubVariables(GITHUB_ACTOR) },
|
||||
{ Key: 'Commit', Value: GITHUB_SHA },
|
||||
];
|
||||
if (process.env['GITHUB_REF']) {
|
||||
tagArray.push({ Key: 'Branch', Value: sanitizeGitHubVariables(process.env['GITHUB_REF']) });
|
||||
if (process.env.GITHUB_REF) {
|
||||
tagArray.push({
|
||||
Key: 'Branch',
|
||||
Value: sanitizeGitHubVariables(process.env.GITHUB_REF),
|
||||
});
|
||||
}
|
||||
const tags = roleSkipSessionTagging ? undefined : tagArray;
|
||||
if (!tags) {
|
||||
@@ -123,7 +126,7 @@ export async function assumeRole(params: assumeRoleParams) {
|
||||
if (!roleArn.startsWith('arn:aws')) {
|
||||
assert(
|
||||
isDefined(sourceAccountId),
|
||||
'Source Account ID is needed if the Role Name is provided and not the Role Arn.'
|
||||
'Source Account ID is needed if the Role Name is provided and not the Role Arn.',
|
||||
);
|
||||
roleArn = `arn:aws:iam::${sourceAccountId}:role/${roleArn}`;
|
||||
}
|
||||
@@ -139,28 +142,23 @@ 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]);
|
||||
|
||||
// Instantiate STS client
|
||||
const stsClient = credentialsClient.stsClient;
|
||||
|
||||
// Assume role using one of three methods
|
||||
switch (true) {
|
||||
case !!webIdentityToken: {
|
||||
return assumeRoleWithOIDC(commonAssumeRoleParams, stsClient, webIdentityToken!);
|
||||
}
|
||||
|
||||
case !!webIdentityTokenFile: {
|
||||
return assumeRoleWithWebIdentityTokenFile(
|
||||
commonAssumeRoleParams,
|
||||
stsClient,
|
||||
webIdentityTokenFile!,
|
||||
GITHUB_WORKSPACE
|
||||
);
|
||||
}
|
||||
|
||||
default: {
|
||||
return assumeRoleWithCredentials(commonAssumeRoleParams, stsClient);
|
||||
}
|
||||
if (!!webIdentityToken) {
|
||||
return assumeRoleWithOIDC(commonAssumeRoleParams, stsClient, webIdentityToken);
|
||||
}
|
||||
if (!!webIdentityTokenFile) {
|
||||
return assumeRoleWithWebIdentityTokenFile(
|
||||
commonAssumeRoleParams,
|
||||
stsClient,
|
||||
webIdentityTokenFile,
|
||||
GITHUB_WORKSPACE,
|
||||
);
|
||||
}
|
||||
return assumeRoleWithCredentials(commonAssumeRoleParams, stsClient);
|
||||
}
|
||||
|
||||
+50
-3
@@ -7,6 +7,36 @@ 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',
|
||||
];
|
||||
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) {
|
||||
@@ -23,7 +53,7 @@ export function exportCredentials(creds?: Partial<Credentials>, outputCredential
|
||||
if (creds?.SessionToken) {
|
||||
core.setSecret(creds.SessionToken);
|
||||
core.exportVariable('AWS_SESSION_TOKEN', creds.SessionToken);
|
||||
} else if (process.env['AWS_SESSION_TOKEN']) {
|
||||
} else if (process.env.AWS_SESSION_TOKEN) {
|
||||
// clear session token from previous credentials action
|
||||
core.exportVariable('AWS_SESSION_TOKEN', '');
|
||||
}
|
||||
@@ -38,6 +68,9 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +149,7 @@ export async function retryAndBackoff<T>(
|
||||
isRetryable: boolean,
|
||||
maxRetries = 12,
|
||||
retries = 0,
|
||||
base = 50
|
||||
base = 50,
|
||||
): Promise<T> {
|
||||
try {
|
||||
return await fn();
|
||||
@@ -125,7 +158,8 @@ export async function retryAndBackoff<T>(
|
||||
throw err;
|
||||
}
|
||||
// It's retryable, so sleep and retry.
|
||||
await sleep(Math.random() * (Math.pow(2, retries) * base));
|
||||
await sleep(Math.random() * (2 ** retries * base));
|
||||
// biome-ignore lint/style/noParameterAssign: This is a loop variable
|
||||
retries += 1;
|
||||
if (retries >= maxRetries) {
|
||||
throw err;
|
||||
@@ -143,3 +177,16 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
+51
-29
@@ -1,13 +1,15 @@
|
||||
import * as core from '@actions/core';
|
||||
import type { AssumeRoleCommandOutput } from '@aws-sdk/client-sts';
|
||||
import { assumeRole } from './assumeRole';
|
||||
import { CredentialsClient } from './CredentialsClient';
|
||||
import { assumeRole } from './assumeRole';
|
||||
import {
|
||||
areCredentialsValid,
|
||||
errorMessage,
|
||||
retryAndBackoff,
|
||||
exportRegion,
|
||||
exportCredentials,
|
||||
exportAccountId,
|
||||
exportCredentials,
|
||||
exportRegion,
|
||||
retryAndBackoff,
|
||||
translateEnvVariables,
|
||||
unsetCredentials,
|
||||
verifyKeys,
|
||||
} from './helpers';
|
||||
@@ -18,26 +20,38 @@ const REGION_REGEX = /^[a-z0-9-]+$/g;
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
translateEnvVariables();
|
||||
// Get inputs
|
||||
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 roleDuration = parseInt(core.getInput('role-duration-seconds', { required: false })) || DEFAULT_ROLE_DURATION;
|
||||
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 inlineSessionPolicy = core.getInput('inline-session-policy', {
|
||||
required: false,
|
||||
});
|
||||
const managedSessionPoliciesInput = core.getMultilineInput('managed-session-policies', { required: false });
|
||||
const managedSessionPolicies: any[] = [];
|
||||
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';
|
||||
@@ -49,7 +63,9 @@ export async function run() {
|
||||
const specialCharacterWorkaroundInput =
|
||||
core.getInput('special-characters-workaround', { required: false }) || 'false';
|
||||
const specialCharacterWorkaround = specialCharacterWorkaroundInput.toLowerCase() === 'true';
|
||||
let maxRetries = parseInt(core.getInput('retry-max-attempts', { required: false })) || 12;
|
||||
const useExistingCredentialsInput = core.getInput('use-existing-credentials', { required: false }) || 'false';
|
||||
const useExistingCredentials = useExistingCredentialsInput.toLowerCase() === 'true';
|
||||
let maxRetries = Number.parseInt(core.getInput('retry-max-attempts', { required: false })) || 12;
|
||||
switch (true) {
|
||||
case specialCharacterWorkaround:
|
||||
// 😳
|
||||
@@ -74,17 +90,17 @@ export async function run() {
|
||||
!!roleToAssume &&
|
||||
!webIdentityTokenFile &&
|
||||
!AccessKeyId &&
|
||||
!process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'] &&
|
||||
!process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN &&
|
||||
!roleChaining
|
||||
) {
|
||||
core.info(
|
||||
'It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission? ' +
|
||||
'If you are not trying to authenticate with OIDC and the action is working successfully, you can ignore this message.'
|
||||
'If you are not trying to authenticate with OIDC and the action is working successfully, you can ignore this message.',
|
||||
);
|
||||
}
|
||||
return (
|
||||
!!roleToAssume &&
|
||||
!!process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'] &&
|
||||
!!process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN &&
|
||||
!AccessKeyId &&
|
||||
!webIdentityTokenFile &&
|
||||
!roleChaining
|
||||
@@ -105,6 +121,16 @@ export async function run() {
|
||||
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.');
|
||||
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()) {
|
||||
@@ -114,7 +140,7 @@ export async function run() {
|
||||
return core.getIDToken(audience);
|
||||
},
|
||||
!disableRetry,
|
||||
maxRetries
|
||||
maxRetries,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(`getIDToken call failed: ${errorMessage(error)}`);
|
||||
@@ -128,15 +154,13 @@ export async function run() {
|
||||
// the source credentials to already be masked as secrets
|
||||
// in any error messages.
|
||||
exportCredentials({ AccessKeyId, SecretAccessKey, SessionToken });
|
||||
} else if (
|
||||
!webIdentityTokenFile &&
|
||||
!roleChaining &&
|
||||
!(process.env['AWS_ACCESS_KEY_ID'] && process.env['AWS_SECRET_ACCESS_KEY'])
|
||||
) {
|
||||
throw new Error('Could not determine how to assume credentials. Please check your inputs and try again.');
|
||||
} else if (!webIdentityTokenFile && !roleChaining) {
|
||||
// Proceed only if credentials can be picked up
|
||||
await credentialsClient.validateCredentials();
|
||||
sourceAccountId = await exportAccountId(credentialsClient, maskAccountId);
|
||||
}
|
||||
|
||||
if (AccessKeyId || roleChaining || (process.env['AWS_ACCESS_KEY_ID'] && process.env['AWS_SECRET_ACCESS_KEY'])) {
|
||||
if (AccessKeyId || roleChaining) {
|
||||
// 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.
|
||||
@@ -148,7 +172,6 @@ export async function run() {
|
||||
if (roleToAssume) {
|
||||
let roleCredentials: AssumeRoleCommandOutput;
|
||||
do {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
roleCredentials = await retryAndBackoff(
|
||||
async () => {
|
||||
return assumeRole({
|
||||
@@ -166,17 +189,16 @@ export async function run() {
|
||||
});
|
||||
},
|
||||
!disableRetry,
|
||||
maxRetries
|
||||
maxRetries,
|
||||
);
|
||||
// eslint-disable-next-line no-unmodified-loop-condition
|
||||
} while (specialCharacterWorkaround && !verifyKeys(roleCredentials.Credentials));
|
||||
core.info(`Authenticated as assumedRoleId ${roleCredentials.AssumedRoleUser!.AssumedRoleId!}`);
|
||||
core.info(`Authenticated as assumedRoleId ${roleCredentials.AssumedRoleUser?.AssumedRoleId}`);
|
||||
exportCredentials(roleCredentials.Credentials, outputCredentials);
|
||||
// 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) {
|
||||
if (!process.env.GITHUB_ACTIONS || AccessKeyId) {
|
||||
await credentialsClient.validateCredentials(roleCredentials.Credentials?.AccessKeyId);
|
||||
}
|
||||
await exportAccountId(credentialsClient, maskAccountId);
|
||||
@@ -186,7 +208,7 @@ export async function run() {
|
||||
} catch (error) {
|
||||
core.setFailed(errorMessage(error));
|
||||
|
||||
const showStackTrace = process.env['SHOW_STACK_TRACE'];
|
||||
const showStackTrace = process.env.SHOW_STACK_TRACE;
|
||||
|
||||
if (showStackTrace === 'true') {
|
||||
throw error;
|
||||
|
||||
+29
-33
@@ -1,35 +1,34 @@
|
||||
import * as core from '@actions/core';
|
||||
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 mocks from './mockinputs.test';
|
||||
|
||||
const FAKE_ACCESS_KEY_ID = 'MY-AWS-ACCESS-KEY-ID';
|
||||
const FAKE_SECRET_ACCESS_KEY = 'MY-AWS-SECRET-ACCESS-KEY';
|
||||
const FAKE_SESSION_TOKEN = 'MY-AWS-SESSION-TOKEN';
|
||||
const FAKE_REGION = 'fake-region-1';
|
||||
const ACTION_ENVIRONMENT_VARIABLES = {
|
||||
AWS_ACCESS_KEY_ID: FAKE_ACCESS_KEY_ID,
|
||||
AWS_SECRET_ACCESS_KEY: FAKE_SECRET_ACCESS_KEY,
|
||||
AWS_SESSION_TOKEN: FAKE_SESSION_TOKEN,
|
||||
AWS_DEFAULT_REGION: FAKE_REGION,
|
||||
AWS_REGION: FAKE_REGION,
|
||||
};
|
||||
|
||||
describe('Configure AWS Credentials', () => {
|
||||
const OLD_ENV = process.env;
|
||||
const mockedSTSClient = mockClient(STSClient);
|
||||
|
||||
describe('Configure AWS Credentials cleanup', {}, () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.spyOn(core, 'exportVariable').mockImplementation();
|
||||
jest.spyOn(core, 'setSecret').mockImplementation();
|
||||
jest.spyOn(core, 'setOutput').mockImplementation();
|
||||
jest.spyOn(core, 'setFailed').mockImplementation();
|
||||
process.env = { ...OLD_ENV, ...ACTION_ENVIRONMENT_VARIABLES };
|
||||
// Reset mock state
|
||||
vi.restoreAllMocks();
|
||||
mockedSTSClient.reset();
|
||||
// Mock GitHub Actions core functions
|
||||
vi.spyOn(core, 'exportVariable').mockImplementation((_n, _v) => {});
|
||||
vi.spyOn(core, 'setSecret').mockImplementation((_s) => {});
|
||||
vi.spyOn(core, 'setFailed').mockImplementation((_m) => {});
|
||||
vi.spyOn(core, 'setOutput').mockImplementation((_n, _v) => {});
|
||||
vi.spyOn(core, 'debug').mockImplementation((_m) => {});
|
||||
vi.spyOn(core, 'info').mockImplementation((_m) => {});
|
||||
process.env = {
|
||||
...mocks.envs,
|
||||
AWS_ACCESS_KEY_ID: 'CLEANUPTEST',
|
||||
AWS_SECRET_ACCESS_KEY: 'CLEANUPTEST',
|
||||
AWS_SESSION_TOKEN: 'CLEANUPTEST',
|
||||
AWS_REGION: 'CLEANUPTEST',
|
||||
AWS_DEFAULT_REGION: 'CLEANUPTEST',
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env = OLD_ENV;
|
||||
});
|
||||
|
||||
test('replaces AWS credential and region env vars with empty strings', () => {
|
||||
it('replaces AWS credential and region environment variables with empty strings', {}, () => {
|
||||
cleanup();
|
||||
expect(core.setFailed).toHaveBeenCalledTimes(0);
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(5);
|
||||
@@ -39,14 +38,11 @@ describe('Configure AWS Credentials', () => {
|
||||
expect(core.exportVariable).toHaveBeenCalledWith('AWS_DEFAULT_REGION', '');
|
||||
expect(core.exportVariable).toHaveBeenCalledWith('AWS_REGION', '');
|
||||
});
|
||||
|
||||
test('error is caught and fails the action', () => {
|
||||
jest.spyOn(core, 'exportVariable').mockImplementation(() => {
|
||||
throw new Error();
|
||||
it('handles errors', {}, () => {
|
||||
vi.spyOn(core, 'exportVariable').mockImplementationOnce(() => {
|
||||
throw new Error('Test error');
|
||||
});
|
||||
|
||||
cleanup();
|
||||
|
||||
expect(core.setFailed).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
+35
-16
@@ -1,26 +1,45 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import * as helpers from '../src/helpers';
|
||||
describe('helpers', () => {
|
||||
import * as core from '@actions/core';
|
||||
import { before, beforeEach } from 'node:test';
|
||||
|
||||
describe('Configure AWS Credentials helpers', {}, () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.clearAllMocks();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('removes brackets from GitHub Actor', () => {
|
||||
expect(helpers.sanitizeGitHubVariables('foo[bot]')).toEqual('foo_bot_');
|
||||
it('removes brackets from GitHub Actor', {}, () => {
|
||||
const actor = 'actor[bot]';
|
||||
expect(helpers.sanitizeGitHubVariables(actor)).toBe('actor_bot_');
|
||||
});
|
||||
|
||||
test('removes special characters from worflow names', () => {
|
||||
it('can sleep', {}, () => {
|
||||
const sleep = helpers.defaultSleep(10);
|
||||
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@__________+___:____');
|
||||
});
|
||||
|
||||
test('can sleep', () => {
|
||||
const sleep = helpers.defaultSleep(10);
|
||||
expect(Promise.race([sleep, new Promise((_res, rej) => setTimeout(rej, 20))])).resolves;
|
||||
});
|
||||
|
||||
test("backoff function doesn't retry non-retryable errors", async () => {
|
||||
const fn = jest.fn().mockRejectedValue('i am not retryable');
|
||||
it("doesn't retry non-retryable errors", {}, async () => {
|
||||
const fn = vi.fn().mockRejectedValue('i am not retryable');
|
||||
await expect(helpers.retryAndBackoff(fn, false)).rejects.toMatch('i am not retryable');
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
it('can output creds when told 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);
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||
expect(core.exportVariable).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
it('can unset credentials', {}, () => {
|
||||
const env = process.env;
|
||||
helpers.unsetCredentials();
|
||||
expect(process.env.AWS_ACCESS_KEY_ID).toBeUndefined;
|
||||
expect(process.env.AWS_SECRET_ACCESS_KEY).toBeUndefined;
|
||||
expect(process.env.AWS_SESSION_TOKEN).toBeUndefined;
|
||||
expect(process.env.AWS_REGION).toBeUndefined;
|
||||
expect(process.env.AWS_DEFAULT_REGION).toBeUndefined;
|
||||
process.env = env;
|
||||
});
|
||||
});
|
||||
|
||||
+276
-828
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
import type * as core from '@actions/core';
|
||||
|
||||
const inputs = {
|
||||
GH_OIDC_INPUTS: {
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
'special-characters-workaround': 'true',
|
||||
},
|
||||
IAM_USER_INPUTS: {
|
||||
'aws-access-key-id': 'MYAWSACCESSKEYID',
|
||||
'aws-secret-access-key': 'MYAWSSECRETACCESSKEY',
|
||||
'aws-region': 'fake-region-1',
|
||||
},
|
||||
IAM_ASSUMEROLE_INPUTS: {
|
||||
'aws-access-key-id': 'MYAWSACCESSKEYID',
|
||||
'aws-secret-access-key': 'MYAWSSECRETACCESSKEY',
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
},
|
||||
WEBIDENTITY_TOKEN_FILE_INPUTS: {
|
||||
'web-identity-token-file': 'file.txt',
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
},
|
||||
EXISTING_ROLE_INPUTS: {
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'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',
|
||||
}
|
||||
};
|
||||
|
||||
const envs = {
|
||||
GITHUB_REPOSITORY: 'MY-REPOSITORY-NAME',
|
||||
GITHUB_WORKFLOW: 'MY-WORKFLOW-ID',
|
||||
GITHUB_ACTION: 'MY-ACTION-NAME',
|
||||
GITHUB_ACTOR: 'MY-USERNAME[bot]',
|
||||
GITHUB_SHA: 'MY-COMMIT-ID',
|
||||
GITHUB_WORKSPACE: '/home/github',
|
||||
GITHUB_ACTIONS: 'true',
|
||||
};
|
||||
|
||||
const outputs = {
|
||||
STS_CREDENTIALS: {
|
||||
Credentials: {
|
||||
AccessKeyId: 'STSAWSACCESSKEYID',
|
||||
SecretAccessKey: 'STSAWSSECRETACCESSKEY',
|
||||
SessionToken: 'STSAWSSESSIONTOKEN',
|
||||
Expiration: new Date(8640000000000000),
|
||||
},
|
||||
AssumedRoleUser: {
|
||||
Arn: 'arn:aws:sts::111111111111:assumed-role/MY-ROLE/',
|
||||
AssumedRoleId: 'AROAFAKEASSUMEDROLEID',
|
||||
},
|
||||
},
|
||||
GET_CALLER_IDENTITY: {
|
||||
Account: '111111111111',
|
||||
Arn: 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
},
|
||||
FAKE_STS_ACCESS_KEY_ID: 'STSAWSACCESSKEYID',
|
||||
FAKE_STS_SECRET_ACCESS_KEY: 'STSAWSSECRETACCESSKEY',
|
||||
FAKE_STS_SESSION_TOKEN: 'STSAWSSESSIONTOKEN',
|
||||
ODD_CHARACTER_CREDENTIALS: {
|
||||
Credentials: {
|
||||
AccessKeyId: 'STSA#$%^&',
|
||||
SecretAccessKey: 'STSA#$%^&Key',
|
||||
SessionToken: 'STSA#$%^',
|
||||
Expiration: new Date(8640000000000000),
|
||||
},
|
||||
AssumedRoleUser: {
|
||||
Arn: 'arn:aws:sts::111111111111:assumed-role/MY-ROLE/',
|
||||
AssumedRoleId: 'AROAFAKEASSUMEDROLEID',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
getInput: (fakeEnv: Record<string, string>) => {
|
||||
return (name: string, options?: core.InputOptions): string => {
|
||||
if (!fakeEnv[name]) {
|
||||
if (options?.required) throw new Error(`Input ${name} not found`);
|
||||
return '';
|
||||
}
|
||||
return fakeEnv[name];
|
||||
};
|
||||
},
|
||||
getMultilineInput: (fakeEnv: Record<string, string[]>) => {
|
||||
return (name: string, options?: core.InputOptions): string[] => {
|
||||
if (!fakeEnv[name]) {
|
||||
if (options?.required) throw new Error(`Input ${name} not found`);
|
||||
return [];
|
||||
}
|
||||
return fakeEnv[name];
|
||||
};
|
||||
},
|
||||
...inputs,
|
||||
outputs,
|
||||
envs,
|
||||
} as const;
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"rootDir": "src"
|
||||
},
|
||||
}
|
||||
+7
-6
@@ -7,14 +7,13 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noPropertyAccessFromIndexSignature": false,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"module": "CommonJS",
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "build",
|
||||
"declaration": true,
|
||||
"declaration": false,
|
||||
"newLine": "lf",
|
||||
"noEmitOnError": true,
|
||||
"sourceMap": true,
|
||||
@@ -23,12 +22,14 @@
|
||||
"lib": [ "ES2020" ],
|
||||
"target": "ES2020",
|
||||
"noErrorTruncation": true,
|
||||
"esModuleInterop": true
|
||||
"esModuleInterop": true,
|
||||
"rootDir": "src",
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"exclude": [],
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
"test/**/*.ts",
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./"
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
passWithNoTests: true,
|
||||
include: ['test/**/*.test.ts'],
|
||||
coverage: { enabled: true },
|
||||
typecheck: { tsconfig: './tsconfig.test.json' },
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user