wasAsked.

Design an audit trail for sensitive changes that is useful to support teams and resistant to tampering.

Swiggy · Full Stack Developer · 3-4-years · technical

Published

Year not specified · .NET, Authentication & Security, System Design

Community answers

Posted by wasAsked editorial collection

An audit record should capture who, what, when, where, and the business correlation: actor ID, action, entity type/ID, UTC timestamp, tenant, request ID, and safe before/after values. Write it in the same transaction as the change when omission is unacceptable. Example fields: Audit(Id, RestaurantId, OutletId, ActorId, Action, EntityType, EntityId, OccurredAtUtc, CorrelationId, BeforeJson, AfterJson) Make the log append-only with tightly restricted access and tamper-evidence or immutable storage for high-risk systems. Redact secrets, tokens, payment data, and unnecessary personal data. Index tenant/time/entity queries, define retention, and distinguish audit events from diagnostic logs. Capture the authenticated actor and tenant server-side, not from request payloads.

Backbencher Developer · · 0 likes

Sign in to add your answer

Related interview topics