<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Seyma Sk on Medium]]></title>
        <description><![CDATA[Stories by Seyma Sk on Medium]]></description>
        <link>https://medium.com/@seyma90.sk?source=rss-530226aa1924------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*q10hMEH-x8sr9XxY</url>
            <title>Stories by Seyma Sk on Medium</title>
            <link>https://medium.com/@seyma90.sk?source=rss-530226aa1924------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:38:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@seyma90.sk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The confetti had never worked]]></title>
            <link>https://medium.com/@seyma90.sk/the-confetti-had-never-worked-9573364b4254?source=rss-530226aa1924------2</link>
            <guid isPermaLink="false">https://medium.com/p/9573364b4254</guid>
            <category><![CDATA[quiz-games]]></category>
            <dc:creator><![CDATA[Seyma Sk]]></dc:creator>
            <pubDate>Fri, 07 Aug 2026 09:41:34 GMT</pubDate>
            <atom:updated>2026-08-07T09:41:34.299Z</atom:updated>
            <content:encoded><![CDATA[<p>I built a quiz game for my classroom. Get the answer right, and confetti bursts<br>across the screen.</p><p>Except it didn’t. Not once, in months of lessons, for anybody. And nothing in<br>the app ever said a word about it.</p><p>I’ll get to how that happened. First, what the thing actually is.</p><p>Every lesson ends the same way. Four minutes left, the class is already halfway out the door, and you want one last thing that makes the material stick.</p><p>So I built a quiz game for exactly that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u9rrriLWHl-f1FuI0l7doQ.png" /></figure><p>It works like a game show. You pick a class and a topic, and the app spins<br>through the student names like a slot machine until it lands on someone. A wheel picks the difficulty — easy, medium, hard, worth 10, 20 and 30 points. The question appears with a countdown ring around it. Right answer: confetti and applause. Wrong: a buzzer, and the correct answer on screen for everyone.</p><p>There are two other modes. Groups splits the class into random teams and rotates both whose turn it is and who answers inside each team. Beat the Clock puts one student on the spot for sixty seconds and counts how many they get through.</p><p>The preparation happens once. A teacher enters their subjects, topics and<br>questions at the start of the year — or pastes a whole yearly plan in and lets<br>the app sort it into place. After that it’s three clicks to start a round.<br>Everything the class does gets recorded, so you can go back and see which topic they’re weakest on, who’s been struggling, and which question the whole class gets wrong.</p><p>And it runs from a folder. You double-click `index.html` and it opens. No<br>install, no account, no build, no server.</p><p>That last part matters more than it sounds, and I’ll come back to it.</p><p>Right. The confetti.</p><p>Here’s the tag that was supposed to load the library:</p><pre>```html<br>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/canvas-confetti/1.9.3/confetti.browser.min.js&quot;&gt;&lt;/script&gt;<br>```</pre><p>That URL returns 404. cdnjs publishes this library as `confetti.js` and<br>`confetti.min.js`. `confetti.browser.min.js` is an npm/jsDelivr path. Right<br>filename, wrong CDN — and the two names are similar enough that I’d never<br>questioned it.</p><p>Here’s why nobody noticed:</p><pre>```js<br>function fireConfetti(){<br> if(typeof confetti!==&#39;function&#39;) return;<br> // …<br>}<br>```</pre><p>A perfectly sensible guard. It also turns a missing dependency into silence. The script 404s, the global never exists, `fireConfetti()` returns immediately, and the app looks completely healthy the whole time.</p><p>I only found it because I decided to stop trusting the CDN and vendor the<br>library instead. The download failed.</p><p>That kicked off a week of actually reading my own code. Here’s the rest of it.</p><p><strong>The teams were never random</strong></p><p>Groups mode splits the class into teams. The shuffle was this:</p><pre>```js<br>const shuffled = […present].sort(() =&gt; Math.random() - 0.5);<br>```</pre><p>You’ve probably seen this line. Maybe you’ve written it. It looks like a shuffle and isn’t one — the comparator is inconsistent, so the sort leaves a lot of the original order sitting there.</p><p>Everyone knows this in the abstract. I wanted to know what it actually costs, so I measured: 30,000 shuffles of eight students, counting where the first one landed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*XYjFDeNuxxTlp7dSp0u43A.png" /></figure><p>Worst-case deviation, 9.4 points down to 0.34.</p><p>In a classroom that isn’t a statistics curiosity. It’s the same children on the<br>same team week after week, and a class slowly working out that the “random” teams aren’t. They were right.</p><p><strong>An XSS I shipped myself</strong></p><p>Teachers can export a question bank as JSON and hand it to a colleague. Which means every subject, topic and question name is untrusted input — it comes out of someone else’s file.</p><p>Deleting something popped up an undo notification:</p><pre>```js<br>t.innerHTML = `&lt;span&gt;${msg}&lt;/span&gt;`;<br>```</pre><p>And the messages quoted the names:</p><pre>```js<br>recordDelete(&#39;topic&#39;, `Topic &quot;${snap.name}&quot;`, …)<br>recordDelete(&#39;question&#39;, `Question: &quot;${q.q…}&quot;`, …)<br>```</pre><p>So a shared bank with a topic named</p><pre>```<br>&lt;img src=x onerror=&quot;…&quot;&gt;<br>```</pre><p>ran arbitrary script the moment a teacher deleted that topic. I checked it was really exploitable before fixing it. The `onerror` fired.</p><p>Script in that page can read every student name and score in `localStorage` — exactly the data the app promises never leaves the computer.</p><p>The fix is boring: set `textContent`, append the undo button as a real element.</p><p>What bothers me is that I’d been careful everywhere else. There’s an `esc()`<br>helper, and 54 other `innerHTML` assignments use it properly. I’d thought about escaping in all the places that look like rendering.</p><p>A toast didn’t look like rendering.</p><p><strong>Encrypting names before they leave the device</strong></p><p>The app now syncs to Supabase, so a teacher can prepare at home and open it at school. Which raises the question that actually matters for a school: do children’s names now live on someone else’s server?</p><p>They don’t. Names are encrypted in the browser before anything is sent — <br>AES-GCM-256, key derived with PBKDF2-SHA256 at 250k rounds (about 250ms) from a passphrase that’s never transmitted and never stored. The salt travels with the row so the same passphrase produces the same key on the second device. The server holds ciphertext and never holds the key.</p><p>Everything else stays readable on purpose: class names, subjects, topics,<br>questions, scores. That’s the bulk of a year’s work, there’s nothing personal in it, and it survives if the passphrase is ever lost.</p><p>Be precise about what this buys you. It protects against a database dump, a leaked API key, and a curious administrator. It does nothing for a device<br>someone else is holding while the passphrase is in memory. Encryption write-ups tend to blur that line. The first technical commenter won’t.</p><p>The interesting bug wasn’t in the crypto. It was in knowing where names live.</p><p>I encrypted the roster and the answer records, felt done, and then went looking for anywhere else a name might be sitting.</p><pre>```js<br>// deleting a student parks their name in two places at once<br>recordDelete(&#39;student&#39;, `Student &quot;${s.name}&quot;`, snap, …)<br>// ^^^^ the label ^^^^ and a full snapshot<br>```</pre><p>The trash. A 30-day undo, holding snapshots of everything deleted — including whole student objects — plus labels with the names written into them. It sat outside both fields I was encrypting, and it would have shipped every one of those names in the clear.</p><p>It’s dropped from the payload now; it’s per-device by nature anyway. But the lesson stuck: encrypting the field you’re thinking of is the easy half. Finding every copy of it is the work.</p><p><strong>The bug that only exists in production</strong></p><p>I fixed something, deployed, and got told it did nothing. The controls were<br>right there on screen and completely dead.</p><p>The feature was fine. GitHub Pages sends `Cache-Control: max-age=600` on<br>everything, and the edge caches age independently:</p><pre>```<br>index.html Cache-Control: max-age=600 Age: 394<br>style.css Cache-Control: max-age=600 Age: 0<br>```</pre><p>So a browser can end up holding a fresh `index.html` next to a ten-minute-old `game.js`. The new markup renders. The handlers it needs don’t exist yet. And there’s nothing on the page to suggest why.</p><p>The fix is a content hash in the query string, so a deploy is a new URL:</p><pre>```html<br>&lt;script src=&quot;game.js?v=d7e3997f&quot;&gt;&lt;/script&gt;<br>```</pre><p>The fragile part is remembering to update it — so the test computes the hash and fails when `index.html` disagrees, and tells me the value to paste in.</p><p><strong>The test suite, and one rule</strong></p><p>There weren’t any tests. Now there’s one file: 571 lines, no framework, nothing to install.</p><pre>```bash<br>node tools/selftest.js<br>```</pre><p>It lifts functions straight out of the source and runs them in Node with their<br>helpers stubbed. Fifty checks — imported banks as untrusted input, typed-answer matching, whether names can reach `innerHTML`, whether the vendored library is the browser build, whether the cache stamp is current.</p><p>One rule made it worth writing: I broke every guard on purpose and confirmed it went red.</p><p>Reintroducing the `innerHTML` in the toast. Dropping the length threshold in answer matching. Removing the trash from the encryption payload. Deleting one of the three places a question picture renders.</p><p>A test you’ve never seen fail is a test you’re trusting on faith. Several of<br>mine needed fixing before they caught anything at all.</p><p>My favourite one isn’t really a test:</p><pre>```js<br>test(&#39;a question picture is actually rendered where it is needed&#39;, () =&gt; {<br> // Defining the validator is not the same as using it. It was defined,<br> // committed and unused: pictures saved fine and never appeared in a quiz.<br>```</pre><p>I’d written a strict validator for question images, committed it, and called it<br>from nowhere. Pictures saved perfectly and never showed up on screen.</p><p>Same shape as the confetti. Four days later. By my own hand.</p><p><strong>What the constraints bought</strong></p><p>The whole thing is about 3,300 lines of my own code across four files, with no `package.json` and no `node_modules`**. The confetti library is vendored and byte-checked against the hash the CDN publishes. Sounds are files sitting next to the HTML. Sync is plain `fetch` against Supabase’s REST endpoints instead of a client library.</p><p>This isn’t minimalism for sport. School wifi drops. A teacher with thirty<br>children waiting can’t debug a build. Every dependency is one more thing that can 404 in the middle of a lesson — which, as it turns out, is exactly what had been happening, quietly, for months.</p><p>The trade is real. No framework means writing your own escaping discipline, and I got that wrong once in a way that shipped to real users. But the failure modes are ones I can see, reach and test, in files I can read end to end.</p><p><strong>What I’d tell myself a year ago</strong></p><p>A guard that swallows a failure needs some way to be noticed.** Both silent<br>bugs here were `if (thing missing) return;` — correct, defensive, and the exact reason nobody knew.</p><p>”The helper exists” and “the helper is used” are different facts. Only the<br>second one puts anything on a screen. Assert on the second.</p><p>Find every copy before you encrypt. The field you’re picturing is rarely the<br>only one.</p><p>Check security properties from the outside.I tested my own row-level<br>security with curl and the public key, the way someone else would. Postgres answered:</p><pre>```<br>42501 - new row violates row-level security policy for table &quot;quiz_state&quot;<br>```</pre><p>That’s worth more than reading the policy and assuming.</p><p>The source is on GitHub: <a href="https://github.com/seymamece/quiz-game">https://github.com/seymamece/quiz-game</a>. It’s in use by actual teachers, which is the only reason any of the above mattered.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9573364b4254" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>