[RFC] Integrate Trusted Types API #614
Replies: 4 comments
-
Point in favor of this one: As of today, Gmail web now enforces Trusted Types. We have a Chrome extension based on Vue, which now cannot load without Trusted Types support, forcing us either to live without or change for another framework which supports TT. |
Beta Was this translation helpful? Give feedback.
-
I'm in favor of this RFC. |
Beta Was this translation helpful? Give feedback.
-
I'm not convinced v-html should do anything special with string values, they should be passed to the sink as is and the trusted type API's default policy behaviour will be invoked if the end user wants to sanitise or reject the values. That aside I think it's a great idea to integrate the trusted types APIs into the Vue framework. |
Beta Was this translation helpful? Give feedback.
-
Related PR: vuejs/core#10844 |
Beta Was this translation helpful? Give feedback.
-
Start Date: 2023-12-14
Target Major Version: 3.x
Summary
This RFC proposes integrating the Trusted Types API into Vue 3 to enhance security against Cross-Site Scripting (XSS) vulnerabilities. The goal is to automate secure DOM handling, enabling developers to utilize Vue features without managing Trusted Types explicitly.
Motivation
Frameworks like Lit (Lit's release notes) and Angular (Angular's security guide) have adopted Trusted Types, showing significant steps in web security. Vue 3 should follow this path to enhance security and align with current front-end development practices. However, the PR was previously created in Vue 2 to integrate Trusted Types, but it appears to have been recently closed. ref: vuejs/vue#10491
Basic Example
Within Vue 3, the
v-html
directive is commonly used for binding HTML content. After the integration of Trusted Types, this directive will internally utilize the Trusted Types API for content sanitization. The usage for developers remains unchanged, ensuring ease of use with improved security. For instance:Here,
userContent
will automatically be processed through Vue-managed Trusted Types policies, ensuring the content is safe and free from XSS threats.Detailed Design
Considerations Regarding Browser Support and Experimental Status
Beta Was this translation helpful? Give feedback.
All reactions