mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-03 06:05:04 +09:00
feat: Recommending using OIDC (#871)
* Recommending using OIDC * Added tests * fix test and package * update readme --------- Co-authored-by: peterwoodworth <woodwoop@amazon.com>
This commit is contained in:
@@ -105,6 +105,9 @@ describe('Configure AWS Credentials', () => {
|
||||
jest.spyOn(core, 'info').mockImplementation((string) => {
|
||||
return string;
|
||||
});
|
||||
jest.spyOn(core, 'warning').mockImplementation((string) => {
|
||||
return string;
|
||||
});
|
||||
(fromEnv as jest.Mock)
|
||||
.mockImplementationOnce(() => () => ({
|
||||
accessKeyId: FAKE_ACCESS_KEY_ID,
|
||||
@@ -868,4 +871,23 @@ describe('Configure AWS Credentials', () => {
|
||||
|
||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||
});
|
||||
|
||||
test('prints warning for access key usage and no session token', async () => {
|
||||
jest.spyOn(core, 'getInput').mockImplementation(mockGetInput(ASSUME_ROLE_INPUTS));
|
||||
|
||||
await run();
|
||||
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
'To avoid using long-term AWS credentials, please update your workflows to authenticate using OpenID Connect.' +
|
||||
' See https://s12d.com/gha-oidc-aws for more information.'
|
||||
);
|
||||
});
|
||||
|
||||
test('skips warning for access key usage with session token', async () => {
|
||||
jest.spyOn(core, 'getInput').mockImplementation(mockGetInput(DEFAULT_INPUTS));
|
||||
|
||||
await run();
|
||||
|
||||
expect(core.warning).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user