-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider: isSecureContext should be [Unforgeable] #46
Comments
I don't think it was legacy because we added the concept for security right before we shipped IE 9. Maybe it was legacy in that before, with COM based window, you couldn't override the document, but the goal with document was to ensure that you could access certain things like URL to ensure that someone wasn't running you in a context in which you did not want to run. isSecureContext might be a check some libraries want to add into their code, same as origin restrictions? |
Chrome uses Since it exists, is supported in multiple browsers, and seems relevant and painless, I'm inclined to add the attribute. Are there architectural questions around its usage? |
I wish I'd know more about the attack scenario. Generally if you cannot trust properties on an object, you've already lost, even if that one property ends up returning the correct result. |
The scenario mentioned above is a library/widget which might be embedded into various contexts, and offer different functionality based on those conexts' status. I generally agree that the cases in which the unforgeability prevents confusion are a bit contrived, but I also don't see harm in applying this existing infrastructure to the attribute. |
I'd like us to get our story straight on [Unforgeable] though. Do we sprinkle it everywhere where it might not cause harm and seems security-related? Or is it a legacy feature from the early days of the web platform when we didn't understand threat models, and it should be renamed [LegacyUnforgeable] and never used again? |
whatwg/webidl#350 is the IDL issue. Closing this. |
The Unforgeable attribute is a way to mark a property as living on the instance of an object and being non configurable. For Window, due to Window as Global semantics, all properties live directly on the Global context already and so this will simply mark it as non configurable. The document property is one such example.
Chrome incorrectly marks document as a value (should have a getter instead) but the configurable/writable flags are correct.
The text was updated successfully, but these errors were encountered: