<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: VEILVM</title>
    <description>The latest articles on DEV Community by VEILVM (@veilvm).</description>
    <link>https://dev.to/veilvm</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4224109%2F9db58b8d-6838-49a4-8789-bfbb70b0f8b0.png</url>
      <title>DEV Community: VEILVM</title>
      <link>https://dev.to/veilvm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/veilvm"/>
    <language>en</language>
    <item>
      <title>Review the MeowShield config diff, not the obfuscated output diff</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Tue, 24 Nov 2026 03:37:42 +0000</pubDate>
      <link>https://dev.to/veilvm/review-the-meowshield-config-diff-not-the-obfuscated-output-diff-3hid</link>
      <guid>https://dev.to/veilvm/review-the-meowshield-config-diff-not-the-obfuscated-output-diff-3hid</guid>
      <description>&lt;p&gt;Disclosure: I help promote MeowShield. Teams that add an obfuscation step to their release usually discover a code-review problem within a week: someone commits a protected bundle, the pull request shows a 40,000-line diff of unreadable characters, and reviewers either rubber-stamp it or give up. Here is a cleaner arrangement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not commit protected output
&lt;/h2&gt;

&lt;p&gt;Protected output is a build artifact. Treat it like minified bundles: generate it in CI, store it as a release artifact, and keep it out of the repository. Then the only thing a pull request can change about protection is the configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the configuration small and reviewable
&lt;/h2&gt;

&lt;p&gt;Put the options you send to the protection step in one file, for example &lt;code&gt;protect.config.json&lt;/code&gt;. For MeowShield's authorized API the documented request has &lt;code&gt;sourceCode&lt;/code&gt;, &lt;code&gt;apiToken&lt;/code&gt; and an &lt;code&gt;options&lt;/code&gt; object whose &lt;code&gt;mode&lt;/code&gt; is &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt; or &lt;code&gt;high&lt;/code&gt;. The token comes from a CI secret, never from the file. Copy the full current &lt;code&gt;options&lt;/code&gt; shape from the official API docs rather than from memory.&lt;/p&gt;

