Skip to content
WarHound AI

Application Security

Account deletion, session revocation and retention boundaries

This article details the technical boundaries of account deletion, emphasizing secure session revocation and the explicit handling of data retention limits during the account lifecycle termination process.

Observe. Explain. Retest.MAKE EVIDENCE USEFULWARHOUND / FIELD NOTESCONCEPTREVIEW NOTE / ILLUSTRATIVEOBSERVATIONEVIDENCERETESTObserve. Explain. Retest.MAKE EVIDENCE USEFULOBSERVATIONEVIDENCERETESTWARHOUND / CONCEPTUAL ILLUSTRATION
Useful security reviews connect an observation to evidence and a deliberate retest. Conceptual illustration.

Introduction to Deletion Boundaries

Account deletion coordinates authentication, authorization and data-retention boundaries. Removing an account row does not automatically invalidate every session, API key, download link or queued job. Define which records are deleted, which must be retained for a stated purpose, and which credentials lose authority immediately. A deletion request must itself require an authenticated, CSRF-protected flow with reauthentication appropriate to the risk.

Session Revocation Mechanics

When an account is deleted, the session management system must immediately revoke all active sessions associated with that user. The session ID binds user authentication credentials to HTTP traffic. Therefore, invalidating the session at the server level is paramount.

Storing random session tokens verbatim leaves them vulnerable to read-only disclosure. One implementation option is an identifier and secret verifier split. The server stores the public lookup identifier and the SHA-256 hash of the verifier. Deletion involves removing this hash and identifier, preventing any further session validation.

Safe Deletion Test Matrix

Testing deletion pathways requires validating the exact behavior of state after the deletion event. Below is a synthetic test matrix defining expected allowed and denied outcomes for operations following an account deletion.

  • Use active session token after deletion: Denied
  • Attempt fresh login with deleted credentials: Denied
  • Access public resources with cached expired session ID: Allowed (if resource is truly unauthenticated)
  • Submit valid CSRF token tied to deleted session: Denied
  • Attempt to use split-verifier identifier without valid hash: Denied

Implementation Tradeoffs and Failure Modes

Implementing robust deletion involves tradeoffs. A soft delete (marking a record as deleted) simplifies recovery but risks unintentional data retention and compliance violations. A hard delete ensures removal but complicates auditing and referential integrity in relational stores.

Common failure modes include unlinked cache entries where an application server purges the primary database record but leaves a valid session in a distributed cache, or allowing an in-flight request to complete using a token that was revoked milliseconds prior.

Explicit Evidence Limits

Evaluating deletion completeness relies on server responses and observing state changes. External observation cannot definitively confirm the physical destruction of data on disks or the purging of backup media. Verifying compliance requires internal auditing of logging systems, backup rotations, and database configurations.

Make deletion a state transition with a recovery path

In a synthetic service, account A owns document D and has two browser sessions, one API key and a queued export. Begin deletion by moving A into a deletion-pending state in a transaction. Sensitive handlers should reject that state through a shared authorization check; login and token refresh should do the same. Revoke the sessions and API key, then enqueue cleanup through a transactional outbox or another mechanism that cannot silently lose the cleanup request after the transaction commits. This example is a design to test, not a claim about a particular product.

Treat cleanup as idempotent work. A worker may retry after a timeout without knowing whether an object was removed. Record progress by resource class and make repeated deletion of an already absent object harmless. A failed storage cleanup should not reactivate credentials. Conversely, avoid reporting that every copy was erased when only the primary account transaction succeeded. Distinguish access revocation, primary-store cleanup and retention expiry in internal status and in any promises made to the account owner.

Include asynchronous paths in the test matrix. Pause the export worker after it reads the job but before it reads document D, delete A, then release the worker. The expected result is rejection when the worker rechecks account state before sensitive access or publication. Repeating the test with an active synthetic account supplies the positive control. Also exercise an already issued download link: its behavior depends on whether it is checked online or remains valid until a documented expiry. Do not claim immediate revocation for a bearer link that the serving layer cannot revoke.

Finally, test restoration procedures. Backups may retain old rows until their retention window ends; a database restore can reintroduce deleted accounts or session records. Maintain a protected deletion ledger or an equivalent reconciliation process with a defined retention basis, and apply it before restored services accept traffic. Restrict who can read that ledger, minimize personal data in it, and document the residual retention honestly. These internal controls require operator evidence; a public HTTP response cannot establish that backup copies have been physically destroyed.

Sources and Acknowledgments

The guidelines for session management, including split verifier design and cookie attributes, are sourced from the OWASP Session Management Cheat Sheet.

Drafted with Gemini and checked for source links, advisory identifiers, structure and unsupported product claims. Examples are synthetic and are not scan results.

Drafted with Gemini and checked for source links, advisory identifiers, structure and unsupported product claims. Examples are synthetic and are not scan results.

Prepared with AI assistance and published by WarHound AI. Check the references and evidence limits in each article.

The WarHoundAI journal

Questions or a factual correction? Get in touch with the article URL and supporting evidence.

Continue reading.

All articles
Application Security

Archive extraction: traversal, symlinks and resource exhaustion

Processing ZIP archives introduces significant risks including path traversal, arbitrary file writes via symlinks, and resource exhaustion. This guide covers safe extraction techniques, testing matrices, and implementation tradeoffs based on OWASP standards.

Read article 6 min read
Application Security

WebSocket authentication and message authorization

Unlike standard HTTP requests, WebSocket connections remain open for persistent bidirectional data exchange, rendering traditional request-based security filters ineffective. Application engineers must implement custom authentication during the initial handshake, continuously manage session validity over long-lived connections, and authorize individual messages independently to prevent hijacking and unauthorized data access.

Read article 6 min read
Database Security

Tenant isolation with PostgreSQL row security

PostgreSQL Row-Level Security (RLS) provides a robust mechanism for enforcing tenant isolation directly at the database layer. By defining permissive and restrictive policies, application engineers can ensure that data access is restricted on a per-user or per-tenant basis prior to application-level filtering. This article details the implementation of these policies, addresses critical race conditions in policy subqueries, and outlines a comprehensive testing matrix to verify isolation boundaries.

Read article 5 min read