Skip to content

Commit 8e19424

Browse files
committed
refactor(security): mark potential unsafe code paths
1 parent 8b7c162 commit 8e19424

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

packages/runtime-dom/src/modules/props.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// __UNSAFE__
2+
// Reason: potentially setting innerHTML.
3+
// This can come from explicit usage of v-html or innerHTML as a prop in render
4+
// functions. The user is reponsible for using them with only trusted content.
15
export function patchDOMProp(
26
el: any,
37
key: string,

packages/runtime-dom/src/nodeOps.ts

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export const nodeOps: Omit<RendererOptions<Node, Element>, 'patchProp'> = {
5151
return el.cloneNode(true)
5252
},
5353

54+
// __UNSAFE__
55+
// Reason: innerHTML.
56+
// Static content here can only come from compiled templates.
57+
// As long as the user only uses trusted templates, this is safe.
5458
insertStaticContent(content, parent, anchor, isSVG) {
5559
const temp = isSVG
5660
? tempSVGContainer ||

packages/vue/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ function compileToFunction(
3131
if (__DEV__ && !el) {
3232
warn(`Template element not found or is empty: ${template}`)
3333
}
34+
// __UNSAFE__
35+
// Reason: potential execution of JS expressions in in-DOM template.
36+
// The user must make sure the in-DOM template is trusted. If it's rendered
37+
// by the server, the template should not contain any user data.
3438
template = el ? el.innerHTML : ``
3539
}
3640

0 commit comments

Comments
 (0)