Skip to content

Commit 6fe87b5

Browse files
author
Chad Norvell
committed
rustdoc: Comment on JS injection fix
1 parent 2af09b6 commit 6fe87b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function getSettingValue(settingName) {
2424
return def;
2525
}
2626
}
27+
// Strip out characters we don't expect to find in settings values.
28+
// This prevents an injection vulnerability where someone could plant
29+
// JS code into the localStorage value, which could be executed when
30+
// we pull it out.
2731
return current.replace(/[^A-Za-z0-9_-]/g,"");
2832
}
2933

0 commit comments

Comments
 (0)