skip to content

When a teacher signs out of a gradebook web app on a shared classroom laptop, what must be wiped, and how do you make sure it happened?

level: seniorimportance: should knowfreq 33%

answer

  1. every copy, not just the cookie
  2. unsent work first, then the wipe
  3. the local wipe needs no network
  4. a server header as the backstop
  5. a walked-away teacher still gets wiped

basics

~20 s

Every copy of the teacher's data: IndexedDB, the worker's caches, Web Storage, the HTTP cache and every tab's memory. Settle unsent work first, wipe locally without the network, send Clear-Site-Data as a backstop, and test it.

solid answer

~50 s

Signing out has to remove every copy of the teacher's data, not just end the session: the IndexedDB queue and cached rosters and grades, the photos and API responses in Cache Storage, anything in Web Storage, the HTTP cache, and in-memory state in every open tab. I'd do it in order. First, unsent marks: try to send them, and if that fails, say how many will be lost and let the teacher wait or discard. Then tell the other tabs to drop their state, delete the stores locally, which needs no network, and navigate to a blank sign-in page. Finally the server revokes the session and its sign-out response carries `Clear-Site-Data: "cache", "cookies", "storage"` as a backstop. Because teachers walk away without signing out, an idle timeout runs the same wipe, and an end-to-end test enumerates every store after sign-out.

go deeper

for a junior

Recall that signing out must delete the data the app stored on the device, not just end the session.

for a middle

List every store the app writes to, and explain why the local wipe must work without a network.

for a senior

Order the sequence around unsent work, add the idle and start-up checks, and weigh what the backstop header's storage directive costs.

for a principal

Make the wipe a shared, tested capability with a list of approved stores, so a new feature cannot add an unwiped copy.

## Why sign-out is a data problem On a teacher's own phone, signing out mostly ends a session. On a **shared classroom laptop**, the next person to sit down could be a pupil. Everything the gradebook stored for offline use, rosters with photos, grade history, a queue of unsent marks, is personal data about children, and it sits in several browser stores that a login screen does not protect. Signing out must remove **every copy**. ## Where the copies live | Store | What the gradebook keeps there | Removed by | |---|---|---| | IndexedDB | Write queue, cached rosters and grades | Deleting the app's databases | | Cache Storage | Photos, API responses cached by the worker | Deleting the user-data caches | | Web Storage | Small preferences, perhaps the last class viewed | Clearing it | | HTTP cache | Responses the browser cached on its own | `Clear-Site-Data: "cache"`; `no-store` avoids it | | Memory | Stores and component state in every open tab | Navigating each tab away | | Cookies | The session | Server revocation and `"cookies"` | Parent messages appear nowhere in this table: they are fetched live, sent with `no-store` and never stored, which is the cheapest wipe of all. ## Limit what is stored before you have to wipe it - **Ask at sign-in** whether this is a shared computer, and default to yes on school-managed laptops. - On a shared device, keep only **today's** classes, not the whole term. - Don't request persistent storage there: it is for keeping data, and here the goal is not to. - Use a **shorter idle timeout** on shared devices. ## The sign-out sequence 1. **Settle unsent work.** If the queue holds entries, try to send them. If that fails, say so plainly ("4 attendance marks are not sent; signing out deletes them") and offer to stay signed in until they send, or to discard them explicitly. Parked conflicts must be resolved or discarded too. 2. **Tell the other tabs.** Every tab holding the teacher's data must drop it and leave; the cross-tab message itself is another question's subject. 3. **Wipe locally.** Delete the app's IndexedDB databases, delete the user-data caches in Cache Storage (the release's shell cache can stay if it holds nothing personal), clear Web Storage, and clear in-memory stores. None of this needs the network, which matters because sign-out often happens offline. 4. **Leave the page.** Navigate to a blank sign-in page so no in-memory copy survives in a still-running script. 5. **Revoke on the server** when reachable, and send the backstop header. ## The backstop: Clear-Site-Data `Clear-Site-Data` is a response header the server adds to the sign-out response. Its directives include `"cache"` (the browser's HTTP cache for the origin), `"cookies"` (and HTTP authentication credentials), `"storage"` (DOM storage, including Web Storage, IndexedDB and service worker registrations, which are unregistered) and `"*"` for everything. Three things limit it: - It arrives **only with a response**: an offline sign-out gets no header, so the local wipe cannot depend on it. - `"storage"` unregisters the service worker, so the next teacher's first visit runs without the offline shell until it reinstalls; that is an acceptable price on a shared machine, and a choice to make deliberately. - `"cookies"` reaches the whole registered domain, including subdomains, so sibling apps on that domain are signed out too. ## The teacher who walks away Most leaks come from sessions nobody ended. An **idle timeout** runs the same wipe. A tab closed without signing out leaves data behind, so on every start the app checks whether the stored data belongs to a session the server still accepts; if not, it wipes before rendering anything. Storage eviction is not a wipe: the browser deletes best-effort data by its own rules, such as running short of space, on no schedule the app controls, and possibly never. ## Making sure it happened - An **end-to-end test** signs in, takes attendance offline, signs out, then enumerates IndexedDB, Cache Storage and Web Storage and fails on any personal record. - The same test covers idle sign-out and the start-up check. - A **wipe-version** constant forces a fresh wipe after a release that adds a new store.

  • Why not rely on Clear-Site-Data alone?
    The header only takes effect when a response carrying it reaches the browser. A teacher signing out on a laptop that just lost Wi-Fi gets no response, so nothing is cleared. The local wipe must run first, without the network, and the header covers whatever the app's own code missed when the server is reachable.
  • A teacher closes the laptop lid instead of signing out. What protects the next user?
    The session expires on the server, and on the next start the app checks that its stored data belongs to a session the server still accepts; if not, it wipes everything before showing a single screen. An idle timeout covers the laptop left open. Unsent marks from that abandoned session are lost, which is why the unsent count is always visible.

  • Clearing the session cookie is enough; the data sits behind the login.
  • Clear-Site-Data handles it, so the app needs no wipe of its own.
  • Storage eviction will clear the previous teacher's data eventually.
  • Sign out at once and keep unsent marks for the next session to replay.
  • Hiding the previous teacher's data in the interface is as good as deleting it.