diff --git a/frontend/src/ts/test/test-input.ts b/frontend/src/ts/test/test-input.ts index 27910a80cdcc..b62359165529 100644 --- a/frontend/src/ts/test/test-input.ts +++ b/frontend/src/ts/test/test-input.ts @@ -212,7 +212,11 @@ export const corrected = new Corrected(); export let keypressCountHistory: number[] = []; let currentKeypressCount = 0; export let currentBurstStart = 0; -export let missedWords: Record = {}; +type MissedWordsType = Record; +// We're using Object.create(null) to make sure that __proto__ won't have any special meaning when it's used to index the missedWords object (so if a user mistypes the word __proto__ it will appear in the practise words test) +export let missedWords: MissedWordsType = Object.create( + null, +) as MissedWordsType; export let accuracy = { correct: 0, incorrect: 0, @@ -542,7 +546,7 @@ export function restart(): void { words: [], }; currentBurstStart = 0; - missedWords = {}; + missedWords = Object.create(null) as MissedWordsType; accuracy = { correct: 0, incorrect: 0,