mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-02 05:55:10 +09:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf6b87e99e | |||
| 5ce6d03987 | |||
| 3d568d2c43 |
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
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.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
+5
@@ -137,6 +137,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.
|
||||||
@@ -278,6 +279,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.
|
||||||
|
|||||||
@@ -10,6 +10,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.
|
||||||
@@ -151,6 +152,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
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aws-actions-configure-aws-credentials",
|
"name": "aws-actions-configure-aws-credentials",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aws-actions-configure-aws-credentials",
|
"name": "aws-actions-configure-aws-credentials",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"description": "Configure AWS Credentials",
|
"description": "Configure AWS Credentials",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user