#and like 80% of this shit including all the passport checking NEEDS to be there
Explore tagged Tumblr posts
mechtroid · 11 months ago
Text
I'm sure a lot of people are wondering how we got to this point.
As someone who's basically worked on all aspects of a computer save for chip design, the answer mostly boils down to layers, abstraction or otherwise (and subsequently, security).
The Apollo rocket's code was written largely by a core of 40-70 programmers, IIRC (and depending on how you define "core"). Everything else was either done by one of the 300 odd other programmers at NASA or cribbed from some academic paper somewhere. Everything had access to everything else; if the radio wanted to blink out its error message in morse code using the cabin's "check engine" light, it could. Nothing was stopping you, other than likely getting smacked upside the head by someone 4 cubicles down.
Meanwhile, a chrome tab involves so many elements and so many permissions that it makes the UN look like a NASCAR pit crew. Say you're building a website that just wants to automatically log you in, nothing else.
Well, you're likely building this in a framework, so before you even interact with the browser you're using mode.jk or something. One layer. You call the function to get the user session token. Your framework looks at the session info and figures out what kind of browser it's running on. IE7. Framework figures okay, we've gotta formulate the request using these depreciated functions that haven't been touched since 2009. Two layers. Browser cocks its head at you and goes "Okay pal, who's asking?" Your code fumbles for its passport showing it already has permission to access cookies. Three layers. The browser double checks your site's passport against the SSL token to make sure it wasn't handed a forgery, everything checks out. Four layers. Confident the request was genuine, the browser asks the operating system for access to the contents of the current executing directory, the user/IE7/cookies directory, the temp/currentsession/cookies directory, and recites the ancient bitmask of legend indicating the secret windows directory where IE actually stores the cookies. Five layers. Windows, busy with other things, asks the browser to hold on for a microsecond.
After a couple of them it finally grunts "papers, please" and then ensures the browser has permission to access to all these directories. Six layers. Satisfied, it gives them a magic number for the cubicle containing the function that will actually give the contents of those files. The browser approaches this address, asks "hey, so do any of those directories have a file named mysite.cookie on here?" A familiar refrain rings out. "Maaaaybe... Who's asking?" Seven layers. After confirming your browser's papers once again, it references seven different indices and writes up a request slip before waddling down to the hard drive and knocking on a door. "Hey, got a request for contents at chunk 87, sector 9, bytes 2,874 through 2,996!" Hard drive gives the slip a look and replies "Okay, expect your delivery to arrive within 5-7 business milliseconds." Eight layers.
12 milliseconds pass.
Eventually the raw text of the cookie file reaches the function you requested it from and it throws the papers in a stack at you. "My work here is done." The browser trudges back through the checkpoint while Windows Defender rifles through your browser's memory for viruses with all the effectiveness of the TSA. Nine layers. A bell jingles as the browser enters through the door of your framework and throws all the papers on its desk in a pile. The jingle rings out again as the browser's work is finally done. Ten layers. Your javascript framework, realizing it's working with IE7, grabs scissors and cuts out the relevant token, packaging it up in the latest json specification and throwing it down the function return chute. Eleven layers. However, since this is a promise function and javascript doesn't support true multithreading, the return package languishes for hundreds of microseconds until javascript gets around to checking it. Twelve layers.
Hey, your session token is here! Unfortunately, the cookie was created by a chrome browser. Due to a hitherto undiscovered bug in mode.jk, the token's expiration date was stored in unix timestamp format, but the framework assumed it was created by the browser you're using, which would have stored the date in MMDDYYYHHSS format, and the misinterpreted data claims this token expired in 1979.
Would you like to create an account?
we should globally ban the introduction of more powerful computer hardware for 10-20 years, not as an AI safety thing (though we could frame it as that), but to force programmers to optimize their shit better
230K notes · View notes