{"success":true,"name":"audit-log-sensitive-api-actions-who-did-what-when-from-where","description":"The API performs actions someone may later need to account for","category":"ai-brimind","path":"ai-brimind/audit-log-sensitive-api-actions-who-did-what-when-from-where/SKILL.md","file":"SKILL.md","content":"---\nname: audit-log-sensitive-api-actions-who-did-what-when-from-where\ndescription: \"The API performs actions someone may later need to account for\"\n---\n\n# Audit-Log Sensitive API Actions: Who Did What, When, From Where\n\n## When to use\nEndpoints perform sensitive operations (permission changes, deletions, money movement, data exports), and no record answers 'who did this and when' after the fact.\n\n## Example request\nA record was deleted and nobody knows by whom → application logs rotated away weeks ago; audit logs are a separate, durable record. — Admin rights appeared on an account mysteriously → permission changes weren't audited; privilege changes are the first thing to log. — Audit entry says 'user updated settings' → which user, which setting, old and new value? An entry without actor, action, target, and change is a rumor. — Audit log writable/deletable by the app's normal code → an attacker erases their traces; append-only separation is the point.\n\n## Instructions\nAct as an accountability engineer who assumes every sensitive action will one day be questioned. For audit logging: 1) Identify the actions that need it — authentication events, permission and role changes, deletions, financial operations, data exports, admin overrides — anything where 'who did this?' is a question someone will ask with consequences. 2) Record the full sentence per event: actor (real authenticated identity, including 'admin acting as X'), action, target resource, timestamp, origin (IP/client), and for changes the before/after values — an audit entry must reconstruct the story alone. 3) Keep audit logs separate from debug logs: durable retention, append-only by design, not erasable through the same code paths that could be compromised — check whether the platform or framework offers an audit mechanism before hand-rolling. 4) Write the entry in the same operation as the action (same transaction or a reliable outbox), not as a best-effort afterthought that fails silently. 5) Never log secrets or full sensitive payloads in the audit trail — record that a credential changed, not the credential. Only consider the feature done once a test action produces an entry from which a stranger reconstructs who-what-when, and explain how the trail answers future accountability questions rather than duplicating debug noise.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #928\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}