A MeowShield options change produces a new file, even when the source is unchanged
Disclosure: I help promote MeowShield. Teams remember to cache-bust when application source changes. They forget that a MeowShield options change also produces different bytes. The compiled input can be identical, the gi
Disclosure: I help promote MeowShield. Teams remember to cache-bust when application source changes. They forget that a MeowShield options change also produces different bytes. The compiled input can be identical, the git diff of your app can be empty, and the file you upload can still be a completely new artifact.
Why the bytes change
A MeowShield build is source plus options. The documented request sends both: sourceCode and an options object with a mode of low, medium, or high. Flip Variable Renaming, change a ConstantSplitting rate, turn perfOptimization on, or move a package from Medium to High, and the protected output is not the file your CDN already has.
That matters for anything that assumes a stable URL or a stable hash:
- Subresource Integrity hashes computed from last week's file will fail in the browser
- A long-lived Cache-Control or "immutable" filename will keep serving the old protection, or a mix of old and new
- A service worker that precached the previous artifact will keep running it until you bump the cache key
- Two environments that "use the same commit" can still be running different protected files if their options files drifted
Treat the options file as an input of the release
// The artifact name should change when either input changes.
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
const source = await readFile("dist/widget.js");
const options = await readFile("protect.options.json");
const digest = createHash("sha256")
.update(source)
.update(options)
.digest("hex")
.slice(0, 12);
const artifactName = `widget.${digest}.js`;
Ship widget..js, or any other scheme you already use, as long as the digest covers both inputs. Recompute SRI from the file you actually uploaded, not from a file you protected last month. If you roll options back, you are rolling back to a previous artifact, not to "the same JS with different settings."
This is an operations habit, not a performance claim. I am not quoting any overhead numbers; measure the new file's size and startup behavior in your own environment before you call the change done.
The option reference and authorized API live at MeowShield.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.