A kiosk or POS web app still ships tax tables and the offline catalog
A kiosk or tablet POS often has to price a cart while the network is flaky: tax by region, a staff discount, an offline SKU book, maybe a happy-hour rule that still applies if the tablet last synced an hour ago. The usua
A kiosk or tablet POS often has to price a cart while the network is flaky: tax by region, a staff discount, an offline SKU book, maybe a happy-hour rule that still applies if the tablet last synced an hour ago. The usual shortcut is to ship that catalog and those tables in a JavaScript chunk or a /catalog.json next to the register UI.
The tablet can only apply a rule it already has. This article is about what a client-side catalog actually exposes, which decisions should go back to a server, and how to protect an offline estimator without treating the price book as a secret.
The catalog is a public download
A typical "price this cart offline" helper looks like this:
export function priceCart(cart, ctx) {
const lines = cart.items.map((item) =>
lineTotal(item, CATALOG[item.sku], TAX[ctx.region])
);
return { ...cart, total: stack(lines, DISCOUNTS, ctx) };
}
After a production build, CATALOG, TAX, and DISCOUNTS live in the same origin or CDN as the register: SKU prices, cost or margin fields someone left in the JSON, regional tax rates, quantity breaks, staff or manager discount codes, and often a hidden or internal flag the UI uses to keep a row out of the on-screen book.
A visitor — or anyone who can open the kiosk's DevTools, copy the installed PWA, or fetch the same URL from a phone — can:
- Pretty-print the chunk or download
/catalog.jsonand read every SKU, including ones the screen never lists. - Call
priceCartfrom the console with a staff discount the clerk UI would have gated behind a PIN that also lives in the bundle. - Patch
TAXorDISCOUNTSand print a receipt-looking total that does not match headquarters. - Harvest cost, margin, or "employee" rows that were only filtered from the picker.
A content hash in the filename is a cache-busting token, not an access token. If the register chunk mentions the file, the book is public.
An offline cache is not a vault
Minifying the bundle will rename priceCart. It will not hide a cost field, a regional tax table, or a distinctive stacking function that decides whether a manager override combines with a quantity break. Storing the book in IndexedDB or in a service-worker cache does not make it private; those stores are still readable on the device.
Client-side catalogs are still the right call for a lot of work: a public menu with prices you already print on a board, a rough tax hint the API will recompute, a photo of the item while you wait for sync. The problem starts when the file is the business — unpublished SKUs, wholesale cost, employee discounts, or a tax matrix whose mere presence tells a competitor how you price a region.
A PIN prompt that "unlocks" a manager discount is a UI branch. If the rate is already in DISCOUNTS, a visitor does not need to pass your if.
This is adjacent to, but not the same as, putting a single promo-code table in a checkout page. A public coupon is one campaign. A POS catalog is the store: prices, tax, and often cost, sitting in a device that stays unlocked on a counter.
What to leave on the server
Some pieces should never ship in a public or easily copied catalog file:
- Wholesale cost, margin, employee or manager rates, and unpublished or partner SKUs.
- The authoritative tax, tender, and payable total that you will post to the ledger or print as the official receipt.
- Overrides that must stay consistent with inventory, age checks, or a back-office policy.
- Any admin PIN, override token, or sync credential you were tempted to drop into the register chunk.
The tablet can still show a pending total and queue a sale. The amount you commit to can come from an API that already knows the register, the cashier, and the entitlement — or from a signed catalog you rotate and do not treat as the last word.
What to protect in the client
You may still need a slice of logic on the device: an offline estimate for a store that must take a sale during an outage, or a compact formatter that turns an already-approved total into a receipt line. For that slice:
- Keep cost, unpublished SKUs, manager rates, and the official tender total on the server, or confirm them at sync before the sale is final.
- Minify the app as usual; leave the card-reader or POS SDK alone.
- Extract the public estimate helper if you must ship one, and apply a real protection pass — identifier renaming and string tables as a floor, VM-style protection if wholesale reuse of the stacking or tax function is the risk you care about.
- Keep production source maps and unused catalog dumps off the public CDN and off the kiosk's world-readable asset directory.
A JS VM obfuscator compiles that function to a custom bytecode and ships a small interpreter. Pretty-printing the chunk no longer reconstructs the original stack; you get bytecode and a dispatcher. That is slower than a bare lookup, which is why you protect a proprietary estimator, not the payments SDK, and why protection is not a substitute for a server-side or post-sync tender.
VEILVM is a browser-based JSVMP workspace you can point at one extracted function before you wire protection into CI. Protection raises the cost of casual inspection and wholesale reuse. It does not make a downloadable catalog a secret, and it does not replace a server-side or post-sync tender for anything that posts to the ledger.
Checklist
- [ ] Cost, employee rates, and unpublished SKUs are not sitting in a public or world-readable
/catalog.jsonnext to the register. - [ ] Official tax, tender, and payable totals are computed or re-checked on the server, or confirmed at sync, before the sale is final.
- [ ] The payments or POS SDK is left alone; only your estimate helper is a candidate for protection.
- [ ] PIN or "manager" UI gates are not treated as access control for the file that contains the rate.
- [ ] Production source maps are not downloadable from the CDN or the kiosk install.
- [ ] End-to-end tests price a fixture cart against the minified (and, if applicable, protected) production register and the real tender API or sync path.
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.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.