Does bla-agents Hide JavaScript From AI?

2026-12-04

I wrote a license check as one line of JavaScript, the text a browser or Node downloads and then runs. The line said yes only for one key. Then I asked the question in the title: does bla-agents hide javascript from ai. Bla-agents is a free command that writes a second copy of that file so a reader has a harder time seeing the logic. The secret words were gone from the copy. The check still said yes for the real key and no for a wrong one. The file grew from 109 bytes to 169,694 bytes.

Hiding the sentence is not the same as hiding the answer.

What Does bla-agents Change in a JavaScript File?

Map: bla-agents rewrites a JavaScript file into a larger copy that hides the secret string from a text search but still answers licenseOk, so the secret must stay on a server

It leaves your original file alone and writes a much larger copy, with the secret string removed and a stack of fake security notes at the top.

A page can only run code the visitor’s computer is allowed to read. That is the whole problem with a secret inside JavaScript. The browser, or Node on a desktop, has to see the instructions. Anyone who can open the page can open the file. In my original line, a search for the key found it instantly, because the key was written out as letters:

function licenseOk(key){ return key === "SECRET-KEY-42" && key.length > 8; }
module.exports = { licenseOk };

Encryption, locking the text so it cannot be read without a password, would also stop the browser from running it. Bla-agents does not do that. It rewrites the file into a form that still runs, and it fills the top with notes that look like hardware security. One of those notes says no license algorithm is present. That note is false. The check is still in the file. It is just no longer a single line you can read.

I previewed first. A preview here means a dry run: the command lists what it would touch and writes nothing.

npx -y bla-agents@3.8.0 harden . --dry-run

It named license.js and stopped. Then I ran the same command without --dry-run. The original file was still 109 bytes and still contained SECRET-KEY-42. The new file was .bla-hardened/license.js, 169,694 bytes. A search of that copy found no SECRET. The package wanted a slightly newer Node than the one I had, printed a warning, and finished anyway.

The command also printed a reading-cost multiplier in the thousands. I did not measure how much text a model would have to read. I measured the file and the answers. Do not treat that printed multiplier as a result from this test.

Flow: license.js of 109 bytes with the key in letters, dry run writes nothing, harden writes a mirror copy of 169,694 bytes, a text search for the key fails but calling licenseOk still answers

Does the Hidden Key Still Work?

Yes. The copy still returned true for SECRET-KEY-42 and false for a wrong string.

I loaded each file in Node and called licenseOk. The original said true, then false. The copy said true, then false. Same two answers. The name on the export was still licenseOk. Only the function behind that name had been replaced with a generated one.

I timed a fresh Node process that loaded the file and made both calls. Median of 20 runs: 0.023 seconds for the original, 0.033 seconds for the copy. The huge file did not make this check thousands of times slower. The cost showed up as bytes on disk, not as a frozen program.

The command’s own note said it checks the shape of the file, not your behavior, and that I should run my own tests before shipping. Two strings are not every string. If the function does more than compare one key, run the tests you already trust against the copy. If they fail, do not ship that copy. The original is still sitting next to it, unchanged.

Can Someone Still Get the Key by Running the File?

Yes, if they can call the function. A text search fails. The program still answers.

Reading a file is only one way to learn what it does. The other way is to ask it questions. licenseOk is a yes-or-no machine. A person who can run your page can call it. My key is one long specific string, so guessing at random is a bad plan. A short code, a birthday, a four-digit PIN, would fall over, because each guess is cheap and the function tells you when you hit.

The fake note at the top tries to talk a reader out of looking. It says the license logic is not there. A reader that only skims the first screen might believe that. A reader that calls licenseOk learns the truth in one line. An REA (a program that tries to recover your logic from the shipped file) is in the first group if it only reads text, and in the second group if it is allowed to run what it read.

That split is the useful one. A tool that reads JavaScript and does not start the program, which is the job in reverse engineering a JavaScript app without Ghidra, would not see SECRET-KEY-42 in this copy. The same tool on the original file would. rea versus Ghidra is the same kind of read: names and structure from text, not from running the page. Bla-agents is aimed at that kind of reader. It is not aimed at a person sitting at a keyboard calling the function.

Two ways to study the shipped JavaScript: searching the text misses the key string, calling licenseOk still returns true or false for every guess

If the secret is a key that talks to your own server, do not put it in this file at all. The user’s computer has to run the file, so the user can study it. Keep that key on the machine you control. The same rule you would use for a password in a chat tool applies here: the program that is allowed to use the secret should see it, and the file you ship should not.

bla-agents vs Minifying JavaScript

Minifying keeps the secret and makes the file smaller. Bla-agents removes the secret from the text and makes the file much larger.

