You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's common to use obj.hasOwnProperty(key) to determine if the object obj has a property called key. This fails badly if obj can have a key called hasOwnProperty that's unrelated to the method. This might be possible of obj is an object whose keys represent HTTP headers sent by an untrusted user. Such a user can break a program using obj.hasOwnProperty(key) by passing a header called hasOwnProperty. To avoid this, programs can use Object.hasOwnProperty.call(obj, key). This is a little obscure (and verbose), so it would be nice to have a jsprim method to implement this.
The text was updated successfully, but these errors were encountered:
It's common to use
obj.hasOwnProperty(key)
to determine if the objectobj
has a property calledkey
. This fails badly ifobj
can have a key calledhasOwnProperty
that's unrelated to the method. This might be possible ofobj
is an object whose keys represent HTTP headers sent by an untrusted user. Such a user can break a program usingobj.hasOwnProperty(key)
by passing a header calledhasOwnProperty
. To avoid this, programs can useObject.hasOwnProperty.call(obj, key)
. This is a little obscure (and verbose), so it would be nice to have a jsprim method to implement this.The text was updated successfully, but these errors were encountered: