ajv-validator / ajv-validator/ajv-keywords

Keyword suggestion: prevent shadowing properties in Object.prototype

Aperta
#4 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
feature
Lingua principale
TypeScript
Stelle
257
Fork
51
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi, a variant of "propertyNames" keyword could strip property names in Object.prototype. It could be a fast version with a `key in Object.prototype` check, and I'd like to use it whenever I allow additionalProperties. The reason I'm suggesting this is that currently quite often people just use `JSON.parse` and don't consider that if they get a malicious object such as `{"toString":null}` it will quite easily break downstream as some logging, string concatenation or similar will call `toString` on it. Similar with other properties in `Object.prototype`, and it would be nice to avoid the function call in "propertyNames" with this keyword variant.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.