Skip to content

Commit 7a84f96

Browse files
committed
CLDSRV-893: add test for non-assumed-role ARN fallthrough
1 parent 0e182c3 commit 7a84f96

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/unit/utils/serverAccessLogger.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,19 @@ describe('serverAccessLogger utility functions', () => {
323323
assert.strictEqual(result, arn);
324324
});
325325

326+
it('should fall through to IAM user path for non-assumed-role ARN', () => {
327+
const authInfo = {
328+
isRequesterPublicUser: () => false,
329+
isRequesterAnIAMUser: () => true,
330+
getArn: () => 'arn:aws:iam::123456789012:user/myuser',
331+
getIAMdisplayName: () => 'myuser',
332+
getAccountDisplayName: () => 'myaccount',
333+
getCanonicalID: () => 'canonicalID789',
334+
};
335+
const result = getRequester(authInfo);
336+
assert.strictEqual(result, 'myuser:myaccount');
337+
});
338+
326339
it('should return canonical ID for regular user', () => {
327340
const authInfo = {
328341
isRequesterPublicUser: () => false,

0 commit comments

Comments
 (0)