-
Notifications
You must be signed in to change notification settings - Fork 74
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
Explore granular enforcement of types #33
Comments
Additional approaches that have been proposed:
Unless I'm missing something, the latter approach can be used to emulate the two former. |
How about a sort of object-capability approach:
A reference to the factory represents the capability to create instances of the trusted types. @koto @mikewest does this seem feasible? With this in place, a builder library (e.g. a An application's startup code calls trustedtypes.getFactory(), and instantiates the needed (and security-reviewed) builder libraries with the resulting factory, and then throws away the reference. This approach is quite flexible: Aside from instantiating "closed", by-design-secure builder libraries, application startup code can also:
Desirable attributes of this approach:
|
There's one significant downside to the object-capability approach here, which is that it assumes that all the dependencies are known at build-time, such that the reference to the canonical TT builder can be passed around. Without statically available builders no widgets (e.g. What about if the
to achieve the same means, but, by default, any 3rd party widget and library could obtain the reference to the builders in their established configuration. |
Implemented (to some extent) with the policy approach of the new API. It's still document-specific, and not script-specific, but I can't find an easy way of making it more granular natively. |
So far, TT are enforced per document - this is controlled by CSP. This issue is to explore whether more granular control is possible. This might serve two goals:
unsafelyCreate
in certain code location (e.g. the ones defining the safe wrappers overunsafelyCreate
) .So far, a couple of mechanisms of doing so have been proposed:
require-trusted-types 'nonce-xyz123'
could enable the enforcement for scripts with that nonce.require-trusted-types *
would enable globally. This seems awkward, as the wider the whitelist, the more secure the system is, which is opposite to how other CSP directives work.require-trusted-types; unsafe-disable-trusted-types: http://twitter.com/script.js
seems more fitting."use trusted-types"
- just like Strict mode. This one is probably quite invasive in the language, but it could enable very precise script level (or even function level) enforcements.The text was updated successfully, but these errors were encountered: