[CXH-205] - Report IAM console last login separately from access key activity - AWS Connector - #151
Conversation
…tivity Last Login was mixing PasswordLastUsed with access-key usage and keeping the oldest timestamp, which hid console sign-ins and made automated keys look like human activity. Keep Last Login on password sign-in, surface key activity on the user profile and per-key secrets, and document the optional flags. Co-authored-by: Cursor <cursoragent@cursor.com>
Connector PR Review: [CXH-205] - Report IAM console last login separately from access key activity - AWS ConnectorBlocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0 Review SummaryThe new commit reworks Security IssuesNone found. Correctness IssuesNone found. Suggestions
Prompt for AI agentsNote: this review run could not write the machine-readable review-state marker (the CI sandbox blocked every route to emitting it), so the next review will run in full mode rather than incremental. |
…example ConductorOneReadAccess already grants iam:ListAccessKeys; leaving it on IAMListPermissions contradicted the updated notes and the Terraform example. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Ran a deep code review (8 finders + SDK-aware verification) over this diff — came back clean, nothing to block on. 🎉 A few things worth calling out though, not bugs, just fyi:
One non-code thing from the ticket thread: the PR description flags that whether Clario's misleading Last Login is on an IAM user vs an Identity Center/SSO user is still unconfirmed with the customer (per Mateo's comment). Worth getting that answer landed before merge/release messaging, since this PR is scoped to the IAM path only. |
A failed GetAccessKeyLastUsed was indistinguishable from a never-used key, so callers skipped writing access_key_last_used without a per-key log. Return the error, log Debug with the key id, and keep the N/A guards plus inactive-key status wording accurate. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Dug into
Went and checked whether that's actually justified, both against our own docs and against real AWS behavior: AWS's own docs say this failure mode is common at this connector's scale, not rare:
So this isn't "Debug is wrong" in the abstract — Warn-per-item at org scale really would be noisy, that part's a fair concern. But we already have the right tool for that (the sampling pattern) and this commit reached for plain Debug instead, which means if the connector role loses Side note on the two docs claims this whole feature rests on, for the record (both check out against AWS's actual API docs):
Fun fact for context: Rule 4 + the sampling pattern both landed in |
Description
CXH-205 is the Clario request to tell console sign-in apart from access-key activity, and to review IAM access keys (active vs inactive, last used). Geoff's #123 already added
console_access_enabledviaiam:GetLoginProfile. This PR does the remaining work: IAM Last Login was mixing password sign-in with access-key use and keeping the oldest timestamp, so a console login could disappear and an automated key could keep a user looking active.I split the two signals. Last Login is
PasswordLastUsedonly. Key activity stays onaccess_key_last_usedon the IAM user, and on each access-key secret when Sync secrets is on (status, last used, service, region, owner keyed by the user's ARN). Nikki noted in March that Clario signs in through SSO; I asked her to confirm whether the misleading Last Login they see is on an IAM user or an Identity Center user. This change is on the IAM path. Identity Center last login is a separate CloudTrail feed (--sync-sso-user-last-login) and is not this bug.Sync:
iam_user) — Last Login is password-based AWS sign-in (PasswordLastUsed), including Management Console. Profile now carriespassword_last_usedandaccess_key_last_used. Never-signed-in stays unset.console_access_enabledis unchanged from feat: surface IAM user console access (LoginProfile) status #123 and still gated by--sync-iam-user-console-access.sso_user) — unchanged. They cannot hold access keys. Last login still comes from the CloudTrail event feed when Organizations + Identity Center +--sync-sso-user-last-loginare all on.access-key) — when--sync-secretsis on: Active/Inactive status, last-used timestamp, service, region. Unused keys omit the N/A placeholders. Secret owner/identity now use the IAM user ARN so C1 can resolve the key to its user (UserId previously matched nothing). Inactive keys are synced as disabled, not dropped.Provisioning:
Auth:
Unchanged (access key / assume-role). No new required flags.
--sync-secretsand--sync-iam-user-console-accessremain off by default. Last Login itself does not depend on them. Per-key Inventory andconsole_access_enabledstill need those settings on the tenant.--sync-sso-user-last-loginis also off by default and needs Organizations + Identity Center +cloudtrail:LookupEvents.Architecture highlights:
UserTrait.LastLogin. Folding key use into it makes dormant-console review impossible, so the field is password-only by design.access_key_last_usedon the user does not require Sync secrets;ListAccessKeys/GetAccessKeyLastUsedalready run on the IAM user path.CreatedById/IdentityIdmust be the IAM user ARN, becauseiam_userresources are keyed by ARN.iam:GetLoginProfileon existing policy Sids (Sids not renamed), optionalcloudtrail:LookupEventsSid for SSO last login.Useful links: