fix: remove dead supply-chain JS for missing /load-malicious-model route - #19
Open
RGBuilds wants to merge 1 commit into
Open
fix: remove dead supply-chain JS for missing /load-malicious-model route#19RGBuilds wants to merge 1 commit into
RGBuilds wants to merge 1 commit into
Conversation
The XSS section handler referenced #trigger-model and fetch('/load-malicious-model'),
but no trigger button exists in the template and the route was never implemented.
The live XSS demo already uses /demo-malicious-model; this orphaned code was non-functional.
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
application/templates/supply_chain.htmlthat referenced#trigger-modelandfetch('/load-malicious-model').#trigger-modelbutton exists in the template, and no/load-malicious-modelroute is implemented on the server (returns 404 if called manually).GET /demo-malicious-model, which instantiates the malicious model and injects JavaScript into the HTML response.POST /load-bash-malicious-model.This is a cleanup fix, not a new feature: it removes dead code that could confuse developers or workshop participants testing endpoints in DevTools.
What changed
application/templates/supply_chain.html#trigger-modelclick handler)What did not change
/demo-malicious-model(XSS demo) — unchanged/load-bash-malicious-model(OS command demo) — unchangedProblem observed (before)
On upstream
main, the orphaned endpoint fails if called manually:Browser DevTools (Console on
/supply-chain):The bash demo endpoint works independently (separate code path):
Why this was confusing: Network tab could show
load-bash-malicious-model(200) alongside a manualload-malicious-model(404). These are two different demos, not a broken call chain.Test plan
Setup (test your branch in Docker)
App URL (with local port override): http://localhost:8081
Manual — supply chain page
/demo-malicious-modelopens (200, demo page renders)POST /save-js-malicious-modelsucceedsPOST /load-bash-malicious-modelreturns 200 with command outputPOST /save-bash-malicious-modelsucceeds#trigger-modelreferences remain insupply_chain.html(source or DevTools → Sources)Manual — optional regression checks
fetch('/load-malicious-model').then(r => console.log(r.status))→ still 404 (route intentionally not implemented; dead JS removed so normal users never hit this)fetch('/load-malicious-model')block is gone from the template scriptAPI (curl)
Automated