Skip to content
Open
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
4 changes: 3 additions & 1 deletion src/core/override-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const name = "core/override-configuration";
*/
export function run(config) {
const params = new URLSearchParams(document.location.search);
const dangerousKeys = new Set(["__proto__", "prototype", "constructor"]);
const overrideEntries = Array.from(params)
.filter(([key, value]) => !!key && !!value)
.map(([codedKey, codedValue]) => {
Expand All @@ -26,7 +27,8 @@ export function run(config) {
value = decodedValue;
}
return [key, value];
});
})
.filter(([key]) => !dangerousKeys.has(key));
const overrideProps = Object.fromEntries(overrideEntries);
Object.assign(config, overrideProps);
pub("amend-user-config", overrideProps);
Expand Down