Media Contact Verification — SMS OTP Backend Audit Log Retention and Recovery
A media contact form using an SMS OTP backend for buyer verification incurs more than a messaging bill: account for authentication attempts, audit log retention, replicated storage, and the staff time needed to reconstruct a disputed routing decision or recovery event. Quantify those terms first. For a proposed policy retaining full submissions for 30 days, body-storage demand is 30 × daily accepted submissions × average stored body size, before replicas and backups. Those are planning variables, not measured traffic or a legally prescribed retention period; without their values, declaring SMS or storage the dominant expense would be speculation.
Short answer: separate SMS OTP verification from the contact-form payload, throttle both sending and checking, and make the verification-to-queue transition idempotent with a durable audit record. Keep recovery codes outside message logs. Reduce retained message bodies after identifying which evidence a dispute requires; removing routine payload copies changes the storage term directly.
The implementation question is how a two-factor authentication backend can support buyer verification without turning its audit trail into a second repository of private correspondence. In this proposed example, a media publisher operates a marketplace and routes purchase-access requests and editorial corrections to different support queues. SMS verification establishes an authentication condition. It does not establish that a buyer owns a particular order.
What should an SMS OTP backend audit log retain for contact routing?
Begin with the decision being defended. For purchase-access support, the proposed rule requires an authenticated account, a satisfied step-up challenge, and a server-side association between that account and the referenced purchase; an editorial correction follows a different queue rule and should not acquire a purchase requirement merely because both requests arrive through one form. A field declaring a category is an input to routing, not authority to view another buyer's records. Record the version of the rule that made the decision so that an investigation can explain what was evaluated at the time.
Keep evidence minimal.
A useful proposed event contains a submission identifier, a pseudonymous account reference, the challenge identifier, the verification outcome, the routing-policy version, the queue decision, and the committed timestamp. Omit the OTP, recovery-code value, and free-text body. OWASP's Logging Cheat Sheet identifies authentication passwords, access tokens, and sensitive personal data as information that should generally be excluded or handled carefully; the corresponding design principle here is to record the authentication event without recording the secret used to obtain it. Pseudonymous references still need access controls and retention decisions. They are not automatically anonymous.
An audit entry can demonstrate an application decision, but cannot by itself demonstrate lawful processing, an appropriate retention period, or permission to send unrelated messages. GDPR Article 5 supplies principles of data minimisation and storage limitation where that regulation applies; it does not supply a universal number of days for this contact form. The retention schedule needs a documented purpose, applicable obligations, and an owner who can justify each retained field.
An audit trail is evidence within that process, not a compliance certificate.
Bound verification, throttling, and recovery separately
For two-factor authentication, assume the buyer has already authenticated with a separate factor before the SMS challenge. Phone possession alone should not be described as two factors. NIST SP 800-63B treats authentication over the public switched telephone network as restricted and discusses associated risk indicators; the backend therefore needs an explicit policy for when SMS is acceptable, when another approved method is required, and how account recovery is assessed. Neither carrier acceptance nor an SMS delivery receipt proves that the intended buyer completed a challenge.
The proposed challenge state machine separates issuance from consumption. Store a protected verifier rather than a recoverable plaintext code, bind the challenge to the account and intended action, enforce expiry, and atomically consume it on a successful check. Because an OTP has a small search space, a plain unkeyed digest is an insufficient default against offline guessing; select a protection scheme with a separately managed secret and review it together with the threat model. Rate limits belong on code checks as well as sends, since a quiet messaging channel says little about the number of guesses submitted to the application.
Use distinct budgets for account, destination, and network signals, with policy values chosen from expected traffic and abuse analysis. Requesting another code must not silently refresh the guessing budget. Otherwise, an attacker can repeatedly request fresh challenges to prolong a guessing campaign, while a legitimate buyer experiences the resulting lockouts as a support failure.
Recovery is another transition.
Following OWASP's Multifactor Authentication Cheat Sheet, provide carefully controlled recovery options and treat factor replacement as a sensitive operation. For a proposed recovery-code implementation, display generated codes through the authenticated setup flow, retain protected verifiers, and atomically consume each code once. A support agent should see that recovery occurred and what authorization followed, never a code that can still authenticate. Recovery must preserve the distinction between account access and purchase ownership.
Commit one routing decision, then deliver its effects
An exactly-once mindset is useful at the database boundary: one accepted submission should have one committed routing decision, even if the browser retries or the worker restarts. It cannot justify a promise of exactly-once SMS delivery across external systems. Design the local transaction so that challenge consumption, submission acceptance, audit evidence, and an outbox event either commit together or remain uncommitted. This proposed architecture requires a database transaction and uniqueness constraints; an application-level check followed by an unrelated insert does not enforce the same invariant.
The following Go interface describes that boundary. It delegates the transaction to the storage implementation; it is not a complete OTP verifier, and an interface alone cannot enforce atomicity.
package routing import "context" type AcceptCommand struct { AccountID string SubmissionID string IdempotencyKey string ChallengeID string PayloadDigest string PolicyVersion string } type RoutingReceipt struct { DecisionID string QueueID string } type Acceptor interface { // Atomically check authorization and challenge state, consume the // challenge, and persist the decision, audit record, and outbox event. // Replay only for the same account, key, and payload. // Reject reuse of a key with a different payload. Accept(context.Context, AcceptCommand) (RoutingReceipt, error) } Account-scoped idempotency keys need a payload binding. If the first request targets purchase support and a retry changes the category or purchase reference, returning the original success without checking the binding hides a materially different request. The storage layer should recognize a committed replay before requiring consumption of the already-used challenge, while a conflicting payload should fail. A fresh request with a new key must still satisfy the challenge policy. The digest belongs to this consistency check; it does not replace encryption, authorization, or an assessment of whether low-entropy fields can be guessed.
Commit before acknowledging.
After commitment, a worker can deliver the outbox event to the selected queue. Consumers should deduplicate by the immutable decision identifier, because a worker may repeat delivery after a crash between sending and recording completion. Record processing attempts separately from the final routing decision so that retries do not appear to be additional successful verifications. The additional transactional machinery costs implementation and operational effort, but preserves a distinction an investigator needs: one authorization decision can produce several delivery attempts.
Test the evidence lifecycle before shortening retention
Test simultaneous checks of the same challenge, duplicate submissions with identical keys, key reuse with a changed purchase reference, requests for another SMS during throttling, and reuse of a consumed recovery code. Add a worker crash after delivery but before acknowledgement. Assert invariants: one committed decision for an accepted idempotent request, no reuse of a consumed secret, and no unauthorized purchase association. Inspect rejected-request logs too; error handlers can leak secrets even when the success path excludes them.
Deployment should preserve the ability to interpret old events. Version routing rules, review schema migrations that affect uniqueness or expiry, and reconcile committed decisions against pending queue work. Monitor the age of pending outbox entries and counts of rejected checks, consumed challenges, recovery events, and accepted submissions, using aggregate metrics rather than phone numbers as metric labels. An unexplained divergence should trigger investigation. A reconciliation job must not manufacture a successful verification.
Return to the bill. If message bodies dominate retained bytes, replacing routine copies with compact decision records changes the dominant storage term; if repeated sends dominate messaging volume, submission deduplication and issuance controls address a different term. Production measurements must resolve which dominates. Include backup expiry and deletion work, since deleting the primary row does not describe the lifetime of every retained copy.
The proposed boundary deliberately stops keeping expired OTP material, consumed recovery-code material after its necessary lifecycle, and routine contact-body copies in authentication logs. Retain decision metadata only for its documented purpose and period, with a process for exceptions such as an applicable preservation obligation. This sacrifices the ability to reproduce every disputed message verbatim or replay a historical challenge. When something goes wrong, investigators must work from surviving decision evidence and any separately justified support record; that narrower reconstruction is the operational cost of collecting less.
References
NIST supports the distinction between factors and the limitations of SMS. OWASP informs secret exclusion and recovery controls. GDPR Article 5 supplies the cited retention principles; applicability and a concrete schedule require separate assessment. Source URLs follow.
Further reading
- NIST SP 800-63B, Authentication and Authenticator Management: https://pages.nist.gov/800-63-4/sp800-63b.html
- OWASP Logging Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html
- OWASP Multifactor Authentication Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Multifactor_Authentication_Cheat_Sheet.html
- Regulation (EU) 2016/679, Article 5: https://eur-lex.europa.eu/eli/reg/2016/679/oj/eng