Inspiration

Most people never see a real vulnerability. Security write-ups describe one line of code in prose, so the "spot the bug" skill never gets trained — and the developers shipping the bugs never build the instinct to catch them. We wanted the opposite of a slide deck: one snippet, one dangerous line, ninety seconds, same puzzle for everyone in the thread so results are comparable.

What it does

Daily Bug Hunt drops one hand-written code snippet every day at 00:00 UTC — SQL, TypeScript, Python, TSX — with exactly one line in it that would give an attacker the keys. Players flag lines before the clock runs out, commit, and the post explains why the line hurts and what the patch looks like. Streaks, best streaks, and live daily player/solved counts keep the thread competitive, and a copy-result button gives players a spoiler-safe brag for the comments.

The puzzles are drawn from real mistake patterns: SQL injection, IDOR, RLS using (true), secrets in NEXT_PUBLIC_ bundles, pickle.loads on untrusted bytes, prototype pollution, check-then-act race conditions, and a view that silently bypasses row-level security by running as its owner.

After a round, the thread goes live: a realtime-driven activity panel streams "u/ caught #12 in 34s · streak 4" as other players solve, shows today's longest streaks from a Redis sorted set, and surfaces a season profile (total solved, best run, average solve time). Practice mode lets anyone hunt the whole library outside the daily — endless play that never touches the daily board or the streak.

How we built it

  • Devvit (Reddit's developer platform): the game ships as a custom post — an inline splash in the feed plus an expanded game view.
  • React 19 + Tailwind CSS 4 + Vite for the game view; the splash makes one /api/teaser call for today's redacted preview and falls back to a static pitch if it fails, so the feed stays fast either way.
  • Hono on @devvit/web/server for the scoring API. Answers never reach the client: GET /challenge returns the snippet with the answer stripped, and POST /score validates server-side against the puzzle's real answer. GET /feed serves the counters and leaderboard, and POST /practice/start + POST /practice/answer run practice mode.
  • Redis (via Devvit) for hash-backed player profiles (streak, best streak, solved count, total time, practice progress), per-day player and solve counters, and a sorted set of today's streaks for the live leaderboard.
  • The realtime channel from @devvit/web/server broadcasts each solve on the post channel; the activity panel derives the ticker from the socket and the counters from Redis.
  • 52 hand-written puzzles in a typed library; daily selection is deterministic per thread — the weekday picks the difficulty tier (Mon–Wed warm-up, Thu–Sat real bug, Sun nightmare) and the UTC day number picks within that tier, so every player sees the same snippet every day.
  • Sound and reveal animation are generated in-browser (WebAudio blips, CSS keyframes) with a prefers-reduced-motion opt-out — no assets, no autoplay.

Challenges we ran into

Two real constraints shaped the build. First, answers must stay server-side — any client bundle that ships the risky line indices is a cheat sheet, so the payload type strips the answer fields and score validation happens on the server against the same library. The same rule covers the feed: the teaser endpoint is unauthenticated, so the first draft served the whole snippet with the risky lines replaced by blocks — one curl gave the day away. It now returns only the five-line preview window, blacks out one extra decoy line so the hidden row is not a pointer to the answer, and keeps each hidden line's indentation so the geometry gives nothing away. Second, the client sandbox has no window conveniences: navigation uses Devvit's navigateTo, and alerts are toasts — the first draft used window.open and had to be rebuilt around the platform rules. A third lesson came from QA: five puzzles in the first expansion accidentally duplicated earlier ids and one flagged a ); line instead of the cors() call — a script that prints each puzzle's flagged line by index caught both, and the library now ships with all indices verified.

Accomplishments that we're proud of

One unambiguous answer per puzzle, with the explanation and the actual patch — not just "you found it." Every snippet is realistic (they read like code that really shipped somewhere) and self-contained, so a player with no security background can reason it out from the lines alone. And the loop is complete: play, commit, learn why, patch, share a spoiler-safe result.

What we learned

Writing 52 puzzles where exactly one line is the vulnerability is harder than it sounds — the best ones are snippets where every other line looks plausibly suspicious. Server-side answer validation and a deterministic-per-day puzzle pick are what keep the daily fair: no first-mover advantage, no leaked answers, same board for the whole thread. Live boards were the other lesson: the naive design (recount Redis on every event) melts under a busy thread, so counters are incremented once on a solve and the ticker is pure socket state.

What's next for Daily Bug Hunt

  • Cross-subreddit seasons: aggregate the streak sorted sets into a global board with weekly resets
  • Difficulty ramp scheduling: the library already has NIGHTMARE-tier puzzles (prototype pollution, race conditions, RLS-bypass views) — the weekday curve already warms players up before the hard tiers land
  • Community submissions: a "suggest a snippet" flow with an automated check that a submission has exactly one plausible risky line

Built With

Share this project:

Updates

Submission history