mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-02 05:55:10 +09:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b77dc22838 | |||
| 40fbf99f9b | |||
| bc03572061 | |||
| c831837ecb | |||
| 9a3b1bcbca | |||
| e798aff9bb | |||
| f99a28d036 | |||
| 96ec5c4c14 | |||
| 8ee391aeef | |||
| a679b609cc | |||
| c9874b9244 | |||
| 3e2ba00093 | |||
| fc72bd38db | |||
| a633ed5e02 | |||
| c8c5fb1fc0 | |||
| cf6b87e99e | |||
| 5ce6d03987 | |||
| 3d568d2c43 |
@@ -2,6 +2,22 @@
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
### [1.3.3](https://github.com/aws-actions/configure-aws-credentials/compare/v1.3.2...v1.3.3) (2020-04-02)
|
||||||
|
|
||||||
|
### [1.3.2](https://github.com/aws-actions/configure-aws-credentials/compare/v1.3.1...v1.3.2) (2020-03-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* let the AWS SDK determine the STS regional endpoint ([#48](https://github.com/aws-actions/configure-aws-credentials/issues/48)) ([fc72bd3](https://github.com/aws-actions/configure-aws-credentials/commit/fc72bd38dbe25493f5113760c9c6e1ef2f6f9a0e))
|
||||||
|
|
||||||
|
### [1.3.1](https://github.com/aws-actions/configure-aws-credentials/compare/v1.3.0...v1.3.1) (2020-03-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* validate region input string ([#44](https://github.com/aws-actions/configure-aws-credentials/issues/44)) ([3d568d2](https://github.com/aws-actions/configure-aws-credentials/commit/3d568d2c4359304d46d9bd1b4d9f69e088ccbf7b))
|
||||||
|
|
||||||
## [1.3.0](https://github.com/aws-actions/configure-aws-credentials/compare/v1.2.0...v1.3.0) (2020-03-06)
|
## [1.3.0](https://github.com/aws-actions/configure-aws-credentials/compare/v1.2.0...v1.3.0) (2020-03-06)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+63
-55
File diff suppressed because one or more lines are too long
@@ -1,7 +1,6 @@
|
|||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
const aws = require('aws-sdk');
|
const aws = require('aws-sdk');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const util = require('util');
|
|
||||||
|
|
||||||
// The max time that a GitHub action is allowed to run is 6 hours.
|
// The max time that a GitHub action is allowed to run is 6 hours.
|
||||||
// That seems like a reasonable default to use if no role duration is defined.
|
// That seems like a reasonable default to use if no role duration is defined.
|
||||||
@@ -10,6 +9,7 @@ const USER_AGENT = 'configure-aws-credentials-for-github-actions';
|
|||||||
const MAX_TAG_VALUE_LENGTH = 256;
|
const MAX_TAG_VALUE_LENGTH = 256;
|
||||||
const SANITIZATION_CHARACTER = '_';
|
const SANITIZATION_CHARACTER = '_';
|
||||||
const ROLE_SESSION_NAME = 'GitHubActions';
|
const ROLE_SESSION_NAME = 'GitHubActions';
|
||||||
|
const REGION_REGEX = /^[a-z0-9-]+$/g;
|
||||||
|
|
||||||
async function assumeRole(params) {
|
async function assumeRole(params) {
|
||||||
// Assume a role to get short-lived credentials using longer-lived credentials.
|
// Assume a role to get short-lived credentials using longer-lived credentials.
|
||||||
@@ -130,10 +130,9 @@ async function exportAccountId(maskAccountId, region) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getStsClient(region) {
|
function getStsClient(region) {
|
||||||
const endpoint = util.format('https://sts.%s.amazonaws.com', region);
|
|
||||||
return new aws.STS({
|
return new aws.STS({
|
||||||
region,
|
region,
|
||||||
endpoint,
|
stsRegionalEndpoints: 'regional',
|
||||||
customUserAgent: USER_AGENT
|
customUserAgent: USER_AGENT
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -151,6 +150,10 @@ async function run() {
|
|||||||
const roleDurationSeconds = core.getInput('role-duration-seconds', {required: false}) || MAX_ACTION_RUNTIME;
|
const roleDurationSeconds = core.getInput('role-duration-seconds', {required: false}) || MAX_ACTION_RUNTIME;
|
||||||
const roleSessionName = core.getInput('role-session-name', { required: false }) || ROLE_SESSION_NAME;
|
const roleSessionName = core.getInput('role-session-name', { required: false }) || ROLE_SESSION_NAME;
|
||||||
|
|
||||||
|
if (!region.match(REGION_REGEX)) {
|
||||||
|
throw new Error(`Region is not valid: ${region}`);
|
||||||
|
}
|
||||||
|
|
||||||
exportRegion(region);
|
exportRegion(region);
|
||||||
|
|
||||||
// Always export the source credentials and account ID.
|
// Always export the source credentials and account ID.
|
||||||
|
|||||||
@@ -154,6 +154,19 @@ describe('Configure AWS Credentials', () => {
|
|||||||
expect(core.setSecret).toHaveBeenCalledWith(FAKE_ACCOUNT_ID);
|
expect(core.setSecret).toHaveBeenCalledWith(FAKE_ACCOUNT_ID);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('validates region name', async () => {
|
||||||
|
process.env.SHOW_STACK_TRACE = 'false';
|
||||||
|
|
||||||
|
const mockInputs = {...CREDS_INPUTS, 'aws-region': '$AWS_REGION'};
|
||||||
|
core.getInput = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(mockGetInput(mockInputs));
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(core.setFailed).toHaveBeenCalledWith('Region is not valid: $AWS_REGION');
|
||||||
|
});
|
||||||
|
|
||||||
test('can opt out of masking account ID', async () => {
|
test('can opt out of masking account ID', async () => {
|
||||||
const mockInputs = {...CREDS_INPUTS, 'aws-region': 'us-east-1', 'mask-aws-account-id': 'false'};
|
const mockInputs = {...CREDS_INPUTS, 'aws-region': 'us-east-1', 'mask-aws-account-id': 'false'};
|
||||||
core.getInput = jest
|
core.getInput = jest
|
||||||
|
|||||||
Generated
+590
-650
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aws-actions-configure-aws-credentials",
|
"name": "aws-actions-configure-aws-credentials",
|
||||||
"version": "1.3.0",
|
"version": "1.3.3",
|
||||||
"description": "Configure AWS Credentials",
|
"description": "Configure AWS Credentials",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
"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.2.3",
|
"@actions/core": "^1.2.3",
|
||||||
"aws-sdk": "^2.633.0"
|
"aws-sdk": "^2.650.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@zeit/ncc": "^0.21.1",
|
"@zeit/ncc": "^0.22.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"jest": "^25.1.0"
|
"jest": "^25.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user