Skip to content

Commit 2af09b6

Browse files
author
Chad Norvell
committed
rustdoc: Prevent JS injection from localStorage
1 parent 021861a commit 2af09b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustdoc/html/static/js/storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function getSettingValue(settingName) {
2424
return def;
2525
}
2626
}
27-
return current;
27+
return current.replace(/[^A-Za-z0-9_-]/g,"");
2828
}
2929

3030
const localStoredTheme = getSettingValue("theme");

0 commit comments

Comments
 (0)