&lt;p&gt;A change then reads like this in review:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt; {
&lt;span class="gd"&gt;-  "mode": "low",&lt;/span&gt;
&lt;span class="gi"&gt;+  "mode": "medium",&lt;/span&gt;
   "low": { "renameVariables": "...", "preprocessToES5": true }
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is a one-line diff a human can reason about.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the reviewer should ask
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why this change?&lt;/strong&gt; Link the threat or the bug that motivated it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Which files are affected?&lt;/strong&gt; If the job protects only certain modules, does the include list change?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What was measured?&lt;/strong&gt; Before/after size, startup time on a slow device, and the hot path that matters for this app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Which environments were tested?&lt;/strong&gt; The MeowShield homepage and docs tell users to verify compatibility rather than assume it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do we roll back?&lt;/strong&gt; Ideally: revert the config, rerun the release job.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let CI prove the rest
&lt;/h2&gt;

&lt;p&gt;Reviewers should not have to inspect output. Instead, CI should:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fail if the protection response is not a success (the documented &lt;code&gt;error&lt;/code&gt; field is 0 on success).&lt;/li&gt;
&lt;li&gt;Run the end-to-end suite against the protected artifact.&lt;/li&gt;
&lt;li&gt;Record the config hash next to the artifact so you can reproduce any release.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The limit
&lt;/h2&gt;

&lt;p&gt;A clean review process makes protection changes safer; it does not make obfuscation stronger than it is. MeowShield's FAQ puts it plainly: no protection is absolute, and the goal is to raise analysis cost while preserving behavior.&lt;/p&gt;

&lt;p&gt;If you are setting up this kind of pipeline, the API docs and presets are at &lt;a href="https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=review-config-diff-not-output" rel="noopener noreferrer"&gt;MeowShield&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>obfuscation</category>
      <category>codereview</category>
      <category>devops</category>
    </item>
    <item>
      <title>Code that reads its own names or source text needs extra testing after obfuscation</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Tue, 24 Nov 2026 03:37:26 +0000</pubDate>
      <link>https://dev.to/veilvm/code-that-reads-its-own-names-or-source-text-needs-extra-testing-after-obfuscation-3fgh</link>
      <guid>https://dev.to/veilvm/code-that-reads-its-own-names-or-source-text-needs-extra-testing-after-obfuscation-3fgh</guid>
      <description>&lt;p&gt;Disclosure: I help promote MeowShield. Most JavaScript does not care what its variables are called. A small but stubborn subset does, and that subset is where renaming-based obfuscators, MeowShield included, are most likely to surprise you. Here is how to find it before your users do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Patterns that depend on names
&lt;/h2&gt;

&lt;p&gt;Search your codebase for these before you protect a module:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 1. Function or class names used as data&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${handler.name} finished`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"QuotaError"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// 2. Building identifiers from strings&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"render"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;widgetType&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// 3. Reading source text&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;myFunction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"return a + b"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;snippet&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// 4. Serialising class instances by type name&lt;/span&gt;
&lt;span class="n"&gt;registry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each of these turns an identifier into data. Any tool that renames identifiers, or changes how a function is written, can change that data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters for MeowShield specifically
&lt;/h2&gt;

&lt;p&gt;MeowShield offers a Variable Renaming setting with several styles (Normal, Hexadecimal and more exotic alphabets), and the docs recommend starting with Normal or Hexadecimal. The Low preset also keeps &lt;code&gt;KeepTopVar&lt;/code&gt; on by default, which the docs describe as preserving top-level variable behavior for integration-sensitive runtimes. That helps with globals, but it is not a promise about every function's &lt;code&gt;.name&lt;/code&gt; or every &lt;code&gt;toString()&lt;/code&gt; result inside your module. Treat those as things to test, not things to assume.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the dependency explicit instead
&lt;/h2&gt;

&lt;p&gt;The more robust fix is to stop relying on names at all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;QuotaError&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"QUOTA"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;            &lt;span class="c1"&gt;// explicit, survives renaming&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"QUOTA"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;renderers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;renderChart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;renderTable&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;renderers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;widgetType&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// lookup table, not string concat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explicit string properties are data you control. Identifier names are not.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short test plan
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Grep for &lt;code&gt;.name&lt;/code&gt;, &lt;code&gt;constructor.name&lt;/code&gt;, &lt;code&gt;toString()&lt;/code&gt;, &lt;code&gt;new Function&lt;/code&gt;, &lt;code&gt;eval&lt;/code&gt; and computed global lookups.&lt;/li&gt;
&lt;li&gt;Add one test per hit that runs against the protected output.&lt;/li&gt;
&lt;li&gt;Run the protected file in the Playground first, then in your real browser and Node targets.&lt;/li&gt;
&lt;li&gt;If something breaks, follow the official troubleshooting advice: lower the level or disable options, then add them back one at a time.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;Obfuscation raises reading cost; it does not make secrets safe or replace server-side checks. Code that depends on its own source text is also a maintenance smell independent of any tool.&lt;/p&gt;

&lt;p&gt;You can run a sample module through the presets at &lt;a href="https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=code-that-reads-its-own-names" rel="noopener noreferrer"&gt;MeowShield&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>obfuscation</category>
      <category>testing</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Keep MeowShield out of your inner dev loop: protect release builds only</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Tue, 24 Nov 2026 03:37:05 +0000</pubDate>
      <link>https://dev.to/veilvm/keep-meowshield-out-of-your-inner-dev-loop-protect-release-builds-only-5cea</link>
      <guid>https://dev.to/veilvm/keep-meowshield-out-of-your-inner-dev-loop-protect-release-builds-only-5cea</guid>
      <description>&lt;p&gt;Disclosure: I help promote MeowShield. This post is about where an obfuscation step belongs in a normal JavaScript workflow, and the short answer is: not in the loop you run fifty times an hour.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the dev loop should stay readable
&lt;/h2&gt;

&lt;p&gt;Obfuscated output is designed to be harder to read. That is exactly what you want in the file your users download, and exactly what you do not want while you are debugging a failing test at 4 p.m. If every &lt;code&gt;npm run dev&lt;/code&gt; rebuild passes through a protection step, you pay three costs at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stack traces and breakpoints point into transformed code, so local debugging gets slower.&lt;/li&gt;
&lt;li&gt;Each rebuild waits on an extra step, and with an API-based step it also needs network access and a credential on every developer machine.&lt;/li&gt;
&lt;li&gt;You are tempted to hand that credential to more people and more laptops than necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of that buys you protection, because nobody outside your team ever sees your dev server output.&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple split
&lt;/h2&gt;

&lt;p&gt;Keep two build targets with an explicit flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"vite"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"vite build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"build:release"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"vite build &amp;amp;&amp;amp; node scripts/protect.mjs dist/assets/core-*.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"test:release"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npm run build:release &amp;amp;&amp;amp; playwright test --config=release.config.ts"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;protect.mjs&lt;/code&gt; script runs only in &lt;code&gt;build:release&lt;/code&gt;, which only your CI release job calls. Developers never need the protection credential locally. The MeowShield API documentation is explicit that the &lt;code&gt;apiToken&lt;/code&gt; belongs in a server-side or CI environment, so keeping it out of laptops is consistent with how the tool is meant to be used.&lt;/p&gt;

&lt;h2&gt;
  
  
  But test the protected build, too
&lt;/h2&gt;

&lt;p&gt;Splitting the loop creates one real risk: the code you debug is not the code you ship. Close that gap deliberately:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your release CI job runs the end-to-end suite against the protected output, not against &lt;code&gt;dist&lt;/code&gt; before protection.&lt;/li&gt;
&lt;li&gt;When a release-only bug appears, reproduce it by running &lt;code&gt;build:release&lt;/code&gt; locally with a short-lived credential or by downloading the CI artifact, rather than turning protection on for everyone.&lt;/li&gt;
&lt;li&gt;Keep the protection settings in a versioned config file, so "what did CI do" has a precise answer.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Use the Playground for experiments, not the build script
&lt;/h2&gt;

&lt;p&gt;When you want to try a different level or option, paste a real module into the MeowShield Playground and compare output, behavior and size there first. Only change the release config once you know what the change does. That keeps experiments out of your pipeline and out of your teammates' way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest limit
&lt;/h2&gt;

&lt;p&gt;Moving protection to release builds does not change what obfuscation can do. MeowShield's own FAQ says no protection is absolute; the goal is to raise analysis cost while keeping behavior. Secrets and authorization still belong on the server.&lt;/p&gt;

&lt;p&gt;If you want to see what the levels do to your own code, you can try it at &lt;a href="https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=protect-release-builds-only" rel="noopener noreferrer"&gt;MeowShield&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>obfuscation</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A dating or matching app still ships its compatibility scoring in the client</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Tue, 24 Nov 2026 01:15:25 +0000</pubDate>
      <link>https://dev.to/veilvm/a-dating-or-matching-app-still-ships-its-compatibility-scoring-in-the-client-1aam</link>
      <guid>https://dev.to/veilvm/a-dating-or-matching-app-still-ships-its-compatibility-scoring-in-the-client-1aam</guid>
      <description>&lt;p&gt;Swipe apps and niche matching products often compute a "compatibility" percentage before the user even hits like. Interests, deal-breakers, distance decay, activity scores, and the mysterious boost that puts some profiles on top — if that formula runs in JavaScript, it is public.&lt;/p&gt;

&lt;p&gt;This is not only an IP problem. It is a fairness and abuse problem. Anyone who can read the scorer can game it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What usually ships in the feed bundle
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Feature weights&lt;/strong&gt; – shared hobbies, education, religion, smoking, kids, "intent" answers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard filters&lt;/strong&gt; – age band, distance, gender preferences, verified-only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Soft boosts&lt;/strong&gt; – recently active, high reply rate, subscription tier, "popularity" priors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decay curves&lt;/strong&gt; – how fast distance or inactivity hurts the score.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Experiment flags&lt;/strong&gt; – which users see which ranking variant.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the kind of function that turns up in a minified feed chunk:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;compatibility&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ageMin&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ageMax&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;Infinity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;haversineKm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;maxKm&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;Infinity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;tag&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;likes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;likes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tag&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tag&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;recencyScore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastActive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;photo&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;photoQuality&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isSubscriber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subBoost&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dealbreakers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;traits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dealPenalty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Those &lt;code&gt;w.*&lt;/code&gt; constants decide who gets seen. They also tell a scraper exactly how to build a profile that ranks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Abuse scenarios that matter more than cloning
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Profile optimization.&lt;/strong&gt; Creators and agencies A/B their bios against your weights.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bot farms.&lt;/strong&gt; Bots pass every client-side filter and only fail (maybe) on the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incel / harassment tooling.&lt;/strong&gt; Public write-ups of ranking leaks become guides for targeting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Competitor clones.&lt;/strong&gt; A rival niche app copies your scoring overnight.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Obfuscation helps with (4) and slows down (1)–(3). It does &lt;strong&gt;not&lt;/strong&gt; replace server-side ranking. If the ordered feed comes from the client sorting a big candidate array, you have already lost control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design the trust boundary correctly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The server should return an ordered candidate list (or opaque scores). The client should not re-rank the global pool with a full weight table.&lt;/li&gt;
&lt;li&gt;Hard safety filters (banned users, underage checks, block lists) must be enforced server-side every time.&lt;/li&gt;
&lt;li&gt;Subscription unlocks ("see who liked you") are API authorizations, not CSS.&lt;/li&gt;
&lt;li&gt;Client-side previews for "edit profile → estimated reach" can use a reduced model, not the production weights.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Protecting what must stay on the device
&lt;/h2&gt;

&lt;p&gt;Some matching UX is offline-first or does instant re-score when the user tweaks filters. For that reduced model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep production weights off the client entirely; ship a distilled approximation if you need UX.&lt;/li&gt;
&lt;li&gt;If you must ship real weights for a thin client, VM-obfuscate the scorer and constant table.&lt;/li&gt;
&lt;li&gt;Rotate weight versions and bind them to account sessions so a dumped table goes stale.&lt;/li&gt;
&lt;li&gt;Monitor for anomalous client versions or patched bundles.&lt;/li&gt;
&lt;li&gt;Never put moderation classifiers that decide harassment/safety solely in the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Production feed order is computed on the server.&lt;/li&gt;
&lt;li&gt;[ ] Safety and age checks are server-enforced on every request.&lt;/li&gt;
&lt;li&gt;[ ] Any client "compatibility %" uses a reduced model or is clearly approximate.&lt;/li&gt;
&lt;li&gt;[ ] Weight tables are not sitting as plain JSON in the bundle.&lt;/li&gt;
&lt;li&gt;[ ] VM or control-flow protection covers the client scorer if it still ships.&lt;/li&gt;
&lt;li&gt;[ ] Source maps for matching chunks are private.&lt;/li&gt;
&lt;li&gt;[ ] Paid features are gated by API responses, not by hiding DOM nodes.&lt;/li&gt;
&lt;li&gt;[ ] You have a plan for rotating leaked weights.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest bottom line
&lt;/h2&gt;

&lt;p&gt;Obfuscation raises the cost of reading your matching brain. It does not make attraction fair, and it does not stop a determined abuser who can observe outcomes. Put authority on the server; use protection on the client for the leftover IP.&lt;/p&gt;

&lt;p&gt;Disclosure: I work on &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=dating-matching-compatibility-scoring" rel="noopener noreferrer"&gt;VEILVM&lt;/a&gt;, a JavaScript VM-protection service. Free browser playground (3 runs/day, ≤5 KB) and Pro at $9/month or $79/year. Details at &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=dating-matching-compatibility-scoring" rel="noopener noreferrer"&gt;vm.ldvmp.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>A delivery web app still ships its route-optimizer heuristic to every driver</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Tue, 24 Nov 2026 01:14:19 +0000</pubDate>
      <link>https://dev.to/veilvm/a-delivery-web-app-still-ships-its-route-optimizer-heuristic-to-every-driver-59p0</link>
      <guid>https://dev.to/veilvm/a-delivery-web-app-still-ships-its-route-optimizer-heuristic-to-every-driver-59p0</guid>
      <description>&lt;p&gt;Delivery and field-service web apps love to show an optimized stop list the moment a driver opens the shift. That snappy UX usually means the scoring heuristic — distance, time windows, vehicle capacity, priority flags, and the little penalties that decide who gets visited first — is running in the browser.&lt;/p&gt;

&lt;p&gt;If it runs in the browser, every driver (and every competitor) can download it. This post walks through what ships, how it gets extracted, and how to harden the parts that actually matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What typically lands in the driver bundle
&lt;/h2&gt;

&lt;p&gt;Open DevTools on a modern dispatch PWA and you will often find:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost functions&lt;/strong&gt; – travel time estimates, traffic multipliers, parking/delay constants per stop type.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constraint checks&lt;/strong&gt; – max weight, max stops, refrigerated vs dry, skill tags for the driver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time-window scoring&lt;/strong&gt; – early/late soft penalties, hard windows that must not break.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local search moves&lt;/strong&gt; – 2-opt, relocate, swap — the neighborhood operators and acceptance rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tie-breakers&lt;/strong&gt; – VIP customers, SLA tiers, and "don't leave the warehouse last" style hacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those numbers are not academic. They are how you promised SLAs to enterprise customers.&lt;/p&gt;

&lt;h2&gt;
  
  
  A realistic excerpt attackers look for
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;scoreInsert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;detour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="nf"&gt;travelMin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;travelMin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;travelMin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;late&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windowEnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;early&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windowStart&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;overload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kg&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;capacityKg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;detour&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wDetour&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="n"&gt;late&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wLate&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="n"&gt;early&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wEarly&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="n"&gt;overload&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wCap&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vip&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vipBonus&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cfg.wLate&lt;/code&gt;, &lt;code&gt;cfg.vipBonus&lt;/code&gt; and friends are the product. Grepping for &lt;code&gt;wLate&lt;/code&gt; or &lt;code&gt;vipBonus&lt;/code&gt; is enough to find them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why "but it's only a heuristic" is not a defense
&lt;/h2&gt;

&lt;p&gt;Yes, the optimal VRP is NP-hard and your client heuristic is approximate. That does not mean it is worthless to steal. A rival logistics SaaS can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pretty-print your bundle and copy the weights.&lt;/li&gt;
&lt;li&gt;Replay historical stop lists through your scorer to reverse-engineer priorities.&lt;/li&gt;
&lt;li&gt;Patch &lt;code&gt;scoreInsert&lt;/code&gt; so their test driver always gets the easy route while you debug "weird" rankings.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Obfuscation raises the cost of step 1. It does &lt;strong&gt;not&lt;/strong&gt; make route decisions trustworthy. Anything that affects pay, SLA billing, or customer promises must be computed or re-validated on the server.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to move server-side
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Final committed route for the shift (the one you bill against).&lt;/li&gt;
&lt;li&gt;Recalculation after a failed delivery or new urgent stop.&lt;/li&gt;
&lt;li&gt;Driver pay / piece-rate calculations.&lt;/li&gt;
&lt;li&gt;Any "VIP must be first" business rule that legal or sales cares about.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep a lighter client heuristic for instant drag-and-drop feedback if you need UX, but treat it as advisory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where VM protection helps
&lt;/h2&gt;

&lt;p&gt;For the client heuristic you still ship:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bundle the optimizer separately from the map UI.&lt;/li&gt;
&lt;li&gt;Apply VM-based obfuscation to &lt;code&gt;scoreInsert&lt;/code&gt;, the weight table, and neighborhood operators so copied code is bytecode, not readable JS.&lt;/li&gt;
&lt;li&gt;Leave pure distance lookups (or a Wasm matrix) lighter if profiling says the VM is too slow on low-end phones.&lt;/li&gt;
&lt;li&gt;Strip source maps from the public driver PWA.&lt;/li&gt;
&lt;li&gt;Send a hash of the heuristic version with each accepted route so the server can reject unknown builds.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Committed routes and billing are produced or confirmed on the server.&lt;/li&gt;
&lt;li&gt;[ ] Client scoring is labeled advisory in product docs and in code comments your team will read.&lt;/li&gt;
&lt;li&gt;[ ] Optimizer weights live in a separate chunk with stronger obfuscation than the UI.&lt;/li&gt;
&lt;li&gt;[ ] Performance on mid-range Android is measured after protection.&lt;/li&gt;
&lt;li&gt;[ ] Source maps for the driver app are not public.&lt;/li&gt;
&lt;li&gt;[ ] Server rejects routes from unknown heuristic versions when stakes are high.&lt;/li&gt;
&lt;li&gt;[ ] No secrets (API keys for traffic vendors, internal SLA tables you cannot disclose) sit only in the client.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;A delivery web app that optimizes in the browser ships its competitive brain to every handset. Use the client for snappy previews, enforce money and SLA logic on the server, and make the shipped heuristic expensive to lift.&lt;/p&gt;

&lt;p&gt;Disclosure: I work on &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=delivery-route-optimizer-heuristic" rel="noopener noreferrer"&gt;VEILVM&lt;/a&gt;, a JavaScript VM-protection service. Free tier in the browser (3 runs/day, up to 5 KB) and Pro at $9/month or $79/year. Try it at &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=delivery-route-optimizer-heuristic" rel="noopener noreferrer"&gt;vm.ldvmp.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>A browser CAD or floor-plan tool still ships its geometry kernel and snapping rules</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Tue, 24 Nov 2026 01:13:29 +0000</pubDate>
      <link>https://dev.to/veilvm/a-browser-cad-or-floor-plan-tool-still-ships-its-geometry-kernel-and-snapping-rules-g42</link>
      <guid>https://dev.to/veilvm/a-browser-cad-or-floor-plan-tool-still-ships-its-geometry-kernel-and-snapping-rules-g42</guid>
      <description>&lt;p&gt;Browser-based CAD and floor-plan editors have become seriously good. You can draw walls, drop in doors, get automatic room areas, and export a dimensioned plan without installing anything. Behind that smooth experience is usually years of work on a geometry kernel: polygon offsetting, wall-join resolution, snapping heuristics, area rules, and the little tolerances that make a drawing "feel right".&lt;/p&gt;

&lt;p&gt;If that kernel runs in the browser, every visitor downloads it. This post looks at what exactly ships, how competitors actually lift it, and what you can realistically do about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a floor-plan editor really sends to the client
&lt;/h2&gt;

&lt;p&gt;Open the network tab on almost any web floor-plan tool and you will find one or two large bundles. Inside them, beyond the React or canvas UI, there is typically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Wall-join logic&lt;/strong&gt; – how two or three walls meet at a corner, mitre vs. butt joins, and the special cases for T-junctions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Snapping rules&lt;/strong&gt; – grid snap, angle snap (15°, 45°, 90°), snap-to-midpoint, snap priorities and the pixel tolerances that decide which one wins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Area and perimeter calculation&lt;/strong&gt; – including regional rules like whether wall thickness counts, how balconies or stairwells are treated, and rounding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Opening placement constraints&lt;/strong&gt; – minimum distance of a door from a corner, window sill heights, clearance checks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Export pipelines&lt;/strong&gt; – DXF/SVG/PDF generation, layer naming conventions, and the scale handling that customers pay for.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of that is "secret" in the cryptographic sense, but it is the difference between a weekend demo and a product people pay for.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it gets copied
&lt;/h2&gt;

&lt;p&gt;Nobody reverse-engineers a geometry kernel from scratch. They do something much simpler:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pretty-print the bundle in DevTools.&lt;/li&gt;
&lt;li&gt;Search for telltale constants (&lt;code&gt;0.001&lt;/code&gt;, &lt;code&gt;Math.PI / 12&lt;/code&gt;, &lt;code&gt;EPSILON&lt;/code&gt;) or strings like &lt;code&gt;"mitre"&lt;/code&gt; and &lt;code&gt;"snapAngle"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Set a breakpoint inside the wall-drawing handler and step out until they find the pure functions.&lt;/li&gt;
&lt;li&gt;Copy those functions into their own project, rename a few things, and ship.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the kind of function that gets lifted almost verbatim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Resolve which snap target wins for the cursor position&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;resolveSnap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;opts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;angleStep&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PI&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hypot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'endpoint'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'midpoint'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mf"&gt;0.8&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nf"&gt;snapToAngle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;angleStep&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The weights and tolerances in that snippet are the result of user testing. Reading them takes thirty seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually protects you
&lt;/h2&gt;

&lt;p&gt;Be honest with yourself about the threat. You are not stopping a determined reverse engineer who has a week. You are trying to make "copy the kernel" more expensive than "build your own", and to keep the parts that really matter off the client entirely.&lt;/p&gt;

&lt;h3&gt;
  
  
  Move what you can to the server
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Export&lt;/strong&gt; is the most commonly monetized feature and the easiest to move. Generate DXF/PDF on the server from the plan JSON, and check the user's plan there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch area reports, cost estimates and compliance checks&lt;/strong&gt; rarely need to be interactive at 60 fps. Run them server-side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Licence and seat checks&lt;/strong&gt; must be enforced on the API, never only in the UI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Keep the interactive kernel, but make it expensive to lift
&lt;/h3&gt;

&lt;p&gt;Snapping and wall joins must run locally or the editor feels laggy. For that code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bundle the kernel separately so you can treat it differently from UI code.&lt;/li&gt;
&lt;li&gt;Apply real obfuscation to that chunk only. Name-mangling from Terser is not enough; control-flow flattening helps, and VM-based protection (which compiles your functions into custom bytecode run by an embedded interpreter) helps more, because the copied code no longer looks like readable geometry.&lt;/li&gt;
&lt;li&gt;Measure performance. Geometry runs in tight loops; protect the decision logic and leave the hottest numeric inner loops lighter if needed.&lt;/li&gt;
&lt;li&gt;Keep source maps off the public CDN.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Make copying detectable
&lt;/h3&gt;

&lt;p&gt;Add a few harmless, distinctive constants or behaviors to the kernel so that if a competitor ships a suspiciously identical snapping engine, you can show it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Export, compliance reports and seat checks run on the server, not only in the UI.&lt;/li&gt;
&lt;li&gt;[ ] The interactive geometry kernel is bundled separately from the rest of the app.&lt;/li&gt;
&lt;li&gt;[ ] That kernel chunk is protected with stronger-than-mangling obfuscation (control-flow / VM).&lt;/li&gt;
&lt;li&gt;[ ] Hot numeric loops are measured after protection; dial back if FPS drops.&lt;/li&gt;
&lt;li&gt;[ ] Source maps for the kernel are not on the public CDN.&lt;/li&gt;
&lt;li&gt;[ ] A few distinctive, harmless markers exist so you can recognize a lifted copy.&lt;/li&gt;
&lt;li&gt;[ ] Paid plan and feature gates are enforced by the API, not by hiding a menu item.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;p&gt;Obfuscation raises the cost of copying; it does not make a secret safe. Treat the client as a convenience layer and the server as the control plane.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;A browser CAD tool ships its most expensive R&amp;amp;D to every visitor. Move exports and compliance off the client, protect the interactive kernel that must stay local, and never pretend that hiding a function is the same as enforcing a business rule.&lt;/p&gt;

&lt;p&gt;Disclosure: I work on &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=cad-floor-plan-geometry-kernel" rel="noopener noreferrer"&gt;VEILVM&lt;/a&gt;, a JavaScript VM-protection service. Free browser tier (3 runs/day, up to 5 KB) and a Pro plan at $9/month or $79/year with API access. Try the playground at &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=cad-floor-plan-geometry-kernel" rel="noopener noreferrer"&gt;vm.ldvmp.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>Load the MeowShield-protected chunk when it is needed, not on your critical path</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Mon, 23 Nov 2026 03:48:29 +0000</pubDate>
      <link>https://dev.to/veilvm/load-the-meowshield-protected-chunk-when-it-is-needed-not-on-your-critical-path-486g</link>
      <guid>https://dev.to/veilvm/load-the-meowshield-protected-chunk-when-it-is-needed-not-on-your-critical-path-486g</guid>
      <description>&lt;p&gt;If the code worth protecting is a pricing calculator, an editor feature, or a scoring routine, it probably does not need to run before your first paint. Splitting it out lets you protect it more heavily without making every page view pay for that.&lt;/p&gt;

&lt;p&gt;I help promote MeowShield. Nothing here depends on a special MeowShield feature: it is ordinary code splitting, applied so the protection cost lands where it is useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Move the sensitive logic into its own entry or dynamically imported module.&lt;/li&gt;
&lt;li&gt;Build normally. Your bundler emits a separate file for it.&lt;/li&gt;
&lt;li&gt;Run MeowShield on that file only, at the level your threat model needs. Leave the rest at no protection or a light level.&lt;/li&gt;
&lt;li&gt;Load it on demand.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// main bundle: small, unprotected or lightly protected&lt;/span&gt;
&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'click'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;quote&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./pricing-engine.js'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// protected chunk&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;readForm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Things that break, and how to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chunk file names.&lt;/strong&gt; Many bundlers hash file names and reference them from the main bundle. Protect the chunk &lt;em&gt;after&lt;/em&gt; bundling, then make sure the file name the main bundle expects still points at the protected output. If your pipeline recomputes hashes after protection, update the manifest, not the protected code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Export shape.&lt;/strong&gt; The main bundle calls &lt;code&gt;quote&lt;/code&gt; by name. Test that the protected chunk still exposes the same exports, through the same import call, in the browsers you support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrity and caching.&lt;/strong&gt; If you use SRI or cache keys, compute them from the protected file you actually serve.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failure UX.&lt;/strong&gt; A dynamic import can fail on flaky networks. Handle the rejected promise and show a retry, as you would for any lazy route.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why this helps the security story too
&lt;/h2&gt;

&lt;p&gt;A smaller protected surface is easier to test thoroughly. It also makes clear, in code review, which logic you consider sensitive and why, which is a better conversation than "obfuscate everything."&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;p&gt;Lazy loading does not hide the chunk from anyone who triggers the feature; the browser still downloads it. Obfuscation raises the cost of reading it, nothing more. Prices, entitlements, and anything that must not be trusted from a client still need server-side checks.&lt;/p&gt;

&lt;p&gt;To pick a level for the split-out chunk, paste just that file into the Playground at &lt;a href="https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=lazy-load-protected-chunk" rel="noopener noreferrer"&gt;MeowShield&lt;/a&gt; and compare levels on real input before automating it.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>performance</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>Put the size and startup cost of a MeowShield build on a budget, measured in CI</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Mon, 23 Nov 2026 03:47:50 +0000</pubDate>
      <link>https://dev.to/veilvm/put-the-size-and-startup-cost-of-a-meowshield-build-on-a-budget-measured-in-ci-3191</link>
      <guid>https://dev.to/veilvm/put-the-size-and-startup-cost-of-a-meowshield-build-on-a-budget-measured-in-ci-3191</guid>
      <description>&lt;p&gt;Obfuscation is a trade: you make code more expensive to read, and you usually pay something in bytes and runtime. The mistake is not paying; it is paying without measuring, so a later option change quietly doubles your download.&lt;/p&gt;

&lt;p&gt;I help promote MeowShield. I am deliberately not quoting overhead numbers here. Its own Docs tell you to run a real sample and compare output, runtime behavior, and file size, and that is the right instinct: the cost depends on your code and the options you pick.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure three things, every build
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Transfer size&lt;/strong&gt; of the protected file after compression (gzip or brotli, whatever your CDN serves).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parse/compile and first-execution time&lt;/strong&gt; on a slow reference device or a CPU-throttled browser profile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hot-path time&lt;/strong&gt; for the one or two functions you actually protected, if they run often.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Record the same numbers for the unprotected build in the same job, so you compare like with like.&lt;/p&gt;

&lt;h2&gt;
  
  
  A minimal size check
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;raw&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;gzip -9 -c dist/app.js &lt;span class="o"&gt;|&lt;/span&gt; wc -c&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;prot&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;gzip -9 -c dist/app.protected.js &lt;span class="o"&gt;|&lt;/span&gt; wc -c&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"gzip unprotected=$raw protected=$prot"&lt;/span&gt;

&lt;span class="c"&gt;# fail if protected output grows past the budget you agreed on&lt;/span&gt;
&lt;span class="nv"&gt;BUDGET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;${BUDGET_BYTES:-250000}&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$prot"&lt;/span&gt; -le &lt;span class="s2"&gt;"$BUDGET"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"protected bundle over budget"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;exit&lt;/span&gt; 1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The budget is yours to set. Start from today's measured value plus a margin, not from a guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  A minimal timing check
&lt;/h2&gt;

&lt;p&gt;For startup, use a real browser in CI (Playwright or Puppeteer) with CPU throttling, and read &lt;code&gt;performance&lt;/code&gt; marks around your app's init. For a hot function, a small harness that calls it many times with fixed inputs is enough to spot a regression. Compare medians across several runs; single runs are noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do with the numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If size jumped after an option change, revert that one option and confirm it was the cause.&lt;/li&gt;
&lt;li&gt;The Docs describe some options as adding volume without runtime hardening (for example, injected comments). Those are the first to question when bytes matter.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;perfOptimization&lt;/code&gt; is documented as biasing toward lower runtime overhead at some cost to strength. Test it on latency-sensitive paths rather than enabling it everywhere.&lt;/li&gt;
&lt;li&gt;Protect only the module that needs it. Vendor code and UI glue rarely justify the cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;p&gt;A budget keeps cost visible; it does not make protection stronger. No obfuscation is absolute, and anything that must stay secret belongs on the server.&lt;/p&gt;

&lt;p&gt;If you want a baseline to start the budget from, run your real file through the Playground at &lt;a href="https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=budget-bytes-of-protected-build" rel="noopener noreferrer"&gt;MeowShield&lt;/a&gt; and record the output size before you automate.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>performance</category>
      <category>obfuscation</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A client-side photo proofing gallery still ships the logic that removes its own watermark</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Mon, 23 Nov 2026 01:14:45 +0000</pubDate>
      <link>https://dev.to/veilvm/a-client-side-photo-proofing-gallery-still-ships-the-logic-that-removes-its-own-watermark-1cke</link>
      <guid>https://dev.to/veilvm/a-client-side-photo-proofing-gallery-still-ships-the-logic-that-removes-its-own-watermark-1cke</guid>
      <description>&lt;p&gt;Photographers, stock-image startups and print shops love browser-based proofing galleries. The client logs in, scrolls through previews, picks favourites, and only gets clean full-resolution files after paying. To keep server costs down, many of these galleries draw the watermark in the browser, on a canvas, on top of an image the server sent without one.&lt;/p&gt;

&lt;p&gt;If that sounds risky, it is. Let me show why, and what a more defensible setup looks like.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern
&lt;/h2&gt;

&lt;p&gt;Here is a condensed version of code I have seen in more than one commercial gallery:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderProof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;photo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/img/${photo.id}?w=${session.paid ? 4000 : 1600}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"2d"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drawImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paid&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;photo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;purchased&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;globalAlpha&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.35&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;font&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"bold 64px sans-serif"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"PROOF"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three problems jump out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The source image is clean.&lt;/strong&gt; The watermark exists only on the canvas. Anyone can copy the URL from the Network tab and download the original.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resolution depends on a client flag.&lt;/strong&gt; Change &lt;code&gt;w=1600&lt;/code&gt; to &lt;code&gt;w=4000&lt;/code&gt; in the URL, or flip &lt;code&gt;session.paid&lt;/code&gt; in the console, and you may get the full file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The rule is readable.&lt;/strong&gt; Even if you fix the first two, the code tells an attacker exactly which endpoint, parameter and flag to target.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Fix the architecture first
&lt;/h2&gt;

&lt;p&gt;No obfuscator fixes an unwatermarked image being served to an unpaid user. The defensible baseline is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Burn watermarks on the server&lt;/strong&gt; (or at your CDN's image-transformation layer) for every proof derivative. The browser should never receive pixels you would not want shared.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cap preview resolution server-side.&lt;/strong&gt; The image endpoint checks the order status for that photo and session, ignoring any width the client asks for above the proof limit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sign image URLs&lt;/strong&gt; with short expiry so links pasted into a forum stop working.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deliver originals only via a post-purchase download&lt;/strong&gt; that checks payment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once that is in place, the canvas code above becomes cosmetic: a nicer overlay, an animated "selected" badge, a crop preview.&lt;/p&gt;

&lt;h2&gt;
  
  
  So where does JavaScript protection fit?
&lt;/h2&gt;

&lt;p&gt;There is still client logic worth protecting in a proofing product:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Forensic or invisible marks&lt;/strong&gt; you add in the browser for tracing leaks — for example, per-session noise patterns or subtle per-client overlay offsets. If the algorithm is readable, it is easy to strip.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selection and pricing rules&lt;/strong&gt; shown in the UI (bundle discounts, print-size pricing) that competitors would happily copy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anti-scraping heuristics&lt;/strong&gt; such as rate pacing and detection of automated scrolling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VM-based obfuscation turns those functions into bytecode for a custom interpreter. An attacker who wants to understand your forensic-mark algorithm now has to reverse the VM first. Integrity checks make it harder to patch out the marking step and still have the gallery work, and anti-debugging slows down step-through analysis.&lt;/p&gt;

&lt;p&gt;What it will not do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stop screenshots. Nothing in the browser stops screenshots.&lt;/li&gt;
&lt;li&gt;Protect an image the server already sent clean.&lt;/li&gt;
&lt;li&gt;Replace payment checks on the download endpoint.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A quick audit you can run today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Open a proof as an unpaid client, copy the image URL from the Network tab, open it in a new tab. Is there a watermark?&lt;/li&gt;
&lt;li&gt;[ ] Edit the width or quality parameter in that URL. Does the server refuse anything above the proof size?&lt;/li&gt;
&lt;li&gt;[ ] Do image URLs expire, and are they bound to the session?&lt;/li&gt;
&lt;li&gt;[ ] Is the original file reachable only through a purchase-checked download route?&lt;/li&gt;
&lt;li&gt;[ ] Are client-side forensic marks and pricing rules VM-protected rather than just minified?&lt;/li&gt;
&lt;li&gt;[ ] Are source maps disabled for the gallery bundle?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the first two answers are "no", fix those before anything else. That is ninety percent of the value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Client-side watermarking is tempting because it is cheap. But the browser is the customer's machine, and anything you draw there can be undrawn. Put the watermark in the pixels on the server, and use code protection for the extra layers — tracing, pricing, anti-scraping — that make the product yours.&lt;/p&gt;

&lt;p&gt;Disclosure: I work on VEILVM. It is a browser-based tool for VM protection of JavaScript; you can try it free (3 runs a day, files up to 5 KB, no account needed), and Pro is $9/month or $79/year with API access for build pipelines. More at &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=photo-proofing-gallery-ships-watermark-logic" rel="noopener noreferrer"&gt;VEILVM&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>Your WebRTC client ships its signaling protocol and TURN credential logic to every caller</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Mon, 23 Nov 2026 01:14:24 +0000</pubDate>
      <link>https://dev.to/veilvm/your-webrtc-client-ships-its-signaling-protocol-and-turn-credential-logic-to-every-caller-14fn</link>
      <guid>https://dev.to/veilvm/your-webrtc-client-ships-its-signaling-protocol-and-turn-credential-logic-to-every-caller-14fn</guid>
      <description>&lt;p&gt;WebRTC feels like magic the first time you get two browsers talking to each other. The media flows peer-to-peer, the server load is low, and the API is right there in every modern browser. But a WebRTC app is never only peer-to-peer. There is always a signaling layer, usually a TURN relay, and often a set of rules about who can join which room. A surprising amount of that lives in client JavaScript.&lt;/p&gt;

&lt;p&gt;I want to walk through what an attacker sees when they open your video-calling bundle, and which parts of the problem obfuscation actually helps with.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the bundle reveals
&lt;/h2&gt;

&lt;p&gt;Open the Sources panel on almost any browser-based meeting tool and search for &lt;code&gt;RTCPeerConnection&lt;/code&gt;. Within a minute you will usually find:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the signaling message format (join, offer, answer, candidate, kick, mute-all);&lt;/li&gt;
&lt;li&gt;the room-joining handshake, including any client-side "is this user a host?" check;&lt;/li&gt;
&lt;li&gt;the code that requests TURN credentials, and sometimes the credentials themselves;&lt;/li&gt;
&lt;li&gt;codec preferences, simulcast layers and bandwidth caps that tie into paid tiers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A trimmed example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;joinRoom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;roomId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;credential&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/turn?room=${roomId}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RTCPeerConnection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;iceServers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;credential&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;isHost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ownerId&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"pro"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"join"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;roomId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;isHost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxBitrate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;isHost&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;2500&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onmessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;handleSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;isHost&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From this alone someone learns that the server &lt;em&gt;might&lt;/em&gt; trust a &lt;code&gt;host&lt;/code&gt; flag sent by the client, that higher bitrate is gated on a plan check done in the browser, and where to fetch relay credentials for any room ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real risks, in order of severity
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Server trusting client claims.&lt;/strong&gt; If the signaling server accepts &lt;code&gt;host: true&lt;/code&gt; without checking the session, any participant can kick others or end the meeting. This is the most common serious bug and it is purely a server problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. TURN relay abuse.&lt;/strong&gt; TURN servers relay traffic and cost real bandwidth. Long-lived static TURN credentials in the bundle let anyone use your relay as a free proxy. The fix is short-lived credentials (the standard time-limited HMAC scheme), issued only to authenticated users who are actually in a room.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Protocol cloning.&lt;/strong&gt; Competitors or third-party "enhancer" tools can reimplement your signaling protocol, build bots that join rooms, or scrape participant lists. This is where client-side protection becomes relevant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Plan-gating bypass.&lt;/strong&gt; If bitrate, recording or participant limits are only enforced in the UI, a modified client gets them for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  What VM protection can and cannot do
&lt;/h2&gt;

&lt;p&gt;VM-based obfuscation translates selected functions into a private bytecode executed by an embedded interpreter. For a WebRTC app that is a good fit for the signaling message builder, the handler that parses server messages, and any custom encryption or framing you layer on top of data channels. Reverse-engineering the protocol now means unpicking the interpreter first, and anti-debugging plus integrity checks make live patching of the &lt;code&gt;isHost&lt;/code&gt; line much more annoying.&lt;/p&gt;

&lt;p&gt;But be honest about the limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Messages on the wire are still visible in the Network panel's WebSocket view. Protecting the code that builds them does not hide the messages themselves unless you also encrypt or sign them.&lt;/li&gt;
&lt;li&gt;TURN credentials returned by your API are visible the moment they arrive. Obfuscation is not a substitute for short TTLs.&lt;/li&gt;
&lt;li&gt;Role checks and plan limits must be enforced by the signaling server and the SFU. Always.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short: protection slows down cloning and casual tampering; the server keeps authority.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist before you ship
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] The signaling server derives host/moderator roles from the authenticated session, never from a client field.&lt;/li&gt;
&lt;li&gt;[ ] TURN credentials are time-limited (minutes, not days) and issued per authenticated user.&lt;/li&gt;
&lt;li&gt;[ ] Bitrate caps, recording and participant limits are enforced by the SFU or media server.&lt;/li&gt;
&lt;li&gt;[ ] Signaling messages carry a server-issued token so bots cannot join with a guessed room ID.&lt;/li&gt;
&lt;li&gt;[ ] Protocol builders and parsers are VM-protected; media and UI code is left alone for performance.&lt;/li&gt;
&lt;li&gt;[ ] Production source maps are not publicly reachable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;WebRTC pushes a lot of logic to the edge by design. That is fine as long as the edge is treated as untrusted. Do the server-side work first; then protect the parts of the client you would rather not see reimplemented by someone else next month.&lt;/p&gt;

&lt;p&gt;Disclosure: I work on VEILVM, a JavaScript VM protection service. It runs in the browser, with 3 free runs per day up to 5 KB without signing up, and Pro at $9/month or $79/year for larger files and API access. If you want to try it on your signaling module, start at &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=webrtc-client-ships-signaling-turn-logic" rel="noopener noreferrer"&gt;VEILVM&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>A dApp front end still ships your transaction-building logic to every wallet</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Mon, 23 Nov 2026 01:13:57 +0000</pubDate>
      <link>https://dev.to/veilvm/a-dapp-front-end-still-ships-your-transaction-building-logic-to-every-wallet-3238</link>
      <guid>https://dev.to/veilvm/a-dapp-front-end-still-ships-your-transaction-building-logic-to-every-wallet-3238</guid>
      <description>&lt;p&gt;Most Web3 teams are careful about their smart contracts. They pay for audits, they run fuzzers, they publish the verified source on a block explorer. Then the front end that actually &lt;em&gt;builds&lt;/em&gt; the transactions gets shipped as an ordinary JavaScript bundle, and nobody asks what is inside it.&lt;/p&gt;

&lt;p&gt;That bundle is usually more interesting than people assume. It is where fee splits are computed, where a route through three liquidity pools gets chosen, where a referral address is quietly appended, and where "this token is on our allowlist" is decided before the wallet popup ever appears.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually lives in the client
&lt;/h2&gt;

&lt;p&gt;In a typical swap or minting UI, the browser code is responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Route selection&lt;/strong&gt; — which pools or bridges to use, and in what order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fee and rebate math&lt;/strong&gt; — the protocol fee, the partner fee, sometimes a discount tier for holders of a particular NFT.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calldata assembly&lt;/strong&gt; — encoding the function call, slippage bounds and deadline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-flight policy&lt;/strong&gt; — blocking unsupported tokens, sanctioned addresses or regions, and showing warnings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a simplified version of something I see often:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildSwap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;amountIn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tier&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;baseFeeBps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;partnerBps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;PARTNERS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tier&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"holder"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;feeBps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;baseFeeBps&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;partnerBps&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;minOut&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amountIn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="no"&gt;SLIPPAGE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;ALLOWLIST&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Unsupported token"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"swapExact"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;amountIn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;minOut&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feeBps&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything in that function is readable by anyone who opens DevTools. A competitor can copy your routing heuristics and partner table. A user can see that the "holder" discount is a string comparison and try sending the transaction directly with a lower fee. A phishing kit author can clone the whole UI pixel-for-pixel and swap only the router address.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part people get wrong
&lt;/h2&gt;

&lt;p&gt;The important thing to understand is that &lt;strong&gt;the chain is the only real enforcement point&lt;/strong&gt;. If your router contract accepts a &lt;code&gt;feeBps&lt;/code&gt; argument from the caller and does not check it, then no amount of front-end protection matters: someone will call the contract directly with Etherscan's "Write Contract" tab or a ten-line ethers script.&lt;/p&gt;

&lt;p&gt;So the first job is boring and has nothing to do with obfuscation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fees, discounts and allowlists that matter economically must be enforced in the contract or in a signed quote from your backend.&lt;/li&gt;
&lt;li&gt;If a discount depends on holding an NFT, the contract should check the balance, not trust a flag.&lt;/li&gt;
&lt;li&gt;Partner rebates should be keyed to an on-chain registry, not a JavaScript object.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where obfuscation still earns its place
&lt;/h2&gt;

&lt;p&gt;Once the money-critical rules are on-chain, what remains in the browser is still valuable to &lt;em&gt;you&lt;/em&gt;: the routing heuristics you tuned for months, the gas estimation tricks, the risk-scoring that decides which warnings to show, and the general shape of your code.&lt;/p&gt;

&lt;p&gt;VM-based protection compiles selected functions into bytecode for a custom interpreter that ships inside the bundle. The logic still runs in the user's browser, but reading it means first understanding the interpreter and its instruction set, which turns a five-minute copy job into a real reverse-engineering project. Anti-debugging and integrity checks add friction for people trying to patch the bundle in place to redirect funds, which is exactly what UI-cloning phishing kits do.&lt;/p&gt;

&lt;p&gt;What it does &lt;strong&gt;not&lt;/strong&gt; do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It does not stop someone calling your contract directly.&lt;/li&gt;
&lt;li&gt;It does not hide contract addresses, ABI shapes or calldata — those are visible in the wallet popup and on-chain anyway.&lt;/li&gt;
&lt;li&gt;It does not make a weak contract safe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it as protecting your competitive edge and raising the cost of tampering, not as a security boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Every fee, discount and allowlist that affects value is enforced on-chain or by a backend signature with an expiry.&lt;/li&gt;
&lt;li&gt;[ ] The router rejects caller-supplied fee values outside a contract-defined range.&lt;/li&gt;
&lt;li&gt;[ ] Source maps are not published for production builds.&lt;/li&gt;
&lt;li&gt;[ ] Only the routing, scoring and calldata-assembly modules are VM-protected; UI components stay normal for performance.&lt;/li&gt;
&lt;li&gt;[ ] The bundle checks its own integrity and refuses to build transactions if the router address constant has been modified.&lt;/li&gt;
&lt;li&gt;[ ] You have tested a direct contract call with "illegal" parameters and confirmed it reverts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;The pattern is the same as in any web app: the server — here, the contract — decides; the client just proposes. Protecting the client code is still worthwhile when it contains logic you would rather not hand to every copycat.&lt;/p&gt;

&lt;p&gt;Disclosure: I work on VEILVM, a browser-based JavaScript VM protection tool. You can try it on a single function with no sign-up (3 free runs a day, up to 5 KB per file; a free account raises that to 30 KB). Pro is $9/month or $79/year and adds API access for CI. Take a look at &lt;a href="https://vm.ldvmp.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=dapp-frontend-ships-transaction-building" rel="noopener noreferrer"&gt;VEILVM&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>webdev</category>
      <category>obfuscation</category>
    </item>
    <item>
      <title>Do not pretty-print, lint-fix, or re-minify MeowShield output</title>
      <dc:creator>VEILVM</dc:creator>
      <pubDate>Sun, 22 Nov 2026 05:16:56 +0000</pubDate>
      <link>https://dev.to/veilvm/do-not-pretty-print-lint-fix-or-re-minify-meowshield-output-c5</link>
      <guid>https://dev.to/veilvm/do-not-pretty-print-lint-fix-or-re-minify-meowshield-output-c5</guid>
      <description>&lt;p&gt;A MeowShield-protected file is not a normal source artifact. It is the output of a transform you chose, with a shape that later tools may not understand. The instinct to "clean it up" is strong: run Prettier so the diff looks tidy, run ESLint with &lt;code&gt;--fix&lt;/code&gt;, send it through Terser "one more time" to recover a few bytes, or paste it into an editor that helpfully rewrites quotes and line breaks. Those tools were built for human-written JavaScript. They can change, or simply break, the file you just protected.&lt;/p&gt;

&lt;p&gt;I help promote MeowShield. The rule I would put in the repo is: once MeowShield has produced a file, that file is frozen. You may upload it, hash it, and serve it. You may not format it, lint-fix it, or pack it again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a second pass is tempting
&lt;/h2&gt;

&lt;p&gt;The output can look noisy. Identifiers are renamed, constants may be split, control flow may be less linear, and a stronger level can look unlike the module you reviewed in the pull request. A well-meaning reviewer asks for "just a format pass." A size-conscious release job already minifies everything in &lt;code&gt;dist/&lt;/code&gt;, and the protected file sits in that folder. A CDN filter injects a banner comment at the top. Each of those is a second transform.&lt;/p&gt;

&lt;p&gt;MeowShield's own guidance is to treat protection as something you validate — compare output, runtime behavior, and size — and, if something breaks, to lower the level or disable options rather than invent a cleanup step. Official docs also describe options that deliberately change syntax and layout. Running a formatter after that is not a neutral operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What goes wrong
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// later pipeline steps that rewrite the protected file&lt;/span&gt;
&lt;span class="c1"&gt;// prettier --write dist/protected.js&lt;/span&gt;
&lt;span class="c1"&gt;// eslint dist/protected.js --fix&lt;/span&gt;
&lt;span class="c1"&gt;// terser dist/protected.js -o dist/protected.js&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A formatter may reorder statements it believes are independent, normalize Unicode escapes, or rewrite template literals and numeric literals. A lint fix may remove "unused" bindings, inline values, or change &lt;code&gt;==&lt;/code&gt; to &lt;code&gt;===&lt;/code&gt;. A second minifier may flatten or rename things the first transform assumed would stay in place. Even a seemingly harmless banner comment can shift line breaks or, in awkward encodings, corrupt the first token.&lt;/p&gt;

&lt;p&gt;The failure is not always a parse error. Sometimes the file loads and only misbehaves on one path: a string that no longer matches, a function that is now slightly out of order, an error handler that no longer runs. Those bugs are hard to attribute if you also changed the protection level in the same release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the protected file off the source linters
&lt;/h2&gt;

&lt;p&gt;Put generated output in a directory that Prettier, ESLint, and "format on save" already ignore. Review the unprotected source in pull requests. Do not review the protected blob as if it were style-sensitive code, and do not commit a formatted variant next to the original "for readability." If someone needs to inspect output, they can do that in a scratch folder that never gets deployed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# examples: keep generated output out of source formatters
dist/protected/
build/meowshield/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same discipline applies to "helpful" post-processing in CI: no automatic license-banner prepend unless you have tested that exact prepend on a protected file and included it in the artifact you actually test. If you need a comment for license reasons, prefer keeping third-party notices adjacent and untouched, and leave the protected module alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  If the output looks "too large" or "too messy"
&lt;/h2&gt;

&lt;p&gt;Resist the urge to clean it. Size and readability are expected to change with the preset. The documented approach is to start with the smallest MeowShield level that matches your threat model, measure behavior and size, and only then consider a different level or a documented option. If the protected build breaks, lower the level or turn options off one at a time. A second obfuscator or a second minifier is not a documented troubleshooting step, and it makes the result harder to reason about: you will not know which tool is at fault.&lt;/p&gt;

&lt;p&gt;Also resist packing the output in &lt;code&gt;eval&lt;/code&gt; or wrapping it in an extra loader "for good measure." That is another transform, and it complicates both debugging and any later integrity hash.&lt;/p&gt;

&lt;h2&gt;
  
  
  A pipeline that freezes the file
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Compile or bundle the module you intend to protect.&lt;/li&gt;
&lt;li&gt;Run MeowShield on that module (Playground while you are learning, authorized API from CI once you automate).&lt;/li&gt;
&lt;li&gt;Write the returned code to an ignored output path, unchanged.&lt;/li&gt;
&lt;li&gt;Run your behavioral tests against that exact file.&lt;/li&gt;
&lt;li&gt;Upload that exact file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a test fails, change protection settings or the unprotected source, then generate a new file. Never "fix" the generated file by hand.&lt;/p&gt;

&lt;p&gt;You can see the raw output of a real module in the MeowShield Playground and practice saving it without a format pass: &lt;a href="https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=do-not-postprocess-meowshield-output" rel="noopener noreferrer"&gt;https://meowshield.com/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=do-not-postprocess-meowshield-output&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>obfuscation</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
