Skip to content

Commit 1fe8549

Browse files
authored
Merge pull request #133 from lkrapf/fix/xss-protocol-relative-url
fix: prevent protocol-relative URLs in fragment loader (#132)
2 parents dd126d7 + c497819 commit 1fe8549

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

blocks/fragment/fragment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
* @returns {Promise<HTMLElement>} The root element of the fragment
1919
*/
2020
export async function loadFragment(path) {
21-
if (path && path.startsWith('/')) {
21+
if (path && path.startsWith('/') && !path.startsWith('//')) {
2222
const resp = await fetch(`${path}.plain.html`);
2323
if (resp.ok) {
2424
const main = document.createElement('main');

0 commit comments

Comments
 (0)