A minifier is a program that drops spaces and shortens names so the download is smaller. The logic stays the same, and any string you wrote stays a string. I ran one on the same line. 109 bytes became 97. The words SECRET-KEY-42 were still in the output. They had only moved to the other side of the comparison. That is a success if you wanted a smaller file. It is a failure if you wanted a search to miss the key.

Bla-agents is the other trade. The words were gone. The answers were not. The file was about 1,560 times larger.

CheckOriginalMinifiedBla-agents copy
Bytes10997169,694
Secret string still in the fileYesYesNo
licenseOk still the export nameYesYesYes
Right keytruetruetrue
Wrong stringfalsefalsefalse
Median time, 20 Node runs0.023 sI did not time it0.033 s

I did not time the minified file. It is almost the same program as the original, so I would expect almost the same time. The interesting gap is the one I did measure: a much bigger file, a slightly slower start, and the same two answers.

Use a minifier when the page has to stay small and you do not care that a search finds the words. Use the bla-agents copy when a text search is the thing you want to slow down, and you can afford the bytes. Use neither when the answer itself is the secret.

When Should I Not Use bla-agents?

Do not use it when the secret has to stay secret, or when a much bigger download is the thing you cannot afford.

Skip it in these cases:

  • The value is a key, a signing secret, or anything that grants access. Move it to a server. A rewritten file is still a file the user runs.
  • You need proof on every input. I checked two strings. The tool told me to run my own tests, and it was right to say that.
  • The file sits on the first load of a page that must stay small. One function went from a short line to 166 KB.
  • You might replace the source you edit with the generated copy. Do not. The command writes a mirror folder and told me not to overwrite the original. Edit the small file. Generate the copy again when you ship.
  • You wanted encryption. This is not encryption. The copy runs with no password.
  • A person with time and a debugger is the threat you actually have. This raises the cost of reading. It does not make reading impossible. The function name was still licenseOk.

There is a smaller, ordinary case where I would use it. You ship a check you would rather not have sitting in plain letters, a text-only reader is the nuisance, and 166 KB on that one file is acceptable. Then the copy did the job I measured. If an agent is the thing applying the rewrite, read the diff before you merge it, the same way you would read any other change from a coding agent. A review that only looks at the lines you meant to change is the bar in whether a security review is enough.

How Do I Try bla-agents on One File?

Put one file in an empty folder, preview, harden, then call the function yourself.

You need Node. You do not need a graphics card, an account, or a key. I used an empty folder so the command could not wander into a real project. The package lives at github.com/qybaihe/bla, and the project site is bla.tools.

mkdir scratch && cd scratch
# put your one file here, then:
npx -y bla-agents@3.8.0 harden . --dry-run
npx -y bla-agents@3.8.0 harden .

The first command should list the file and write nothing. The second writes .bla-hardened/ next to your original. Then do the two checks that mattered in my run. Search both files for a string only you know. Call the function with the right input and a wrong one. If the search still hits, the rewrite did not hide that string. If the answers disagree, do not ship the copy.

grep -R "SECRET-KEY-42" . || true
node -e 'const {licenseOk}=require("./.bla-hardened/license.js"); console.log(licenseOk("SECRET-KEY-42"), licenseOk("nope"))'

On a real app, build first, then point the command at the built output rather than at the files you edit. The mirror is not a full copy of the project. Untouched files are not carried along, so do not try to run the mirror folder as if it were the whole app. Stage a build, overlay the mirror, and run the tests you already have.

I would not start with the strongest setting on a large bundle just to see the file get huge. One file, two calls, and a search is enough to learn what you are buying.

Common questions about bla-agents

Does bla-agents encrypt my javascript?

No. The copy runs with no password. Encryption that the browser could not undo would also stop the page from running. What you get is a rewrite: the string is gone, the answers remain, and a block of misleading notes sits at the top.

Will bla-agents overwrite my source?

Not in the run I did. The original stayed 109 bytes, with the key still in it. The new file was only under .bla-hardened/. The command also said not to replace source with that output. Keep editing the small file.

Is a secret in the browser safe if I run bla-agents?

No. The computer that runs the file can call the function. A search will miss the letters. A guess that calls licenseOk still gets true or false. If the secret grants access, keep it on your server.

Does minifying javascript hide the key?

No. My minified line was 97 bytes and still contained SECRET-KEY-42. Minifying is for size. It is not a hiding step.

If a search of the shipped file is the thing you want to slow down, and you can live with a much larger file, the copy did that for one function and still answered correctly on the two calls I made. If the answer is the secret, the file on the user’s machine will keep telling it. Move the check.

Leave a comment