Skip to content

Commit 1f56852

Browse files
author
Chad Norvell
committed
rustdoc: Exclude code characters from localStorage value
1 parent 6fe87b5 commit 1f56852

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
@@ -28,7 +28,7 @@ function getSettingValue(settingName) {
2828
// This prevents an injection vulnerability where someone could plant
2929
// JS code into the localStorage value, which could be executed when
3030
// we pull it out.
31-
return current.replace(/[^A-Za-z0-9_-]/g,"");
31+
return current.replace(/[\s\(\)\[\]\{\}\*\"\'\`<>.:;=&|]/g,"");
3232
}
3333

3434
const localStoredTheme = getSettingValue("theme");

0 commit comments

Comments
 (0)