Most people think of DevTools as a read-only window: you can look at the code, maybe set a breakpoint, and the changes vanish on reload. That stopped being true a while ago. Chrome's Local Overrides (Sources → Overrides) and Firefox's script overrides let anyone save a copy of a response, edit it, and have the browser serve the edited copy on every reload, as if your server had sent it.
No proxy, no extension, no certificate tricks. A user who has never heard of Burp or mitmproxy can patch your production bundle in about a minute.
This article covers what that means for code that makes decisions in the browser, what to move to the server, and where protection actually helps.
What an override looks like in practice
Say your app ships a check like this in a chunk:
export function canExport(user, doc) {
if (user.plan === "pro") return true;
return doc.pages <= FREE_PAGE_LIMIT && exportsToday(user) < 3;
}
With overrides enabled, a user pretty-prints the chunk, searches for FREE_PAGE_LIMIT or "pro", changes the function body to return true, and saves. From then on, every reload runs their version. The same works for:
- Feature flags and kill switches evaluated in the client.
- Rate-limit counters, cooldowns, and "try again in 24 hours" timers.
- Watermark and branding toggles on exports.
- Validation that only exists in the form, not in the API.
- Telemetry or integrity checks you hoped would report tampering.
The override survives reloads, works on minified code, and needs no special skill beyond "find the string".
Integrity checks do not fix this on their own
A common reaction is to add a checksum: hash your own function source at runtime and refuse to run if it changed. The problem is that the checker is in the same file the user is editing. If they can change canExport, they can change the line that compares the hash. Subresource Integrity does not help either: SRI protects against a compromised CDN, and the page that declares the hash is under the user's control too.
Self-checks still have a place as a speed bump and as a signal you log, but they are not enforcement.
What belongs on the server
- Any decision that costs you money or reputation if it is wrong: plan entitlements, export limits, quotas, payouts.
- The authoritative counter for anything rate-limited.
- Validation of every field the API accepts, regardless of what the form did.
- Watermarking or branding of files you generate server-side.
A useful rule: if editing one function in DevTools would change what your server stores or what a user gets for free, the server must check it again.
Where protection helps
Overrides are cheap because readable code is easy to search. Once the real gates are on the server, what is left in the browser is often logic you simply do not want copied or casually patched: a scoring formula, a pricing preview, a rendering trick, a licensing handshake for an offline or desktop build.
For that slice:
- Extract the sensitive function into its own module instead of protecting the whole bundle.
- Apply identifier renaming and string encryption as a floor so
"pro"andFREE_PAGE_LIMITare not searchable. - Use VM-based protection where you want the logic itself to be hard to follow: the function is compiled to custom bytecode and run by a small interpreter, so a pretty-printed chunk no longer shows a readable
if. - Turn off production source maps, or the override user just edits your original source.
This does not make tampering impossible. A determined person can still trace the interpreter or patch its inputs. It changes the job from "search and replace one line" to "reverse a custom VM", which is enough for most casual patching.
VEILVM is a browser-based JSVMP workspace (disclosure: I work on it). You can paste one extracted function and see what the protected output looks like before wiring anything into CI.
Checklist
- [ ] Open your own production app, enable Local Overrides, and try to patch your most valuable client-side check.
- [ ] Every entitlement and quota that matters is re-checked by the API.
- [ ] Client-side integrity checks are logged as signals, not trusted as enforcement.
- [ ] Only proprietary logic that remains in the browser is a candidate for protection.
- [ ] Production source maps are not publicly served.
- [ ] End-to-end tests run against the protected production build.
If you want to try VM protection on a single extracted function, VEILVM runs in the browser with no sign-up: 3 free runs a day, up to 5 KB per file (resets at 00:00 UTC). A free account raises the input limit to 30 KB. Pro is $9/month or $79/year and adds an API so the protection step can run in CI. Standard requests are processed in memory and are not written to logs. Start at https://vm.ldvmp.com.
Top comments (0)