What's wrong
internal/models/audit_log_entry.go L105-111 builds every audit payload with "log_type": ActionLogTypeMap[action]. But ActionLogTypeMap (L56-79) has no entry for IdentityUnlinkAction ("identity_unlinked", declared at L44). In Go, a missing map key returns the zero value, so identity-unlink audit events are persisted with log_type: "" instead of user. The unlink at internal/api/identity.go still completes, but the audit record is misclassified and harder to filter/attribute.
How it should be
Add IdentityUnlinkAction: user to ActionLogTypeMap, consistent with the other user-facing identity/passkey actions (PasskeyCreatedAction, PasskeyUpdatedAction, PasskeyDeletedAction already map to user). Then unlink events are searchable/filterable by log_type like every other action.
Used versions
Observed against master @ ef6587a (source inspection).
OS information
N/A (source inspection).
Found while running Ito (AI code review, free for open source) against recently merged PRs — full analysis: https://app.ito.ai/share/6e38a9ea-323d-420a-a705-3d3f4053a41b.
What's wrong
internal/models/audit_log_entry.goL105-111 builds every audit payload with"log_type": ActionLogTypeMap[action]. ButActionLogTypeMap(L56-79) has no entry forIdentityUnlinkAction("identity_unlinked", declared at L44). In Go, a missing map key returns the zero value, so identity-unlink audit events are persisted withlog_type: ""instead ofuser. The unlink atinternal/api/identity.gostill completes, but the audit record is misclassified and harder to filter/attribute.How it should be
Add
IdentityUnlinkAction: usertoActionLogTypeMap, consistent with the other user-facing identity/passkey actions (PasskeyCreatedAction,PasskeyUpdatedAction,PasskeyDeletedActionalready map touser). Then unlink events are searchable/filterable bylog_typelike every other action.Used versions
Observed against
master@ef6587a(source inspection).OS information
N/A (source inspection).
Found while running Ito (AI code review, free for open source) against recently merged PRs — full analysis: https://app.ito.ai/share/6e38a9ea-323d-420a-a705-3d3f4053a41b.