Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Build: Fix an XSS in the test server HTML serving logic #2309

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/runner/createTestServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
} );

// Add a script tag to HTML pages to load the QUnit listeners
app.use( /\/tests\/unit\/([^/]+)\/\1\.html$/, async( req, res ) => {
app.use( /\/tests\/unit\/([a-zA-Z0-9_-]+)\/\1\.html$/, async( req, res ) => {
const html = await readFile(
`tests/unit/${ req.params[ 0 ] }/${ req.params[ 0 ] }.html`,
"utf8"
);
res.send(
html.replace(
"</head>",
"<script src=\"/tests/runner/listeners.js\"></script></head>"
)
);
} );

Check failure

Code scanning / CodeQL

Missing rate limiting High test

This route handler performs
a file system access
, but is not rate-limited.

// Bind the reporter
app.post(
Expand Down
Loading