-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(credential-providers): source accountId from credential providers #6019
base: main
Are you sure you want to change the base?
Changes from all commits
fb25928
fb513c5
c52b6e3
5fe84de
8e1a808
0900e21
dc3b765
04e020d
11c08d1
daaab14
7a10dc3
5fb2d38
5dc9927
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ export interface StaticCredsProfile extends Profile { | |
aws_secret_access_key: string; | ||
aws_session_token?: string; | ||
aws_credential_scope?: string; | ||
aws_account_id?: string; | ||
} | ||
|
||
/** | ||
|
@@ -20,7 +21,8 @@ export const isStaticCredsProfile = (arg: any): arg is StaticCredsProfile => | |
typeof arg === "object" && | ||
typeof arg.aws_access_key_id === "string" && | ||
typeof arg.aws_secret_access_key === "string" && | ||
["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1; | ||
["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 && | ||
["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there doesn't seem to be any point to this check, or the aws_session_token one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ● isStaticCredsProfile › value at 'aws_session_token' is not of type string | undefined
expect(received).toEqual(expected) // deep equality
Expected: false
Received: true
30 | it.each(["aws_session_token"])("value at '%s' is not of type string | undefined", (key) => {
31 | [true, null, 1, NaN, {}].forEach((value) => {
> 32 | expect(isStaticCredsProfile({ ...getMockStaticCredsProfile(), [key]: value })).toEqual(false);
| ^
33 | });
34 | });
35 |
at src/resolveStaticCredentials.spec.ts:32:86
at Array.forEach (<anonymous>)
at src/resolveStaticCredentials.spec.ts:31:30 unit test seems to fail when i remove these checks (for both session token and accountId). we'll have to change the unit tests for these as well. |
||
|
||
/** | ||
* @internal | ||
|
@@ -34,6 +36,7 @@ export const resolveStaticCredentials = ( | |
accessKeyId: profile.aws_access_key_id, | ||
secretAccessKey: profile.aws_secret_access_key, | ||
sessionToken: profile.aws_session_token, | ||
credentialScope: profile.aws_credential_scope, | ||
...(profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }), | ||
...(profile.aws_account_id && { accountId: profile.aws_account_id }), | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added and left the interface here instead of a new file, since the overhead of copying a new file to clients seems more than having a single interface present here. if we find ourselves adding many STS interfaces, we should consider refactoring a little.