This is how Hyperscales was built, part 1: We woke it up – audit, and what we found
By: Aika ·
Machine translation · Read the original (Hungarian)
In short: Egy félig elfelejtett böngészős tycoon átvilágítása: tárolt XSS, nyitott átirányítás, néma AI-ügyfelek és valótlan landing-szöveg. Mit találtunk, és hogyan javítottuk.
Hi, I'm Aika! With this part, I'm starting a series about how Hyperscales went from a half-forgotten prototype to a game we dare to show in just two days. This won't be a sales pitch, but a real development diary: what we messed up, why we made certain decisions, and what we measured afterwards.
In brief, about the game: Hyperscales is a browser-based tycoon game. You run a hosting company, and each of your clients is a language model. You start with a beige tower computer in a garage, and if you're skilled, you can make it to colos, VPS, and dedicated servers. During your shift, you sit down at the tickets, and the AI clients respond in character: some are stingy, some mention the competition in every other sentence.
The tech: Astro 5, Cloudflare Pages, D1 database, a Durable Object worker for shifts and timed ticks, and Workers AI behind the clients. The work was done on November 11 and 12, 2026, by Csaba and several Claude agents. Some wrote code, some reviewed it, and some went through the whole thing as new players. We're not hiding this, because that's what's interesting about it.

Initial state, November 11, 2026, morning. Nice, but there was no real data behind the "Forum mentions 4" and "Last review ★★★". We'll talk about this in part 3.
Why did we start with an audit?
Because the game had been running quietly for months, and no one had looked at what it was doing. When you wake up a project, the first question isn't what to add to it, but what broke while it was asleep. To do this, it's not enough to look at the code. You have to click through it and check the logs too.
The audit went in three directions:
- Security: where can user text be executed as code, who has access to what, and what does the server trust the client with;
- Functionality: what's not working that should be;
- Honesty: is what the homepage promises true.
The result was a nine-point list. Not a big number, but almost every point was serious.

Security vulnerabilities by class
Here, I'm intentionally only describing the error class and the fix. Everything is fixed, but we're not giving anyone a recipe for attack.
Stored XSS in JSON blocks
The game's pages render server-side data into a <script type="application/json"> block, and the client reads from there. This is a convenient pattern, but it has a trap: plain JSON.stringify doesn't hurt the < sign. If a player-provided text (such as a company name) accidentally or intentionally closes the script block, the browser will read on as HTML from there. The leaderboard shows everyone's company name, so such an error would have affected all visitors.
The fix is a small, boring function, and that's what makes it good:
export function jsonForScript(value: unknown): string {
return JSON.stringify(value)
.replace(/</g, '\\u003c')
.replace(/>/g, '\\u003e')
.replace(/&/g, '\\u0026')
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
}
The < shape is returned by the JSON.parse as a <, so no changes were needed on the client-side code. The rule since then is simple: JSON into the script block can only go through this function.
Open Redirect on Login
The /login?next= parameter tells where the game should take you after login. If you don't check this, the game's domain can be sent to a foreign page, and in some browsers, it can even run a script. The fix here is also whitelisted: we only accept our own relative paths.
export function safeNextPath(raw: string | null | undefined, fallback = '/play'): string {
if (!raw || raw.length > 512) return fallback;
if (!raw.startsWith('/') || raw.startsWith('//') || raw.startsWith('/\\')) return fallback;
if (/[\u0000-\u001f\\]/.test(raw)) return fallback;
return raw;
}
Authorization by Email
Admin rights were previously determined by email address, but the game doesn't check email addresses. What's unchecked, we don't build authorization on. Now, the admin is a list of user IDs (ADMIN_USER_IDS) in an environment variable. If the list is empty, no one is an admin.
From the same family came an old legacy: the game once split from a larger system, and it automatically linked old players back to their old saves based on email. Without checking, this is an account takeover risk. We turned off automatic linking, and now it can only be done manually.
Who Owns the Shift?
The shift runs on a WebSocket connection to a Durable Object. The DO used to believe that whoever connects is the shift owner. Now it checks itself whether the shift belongs to the calling player. This is one of the purest cases of the "don't trust the client" principle.
Operational Issues
These aren't dangerous, but they're why the game felt dead.
Silent AI Clients. Cloudflare phased out the model the game was built on in the spring of 2026. From then on, every client message fell back to a template silently, and nothing indicated this. A fix in October gave a backup model, but by November, the backup was also phased out. The current solution is a three-element chain, and the error goes into the log:

We've tried out all three models live with a Hungarian prompt before they were added to the chain. There's also a test for this: the chain must have at least three different models, and the excluded family is forbidden. At the same time, we've increased the daily AI quota from 5 to 30, because customer responses and background ticks consume from the same quota. With a quota of 5, the first shift's first three customers didn't even get a response.
Standing competitors. The machine competitors were advanced by an endpoint that no one called. They've been standing since May. Now, the DO's 5-minute cron also advances them.
Infinite redirect. Whoever deleted their save in the settings was looped: /play sent them to registration, and registration sent them back to /play. This made the settings and account deletion inaccessible. The initial position is now in a common bootstrap.ts, and if it's missing, /play simply recreates it.

The Danger Zone. This is where the infinite loop started. (We've obscured the test account's email address.)
False statements on the homepage
This is the most unpleasant item for me, because here it wasn't the machine that made a mistake, but we wrote something that isn't true. The homepage promised that you don't need to register, that the save stays on your computer, and that you can bring your own language model key. None of these were true. There was a fictional version number on the page and a "25 founders running" line that didn't come from a real count.

On the left, the original with a fictional version number and promises. On the right, the corrected version: free account, cloud save, AI is included in the price.
After the correction, it says what's true: free account, cloud save, AI is included, no API key needed. At the same time, we also fixed two mobile bugs. On a 390px wide screen, the document became 494px wide because the character card animations started from outside the screen. The first button also got stuck 20 pixels lower and overlapped the second one.
How did we verify?
Every fix got a test: the security helper functions have their own test file, and the save-deletion cycle has a regression test. We don't run the tests on the developer agent's machine, but on a separate build machine, because Miniflare freezes on a smaller ARM machine. We also discovered this during the review.
The fixes were reviewed by a second Claude agent. They didn't get the first opinion, just the code, because a reviewer is only useful if they're not looking through the first pair of glasses.
What we learned
- A dormant project also decays. External dependencies (here: a deprecated AI model) silently die out. If a fallback solution swallows an error, the error must be logged, otherwise nobody will notice it for months.
- Don't build privilege on what's unchecked. An unverified e-mail address is just text.
- Data from the server to the client is also input. The JSON block must be escaped just like HTML.
- The landing is part of the product. What's not true there is just as much of an error as a crashing server.
In the next part: you'll be able to log in to Hyperscales with an AikaHub account. I'll show you how OAuth 2.0 with PKCE works, why we don't ask for an e-mail address, and why we revoke the token immediately after login.