mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-08-31 05:35:04 +09:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fd3084fc3 | |||
| d00f6c6f41 | |||
| ae734070a0 | |||
| 3d528c5f7d | |||
| e7aae61719 | |||
| 979ee1f6f4 | |||
| 184acc09ea | |||
| 375a690dc0 | |||
| 8337ca3433 |
@@ -37,7 +37,7 @@ jobs:
|
|||||||
# Issue timing
|
# Issue timing
|
||||||
days-before-stale: 5
|
days-before-stale: 5
|
||||||
days-before-close: 2
|
days-before-close: 2
|
||||||
days-before-ancient: 365
|
days-before-ancient: 36500
|
||||||
|
|
||||||
# If you don't want to mark a issue as being ancient based on a
|
# 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
|
# threshold of "upvotes", you can set this here. An "upvote" is
|
||||||
|
|||||||
+12
-1
@@ -2,10 +2,21 @@
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
## [2.2.0](https://github.com/aws-actions/configure-aws-credentials/compare/v2.1.0...v2.2.0) (2023-05-31)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
* `inline-session-policy` prop enables assuming a role with inline session policies ([d00f6c6](https://github.com/aws-actions/configure-aws-credentials/commit/d00f6c6f41fde02a9fd0d469040be6ed0df69e73))
|
||||||
|
* `managed-session-policies` prop enables assuming a role with managed policy arns ([d00f6c6](https://github.com/aws-actions/configure-aws-credentials/commit/d00f6c6f41fde02a9fd0d469040be6ed0df69e73))
|
||||||
|
|
||||||
|
## [2.1.0](https://github.com/aws-actions/configure-aws-credentials/compare/v2.0.0...v2.1.0) (2023-05-31)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
* `role-chaining` prop enables role chaining use case ([6fbd316](https://github.com/aws-actions/configure-aws-credentials/commit/6fbd316fd15f52c3d9f68e7aa06eae4f5699a518))
|
||||||
|
|
||||||
## [2.0.0](https://github.com/aws-actions/configure-aws-credentials/compare/v1.7.0...v2.0.0) (2023-03-06)
|
## [2.0.0](https://github.com/aws-actions/configure-aws-credentials/compare/v1.7.0...v2.0.0) (2023-03-06)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
* Version bump to use Node 16 by default.
|
* Version bump to use Node 16 by default.
|
||||||
|
|
||||||
## [1.7.0](https://github.com/aws-actions/configure-aws-credentials/compare/v1.6.1...v1.7.0) (2022-08-03)
|
## [1.7.0](https://github.com/aws-actions/configure-aws-credentials/compare/v1.6.1...v1.7.0) (2022-08-03)
|
||||||
|
|
||||||
|
|||||||
@@ -320,6 +320,49 @@ within the Action. You can skip this session tagging by providing
|
|||||||
role-skip-session-tagging: true
|
role-skip-session-tagging: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Inline session policy
|
||||||
|
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@v2
|
||||||
|
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@v2
|
||||||
|
with:
|
||||||
|
inline-session-policy: >-
|
||||||
|
{
|
||||||
|
"Version": "2012-10-17",
|
||||||
|
"Statement": [
|
||||||
|
{
|
||||||
|
"Sid":"Stmt1",
|
||||||
|
"Effect":"Allow",
|
||||||
|
"Action":"s3:List*",
|
||||||
|
"Resource":"*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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:
|
||||||
|
```yaml
|
||||||
|
uses: aws-actions/configure-aws-credentials@v2
|
||||||
|
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@v2
|
||||||
|
with:
|
||||||
|
managed-session-policies: |
|
||||||
|
arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
|
||||||
|
arn:aws:iam::aws:policy/AmazonS3OutpostsReadOnlyAccess
|
||||||
|
```
|
||||||
|
|
||||||
## Self-Hosted Runners
|
## Self-Hosted Runners
|
||||||
|
|
||||||
If you run your GitHub Actions in a
|
If you run your GitHub Actions in a
|
||||||
|
|||||||
@@ -61,6 +61,12 @@ inputs:
|
|||||||
role-chaining:
|
role-chaining:
|
||||||
description: 'Use existing credentials from the environment to assume a new role'
|
description: 'Use existing credentials from the environment to assume a new role'
|
||||||
required: false
|
required: false
|
||||||
|
inline-session-policy:
|
||||||
|
description: 'Inline session policy'
|
||||||
|
required: false
|
||||||
|
managed-session-policies:
|
||||||
|
description: 'List of managed session policies'
|
||||||
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
aws-account-id:
|
aws-account-id:
|
||||||
description: 'The AWS account ID for the provided credentials'
|
description: 'The AWS account ID for the provided credentials'
|
||||||
|
|||||||
Vendored
+159
-57
File diff suppressed because one or more lines are too long
@@ -29,7 +29,9 @@ async function assumeRole(params) {
|
|||||||
region,
|
region,
|
||||||
roleSkipSessionTagging,
|
roleSkipSessionTagging,
|
||||||
webIdentityTokenFile,
|
webIdentityTokenFile,
|
||||||
webIdentityToken
|
webIdentityToken,
|
||||||
|
inlineSessionPolicy,
|
||||||
|
managedSessionPolicies
|
||||||
} = params;
|
} = params;
|
||||||
assert(
|
assert(
|
||||||
[roleToAssume, roleDurationSeconds, roleSessionName, region].every(isDefined),
|
[roleToAssume, roleDurationSeconds, roleSessionName, region].every(isDefined),
|
||||||
@@ -86,6 +88,18 @@ async function assumeRole(params) {
|
|||||||
assumeRoleRequest.ExternalId = roleExternalId;
|
assumeRoleRequest.ExternalId = roleExternalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDefined(inlineSessionPolicy)) {
|
||||||
|
assumeRoleRequest.Policy = inlineSessionPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (managedSessionPolicies && managedSessionPolicies.length) {
|
||||||
|
const policyArns = []
|
||||||
|
for (const managedSessionPolicy of managedSessionPolicies) {
|
||||||
|
policyArns.push({arn: managedSessionPolicy})
|
||||||
|
}
|
||||||
|
assumeRoleRequest.PolicyArns = policyArns;
|
||||||
|
}
|
||||||
|
|
||||||
let assumeFunction = sts.assumeRole.bind(sts);
|
let assumeFunction = sts.assumeRole.bind(sts);
|
||||||
|
|
||||||
// These are customizations needed for the GH OIDC Provider
|
// These are customizations needed for the GH OIDC Provider
|
||||||
@@ -305,6 +319,8 @@ async function run() {
|
|||||||
const roleSkipSessionTagging = roleSkipSessionTaggingInput.toLowerCase() === 'true';
|
const roleSkipSessionTagging = roleSkipSessionTaggingInput.toLowerCase() === 'true';
|
||||||
const webIdentityTokenFile = core.getInput('web-identity-token-file', { required: false });
|
const webIdentityTokenFile = core.getInput('web-identity-token-file', { required: false });
|
||||||
const proxyServer = core.getInput('http-proxy', { required: false });
|
const proxyServer = core.getInput('http-proxy', { required: false });
|
||||||
|
const inlineSessionPolicy = core.getInput('inline-session-policy', { required: false });
|
||||||
|
const managedSessionPolicies = core.getMultilineInput('managed-session-policies', { required: false })
|
||||||
|
|
||||||
if (!region.match(REGION_REGEX)) {
|
if (!region.match(REGION_REGEX)) {
|
||||||
throw new Error(`Region is not valid: ${region}`);
|
throw new Error(`Region is not valid: ${region}`);
|
||||||
@@ -313,12 +329,12 @@ async function run() {
|
|||||||
exportRegion(region);
|
exportRegion(region);
|
||||||
|
|
||||||
// This wraps the logic for deciding if we should rely on the GH OIDC provider since we may need to reference
|
// This wraps the logic for deciding if we should rely on the GH OIDC provider since we may need to reference
|
||||||
// the decision in a few differennt places. Consolidating it here makes the logic clearer elsewhere.
|
// the decision in a few different places. Consolidating it here makes the logic clearer elsewhere.
|
||||||
const useGitHubOIDCProvider = () => {
|
const useGitHubOIDCProvider = () => {
|
||||||
// The assumption here is that self-hosted runners won't be populating the `ACTIONS_ID_TOKEN_REQUEST_TOKEN`
|
// The assumption here is that self-hosted runners won't be populating the `ACTIONS_ID_TOKEN_REQUEST_TOKEN`
|
||||||
// environment variable and they won't be providing a web idenity token file or access key either.
|
// environment variable, and they won't be providing a web identity token file or access key either.
|
||||||
// V2 of the action might relax this a bit and create an explicit precedence for these so that customers
|
// V2 of the action might relax this a bit and create an explicit precedence for these so that customers
|
||||||
// can provide as much info as they want and we will follow the established credential loading precedence.
|
// can provide as much info as they want, and we will follow the established credential loading precedence.
|
||||||
|
|
||||||
return roleToAssume && process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN && !accessKeyId && !webIdentityTokenFile && !roleChaining
|
return roleToAssume && process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN && !accessKeyId && !webIdentityTokenFile && !roleChaining
|
||||||
}
|
}
|
||||||
@@ -371,7 +387,9 @@ async function run() {
|
|||||||
roleSessionName,
|
roleSessionName,
|
||||||
roleSkipSessionTagging,
|
roleSkipSessionTagging,
|
||||||
webIdentityTokenFile,
|
webIdentityTokenFile,
|
||||||
webIdentityToken
|
webIdentityToken,
|
||||||
|
inlineSessionPolicy,
|
||||||
|
managedSessionPolicies
|
||||||
}) }, true);
|
}) }, true);
|
||||||
exportCredentials(roleCredentials);
|
exportCredentials(roleCredentials);
|
||||||
// We need to validate the credentials in 2 of our use-cases
|
// We need to validate the credentials in 2 of our use-cases
|
||||||
|
|||||||
+144
@@ -45,6 +45,7 @@ const DEFAULT_INPUTS = {
|
|||||||
'aws-region': FAKE_REGION,
|
'aws-region': FAKE_REGION,
|
||||||
'mask-aws-account-id': 'TRUE'
|
'mask-aws-account-id': 'TRUE'
|
||||||
};
|
};
|
||||||
|
const DEFAULT_MULTILINE_INPUTS = {}
|
||||||
const ASSUME_ROLE_INPUTS = {...CREDS_INPUTS, 'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION};
|
const ASSUME_ROLE_INPUTS = {...CREDS_INPUTS, 'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION};
|
||||||
|
|
||||||
const mockStsCallerIdentity = jest.fn();
|
const mockStsCallerIdentity = jest.fn();
|
||||||
@@ -90,6 +91,10 @@ describe('Configure AWS Credentials', () => {
|
|||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(mockGetInput(DEFAULT_INPUTS));
|
.mockImplementation(mockGetInput(DEFAULT_INPUTS));
|
||||||
|
|
||||||
|
core.getMultilineInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput(DEFAULT_MULTILINE_INPUTS));
|
||||||
|
|
||||||
core.getIDToken = jest
|
core.getIDToken = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(() => {
|
.mockImplementation(() => {
|
||||||
@@ -624,6 +629,49 @@ describe('Configure AWS Credentials', () => {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Web identity token file with a inline session policy', async () => {
|
||||||
|
const CUSTOM_SESSION_POLICY = "{ super_secure_policy }";
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION, 'web-identity-token-file': '/fake/token/file', 'inline-session-policy': CUSTOM_SESSION_POLICY}));
|
||||||
|
|
||||||
|
await run();
|
||||||
|
expect(mockStsAssumeRoleWithWebIdentity).toHaveBeenCalledWith({
|
||||||
|
RoleArn: 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||||
|
RoleSessionName: 'GitHubActions',
|
||||||
|
DurationSeconds: 6 * 3600,
|
||||||
|
Policy: CUSTOM_SESSION_POLICY,
|
||||||
|
WebIdentityToken: 'testpayload'
|
||||||
|
})
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(1, FAKE_ACCOUNT_ID);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(2, FAKE_STS_ACCESS_KEY_ID);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(3, FAKE_STS_SECRET_ACCESS_KEY);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(4, FAKE_STS_SESSION_TOKEN);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Web identity token file with a managed session policies', async () => {
|
||||||
|
const MANAGED_SESSION_POLICIES = ["arn:aws:iam::111111111111:policy/foo", "arn:aws:iam::111111111111:policy/bar"];
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION, 'web-identity-token-file': '/fake/token/file'}));
|
||||||
|
core.getMultilineInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'managed-session-policies': MANAGED_SESSION_POLICIES}))
|
||||||
|
|
||||||
|
await run();
|
||||||
|
expect(mockStsAssumeRoleWithWebIdentity).toHaveBeenCalledWith({
|
||||||
|
RoleArn: 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||||
|
RoleSessionName: 'GitHubActions',
|
||||||
|
DurationSeconds: 6 * 3600,
|
||||||
|
PolicyArns: [{arn: MANAGED_SESSION_POLICIES[0]}, {arn: MANAGED_SESSION_POLICIES[1]}],
|
||||||
|
WebIdentityToken: 'testpayload'
|
||||||
|
})
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(1, FAKE_ACCOUNT_ID);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(2, FAKE_STS_ACCESS_KEY_ID);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(3, FAKE_STS_SECRET_ACCESS_KEY);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(4, FAKE_STS_SESSION_TOKEN);
|
||||||
|
});
|
||||||
|
|
||||||
test('only role arn and region provided to use GH OIDC Token', async () => {
|
test('only role arn and region provided to use GH OIDC Token', async () => {
|
||||||
process.env.GITHUB_ACTIONS = 'true';
|
process.env.GITHUB_ACTIONS = 'true';
|
||||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
||||||
@@ -664,6 +712,51 @@ describe('Configure AWS Credentials', () => {
|
|||||||
expect(core.setSecret).toHaveBeenNthCalledWith(3, FAKE_STS_SESSION_TOKEN);
|
expect(core.setSecret).toHaveBeenNthCalledWith(3, FAKE_STS_SESSION_TOKEN);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('GH OIDC With inline session policy', async () => {
|
||||||
|
const CUSTOM_SESSION_POLICY = "{ super_secure_policy }";
|
||||||
|
process.env.GITHUB_ACTIONS = 'true';
|
||||||
|
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION, 'inline-session-policy': CUSTOM_SESSION_POLICY}));
|
||||||
|
|
||||||
|
await run();
|
||||||
|
expect(mockStsAssumeRoleWithWebIdentity).toHaveBeenCalledWith({
|
||||||
|
RoleArn: 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||||
|
RoleSessionName: 'GitHubActions',
|
||||||
|
DurationSeconds: 3600,
|
||||||
|
Policy: CUSTOM_SESSION_POLICY,
|
||||||
|
WebIdentityToken: 'testtoken'
|
||||||
|
});
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(1, FAKE_STS_ACCESS_KEY_ID);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(2, FAKE_STS_SECRET_ACCESS_KEY);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(3, FAKE_STS_SESSION_TOKEN);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('GH OIDC With managed session policy', async () => {
|
||||||
|
const MANAGED_SESSION_POLICIES = ["arn:aws:iam::111111111111:policy/foo", "arn:aws:iam::111111111111:policy/bar"];
|
||||||
|
process.env.GITHUB_ACTIONS = 'true';
|
||||||
|
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION}));
|
||||||
|
core.getMultilineInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'managed-session-policies': MANAGED_SESSION_POLICIES}))
|
||||||
|
|
||||||
|
await run();
|
||||||
|
expect(mockStsAssumeRoleWithWebIdentity).toHaveBeenCalledWith({
|
||||||
|
RoleArn: 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||||
|
RoleSessionName: 'GitHubActions',
|
||||||
|
DurationSeconds: 3600,
|
||||||
|
PolicyArns: [{arn: MANAGED_SESSION_POLICIES[0]}, {arn: MANAGED_SESSION_POLICIES[1]}],
|
||||||
|
WebIdentityToken: 'testtoken'
|
||||||
|
});
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(1, FAKE_STS_ACCESS_KEY_ID);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(2, FAKE_STS_SECRET_ACCESS_KEY);
|
||||||
|
expect(core.setSecret).toHaveBeenNthCalledWith(3, FAKE_STS_SESSION_TOKEN);
|
||||||
|
});
|
||||||
|
|
||||||
test('role assumption fails after maximun trials using OIDC Provider', async () => {
|
test('role assumption fails after maximun trials using OIDC Provider', async () => {
|
||||||
process.env.GITHUB_ACTIONS = 'true';
|
process.env.GITHUB_ACTIONS = 'true';
|
||||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
||||||
@@ -704,6 +797,57 @@ describe('Configure AWS Credentials', () => {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('inline session policy provided', async () => {
|
||||||
|
const CUSTOM_SESSION_POLICY = "{ super_secure_policy }";
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'inline-session-policy': CUSTOM_SESSION_POLICY}));
|
||||||
|
|
||||||
|
await run();
|
||||||
|
expect(mockStsAssumeRole).toHaveBeenCalledWith({
|
||||||
|
RoleArn: ROLE_ARN,
|
||||||
|
RoleSessionName: 'GitHubActions',
|
||||||
|
DurationSeconds: 6 * 3600,
|
||||||
|
Tags: [
|
||||||
|
{Key: 'GitHub', Value: 'Actions'},
|
||||||
|
{Key: 'Repository', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_REPOSITORY},
|
||||||
|
{Key: 'Workflow', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_WORKFLOW},
|
||||||
|
{Key: 'Action', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_ACTION},
|
||||||
|
{Key: 'Actor', Value: GITHUB_ACTOR_SANITIZED},
|
||||||
|
{Key: 'Commit', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_SHA},
|
||||||
|
{Key: 'Branch', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_REF},
|
||||||
|
],
|
||||||
|
Policy: CUSTOM_SESSION_POLICY
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
test('managed session policy provided', async () => {
|
||||||
|
const MANAGED_SESSION_POLICIES = ["arn:aws:iam::111111111111:policy/foo", "arn:aws:iam::111111111111:policy/bar"];
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS}));
|
||||||
|
core.getMultilineInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput({'managed-session-policies': MANAGED_SESSION_POLICIES}))
|
||||||
|
|
||||||
|
await run();
|
||||||
|
expect(mockStsAssumeRole).toHaveBeenCalledWith({
|
||||||
|
RoleArn: ROLE_ARN,
|
||||||
|
RoleSessionName: 'GitHubActions',
|
||||||
|
DurationSeconds: 6 * 3600,
|
||||||
|
Tags: [
|
||||||
|
{Key: 'GitHub', Value: 'Actions'},
|
||||||
|
{Key: 'Repository', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_REPOSITORY},
|
||||||
|
{Key: 'Workflow', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_WORKFLOW},
|
||||||
|
{Key: 'Action', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_ACTION},
|
||||||
|
{Key: 'Actor', Value: GITHUB_ACTOR_SANITIZED},
|
||||||
|
{Key: 'Commit', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_SHA},
|
||||||
|
{Key: 'Branch', Value: ENVIRONMENT_VARIABLE_OVERRIDES.GITHUB_REF},
|
||||||
|
],
|
||||||
|
PolicyArns: [{arn: MANAGED_SESSION_POLICIES[0]}, {arn: MANAGED_SESSION_POLICIES[1]}],
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
test('workflow name sanitized in role assumption tags', async () => {
|
test('workflow name sanitized in role assumption tags', async () => {
|
||||||
core.getInput = jest
|
core.getInput = jest
|
||||||
.fn()
|
.fn()
|
||||||
|
|||||||
Generated
+16
-16
@@ -10,13 +10,13 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"aws-sdk": "^2.1386.0",
|
"aws-sdk": "^2.1396.0",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"https-proxy-agent": "^5.0.1"
|
"https-proxy-agent": "^5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.42.0",
|
||||||
"jest": "^29.4.3"
|
"jest": "^29.4.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -680,18 +680,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "8.41.0",
|
"version": "8.42.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.42.0.tgz",
|
||||||
"integrity": "sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==",
|
"integrity": "sha512-6SWlXpWU5AvId8Ac7zjzmIOqMOba/JWY8XZ4A7q7Gn1Vlfg/SFFIlrtHXt9nPn4op9ZPAkl91Jao+QQv3r/ukw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@humanwhocodes/config-array": {
|
"node_modules/@humanwhocodes/config-array": {
|
||||||
"version": "0.11.8",
|
"version": "0.11.10",
|
||||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz",
|
||||||
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
|
"integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@humanwhocodes/object-schema": "^1.2.1",
|
"@humanwhocodes/object-schema": "^1.2.1",
|
||||||
@@ -1464,9 +1464,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/aws-sdk": {
|
"node_modules/aws-sdk": {
|
||||||
"version": "2.1386.0",
|
"version": "2.1396.0",
|
||||||
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1386.0.tgz",
|
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1396.0.tgz",
|
||||||
"integrity": "sha512-bmUvpNRR4x1YvTaAm7WK/2lSNVPrNuiYlleU47GA5Xskh8PKaWedGHvGinH2YwhC720hM0Qc4f4/snUPGJ0eYg==",
|
"integrity": "sha512-5tAzB4pO9mfwb4XbDIv7wj4IsxaLI+KEAUZ8CR80sh2OdsP9AVGtMGH61dH6DQbHxCiwtLyQuoy7gZEuXv2ldQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer": "4.9.2",
|
"buffer": "4.9.2",
|
||||||
"events": "1.1.1",
|
"events": "1.1.1",
|
||||||
@@ -1999,16 +1999,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.41.0",
|
"version": "8.42.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.42.0.tgz",
|
||||||
"integrity": "sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==",
|
"integrity": "sha512-ulg9Ms6E1WPf67PHaEY4/6E2tEn5/f7FXGzr3t9cBMugOmf1INYvuUwwh1aXQN4MfJ6a5K2iNwP3w4AColvI9A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.4.0",
|
"@eslint-community/regexpp": "^4.4.0",
|
||||||
"@eslint/eslintrc": "^2.0.3",
|
"@eslint/eslintrc": "^2.0.3",
|
||||||
"@eslint/js": "8.41.0",
|
"@eslint/js": "8.42.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.8",
|
"@humanwhocodes/config-array": "^0.11.10",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
|
|||||||
+2
-2
@@ -26,13 +26,13 @@
|
|||||||
"homepage": "https://github.com/aws-actions/configure-aws-credentials#readme",
|
"homepage": "https://github.com/aws-actions/configure-aws-credentials#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"aws-sdk": "^2.1386.0",
|
"aws-sdk": "^2.1396.0",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"https-proxy-agent": "^5.0.1"
|
"https-proxy-agent": "^5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.42.0",
|
||||||
"jest": "^29.4.3"
|
"jest": "^29.4.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user