C.W.K.
Stream
Lesson 01 of 05 · published

The Killswitch — The Single Most Valuable Button

~15 min · killswitch, ui, bookmarks

Level 0Greenhorn
0 XP0/53 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

Every layer in this quest serves one moment: the day you realize a device is gone. The killswitch is what you do in that moment. It must be: fast (one click), complete (kills every cookie), recoverable (you can log back in), and reachable from any other device.

What "killswitch" means in concrete terms

ActionWhat it affectsSQL
Revoke All SessionsEvery browser session everywhere is logged out on next requestDELETE FROM security_sessions
Disable PIN globally (DON'T)Sets a flag that bypasses auth entirelyNEVER — this is the inverse of what you want
Add specific IP to blacklistThat source IP can't even attempt loginINSERT INTO security_blacklist
Tighten retry limit temporarilyLower max_retry from 5 to 2 during incidentUPDATE security_config SET max_retry = 2

The UI — make it big and red

The button needs to be findable in panic. Hide it behind one confirm dialog ("Revoke all 3 active sessions?") so a misclick doesn't blow up your day, but no further — every extra click is a second when your stuff is exposed.

Code

The endpoint (with audit logging)·python
@app.post("/admin/security/revoke-all")
async def revoke_all(request: Request):
    require_admin(request)
    cur = db.execute("DELETE FROM security_sessions")
    db.commit()
    audit_log("revoke_all", actor_ip=client_ip(request), count=cur.rowcount)
    return {"revoked": cur.rowcount}
The button — big, red, one-confirm·html
<button
  class="btn-danger"
  onclick="if(confirm('Revoke ALL active sessions? Every device must re-PIN.')) revokeAll()"
>
  🚨 Revoke All Sessions
</button>

External links

Exercise

Add /admin/security/revoke-all and the big red button to a simple admin page. Bookmark the page on your laptop, your other laptop (if any), your phone, and your tablet. Time yourself: from 'open laptop' to 'click confirm', what's your slowest device? Anything over 30 seconds is a UX bug.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.