on-internet
← Community

Can setting/retrieving properties on any HTML element be a security risk?

Stack Overflow ·

When assigning properties to a HTMLElement directly (so [Element].someProperty), it looks like anything goes. You would expect that invalid properties either throw some error or are weeded out silently on assigning them. This seems to be not the case. In the snippet is a minimal example, where after appending an element with a property that is function, that property can be referenced (and even invoked). Retrieving the value of it using getAttribute null is returned. Retrieving it directly however returns the property value (a function). I can't get my head around that. Will this constitute a

Comments

Sign in or sign up to comment and upvote.

No comments yet.