Skip to content

fix: load benchmark data with json parse instead of eval#3

Open
mooncitydev wants to merge 1 commit intoAztecProtocol:gh-pagesfrom
mooncitydev:parse-benchmark-json-no-eval
Open

fix: load benchmark data with json parse instead of eval#3
mooncitydev wants to merge 1 commit intoAztecProtocol:gh-pagesfrom
mooncitydev:parse-benchmark-json-no-eval

Conversation

@mooncitydev
Copy link
Copy Markdown

@mooncitydev mooncitydev commented Apr 28, 2026

hey team, bumped into the benchmark viewer while poking at the repo and tightened up how data.js gets loaded.

Previously the page used eval() on the fetched script and on the big inline main-script block. The remote data.js is really just window.BENCHMARK_DATA assignment with JSON from github-action-benchmark, so eval was running whatever bytes came back from the raw URL. That is brittle for supply chain tampering and harder to reason about than parsing.

Now it walks the assignment, tracks JSON string state, and JSON.parse the object. The deferred app code runs by injecting a real script node instead of eval.

Also the error path stuffed the branch name from the query string into innerHTML, which was a DOM XSS footgun if someone opened a crafted link. Replaced that with textContent and created elements.

Not sure how you want to roll this out to the per-branch copies of index under bench subfolders, this PR only touches bench/index.html at the root viewer.

cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant