Both bookmarklets bounced. The extension got in.

The last time a page’s security policy stopped our assistant, it learned to read the page and still could not touch it: “Clicking and typing go through eval.” This time the page was stricter, both of our launchers bounced off it, and the fix was a third way in. With it, the assistant stopped asking me to click things.

Our own page said no

The page was robot.voitta.ai, our programmable tank arena. Its policy is about as strict as they come: default-src 'self'; script-src 'self'; connect-src 'self'. On 2026-11-23 I clicked the Voitta bookmarklet on it, and a securitypolicyviolation listener recorded the refusals:

  • The normal bookmarklet adds a script tag for the widget: blocked by script-src-elem. Every click added another dead tag.
  • The bridge bookmarklet, built for pages that block the backend, gets through with a popup but boots with eval: blocked by script-src.
  • The widget’s own calls to the backend: blocked by connect-src.

It is our site, and we did not loosen it. We measured what loosening would take, on a local page serving the same header. The backend origin would have to go into four directives, plus 'unsafe-eval' for scripting. One detail from that test belongs in the error-message post: an https:// entry in connect-src does not cover the WebSocket. socket.io quietly falls back to long polling, and the widget looks connected. Only the violation event says otherwise.

Three layers

The fix is a Chrome extension. An extension isn’t governed by the page’s policy, but it has rules of its own, and each layer exists because of one of them.

  • Injection. chrome.scripting puts the widget into the page directly. Manifest V3 forbids remotely hosted code, so the widget is bundled into the extension instead of fetched from the backend.
  • Network. A shim in the page replaces fetch, XMLHttpRequest and WebSocket for backend URLs. Each request travels over a private channel to the extension’s service worker, which makes the real call. The worker tags every request with the tab’s origin as the browser reports it, not as the page claims it, so per-site approval still holds. The backend trusts one pinned extension ID and refuses any other.
  • Execution. Scripting runs through chrome.userScripts in a separate world with the extension’s own policy. It needs the user to turn on “Allow User Scripts”; without that, the tool says user_scripts_disabled instead of failing mysteriously.

What real use found

None of these came from the design. They came from building it and using it.

  • The bundle was not UTF-8. chrome.scripting refused the widget because it contains a U+FFFF literal. The build now re-emits it with esbuild --charset=ascii, which costs 31%: 3.9 MB becomes 5.2 MB.
  • The grey dot. On the first try the extension pointed at the released backend, which predates it. The widget appeared, its status dot stayed grey, and messages got no reply. The backend had answered 403 bad origin and closed the socket. The widget said none of that, which breaks the rule from last time; making it say so is on the list.
  • Two “Settings”. The backend address lives in the extension’s options. Asked to change it, I opened the widget’s own Settings, which has no such field.
  • The same 400, by another road. Uploads use XMLHttpRequest, which the first shim did not carry, so an attachment failed. The chat then sent a message with no text and no file, and the provider answered text blocks cannot have empty text, the error we fixed in that same post for a different path. Now an empty turn gets a notice and never reaches the provider.
  • A frame with no origin. The report pane frames a backend page, which frame-src blocks. The extension now frames its own page, which then frames the report. But Chrome sends neither Origin nor Referer for that load, so the backend could not tell which site was asking. The fix is a ticket: signed, naming the site and the path, valid for ten minutes.

Then it clicked

In the first session on the page, the assistant read what was rendered, found that the game’s rules open in a drawer on a click, and asked me to click Rules for it. After the user-scripts layer landed, it opened the drawer itself. In the next thread it made 24 scripting calls in its first three turns, every one of them successful, until a turn stopped at the tool loop’s limit of 25 iterations. By the end of that thread it had made 34 and rewritten its tank, which is its own post.

What it costs

The extension is a sharper tool than either bookmarklet, so the trade-offs are worth stating plainly.

  • User scripts see the page’s DOM, not its JavaScript globals.
  • The widget is bundled, so it can lag the backend it talks to.
  • Any script on the page can use the tunnel. That gives it nothing beyond what the site’s approval already allows. The execution path is different: it hands the page eval in the user-script world, on a page whose policy exists to deny it.
  • The report frame page is web-accessible, so any site can detect that the extension is installed.

It shipped in release 0.3.0. For now you load it unpacked from a checkout, as the README describes. Still open: a service-worker restart test, and one shim shared with the bridge bookmarklet, which still cannot upload.

If your agents have to work on pages that were built to keep scripts out, talk to us.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.