AI summary by TwinMind

The worst code I've ever seen

Theo - t3․gg

18m 53s

Sponsor Introduction

  • Browser Base sponsorship announcement
    • Invested in company personally
    • Web browser for AI service
    • Manages Chromium/Playwright chaos via API
    • Includes Stagehand open source package
    • Allows AI-driven browser automation with descriptive actions
    • Uses Zod schema for type-safe data extraction

Code Discovery & Origins

  • Found code as developer wallpaper on Twitter
  • Gabriel quote tweeted with criticism
  • Own viral dunk tweet response
  • Traced source to deleted programming horror post
  • Found on web archive with working image
  • Original code had "TODO: put this in different file" comment
  • Login failed syntax error added later in copies

Line-by-Line Code Analysis

Initial Setup

  • Line 541 in Sublime Text (HTML file)
  • TODO comment about moving to different JS file
  • authenticate_user function (only correctly spelled element)

Database Query Issues

  • accounts = apiService.sql("SELECT * FROM users")
  • Fetches ALL users from database on client side
  • Exposes SQL interface directly to client
  • Users could inspect element, access console, run apiService.sql("DELETE * FROM users")
  • Pre-async/await code using blocking XHR requests

Authentication Loop

  • Basic for loop (i=0; i<accounts.length; i++)
  • Pre-forEach/map JavaScript era
  • Checks username/password match in loop
  • Returns true if match found

The Infamous Line

  • if (true == "true") { return true; } else { return false; }
  • Theorized originally was account.isActive == "true"
  • String "true" from database, not boolean
  • 17 different ways to simplify this logic

jQuery Implementation

  • Click handler on #login element
  • Grabs username/password from form fields
  • Sets client-side cookie: $.cookie("loggedIn", "yes")
  • Cookie expires in 1 day (expires: 1)
  • Server likely only checks "loggedIn=yes" cookie for authentication

Security Vulnerabilities Identified

  • Plain text passwords transmitted
  • SQL injection risks via exposed API
  • Client-side authentication logic
  • Easily modifiable session management
  • All user data exposed to client
  • No server-side validation
  • Public internet exposure (not just intranet)

Code Context & Usage

  • Originally used on "internet" app (intranet/local network)
  • Later revealed to be publicly accessible via company website
  • Not related to Capital One (throwaway account name)
  • Likely finance company codebase
  • Additional horrifying code examples found from same user
  • Hardcoded server names suggest real production use

Developer Profile Theory

  • Likely data analyst or IT person forced to write code
  • Not professional JavaScript developer
  • Used to unreliable loading estimates (XKCD reference)
  • Multiple contradicting setTimeout calls
  • No understanding of synchronous vs asynchronous concepts
  • Selecting from analytics tables suggests data role

Image Evolution & Transformations

Original Version

  • Proper ID selectors (#error-message)
  • Syntactically correct except final line
  • Functional but insecure code

Modified Versions

  • Login failed syntax error added
  • Removed ID selector (breaks functionality)
  • Different quote styles in various copies
  • Space variations in "login failed"

Technical Analysis of Image Copies

  • OCR copy-pasting theory for text extraction
  • AI upscaling using waifu2x for wallpaper resolution
  • Character ligature degradation visible
  • Multiple generations of copying introduced errors
  • Final wallpaper version has syntax errors from AI processing

TwinMind

Get summaries like this for your own meetings

TwinMind takes notes in the background during meetings, lectures, and calls, then writes the summary for you.

Free plan to get started

No bot joins your calls

Phone, desktop & Chrome apps

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome