Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
02f062b5
Commit
02f062b5
authored
Nov 05, 2023
by
comfyanonymous
Browse files
Sanitize unknown node types on load to prevent XSS.
parent
1ffa8858
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
web/scripts/app.js
web/scripts/app.js
+17
-0
No files found.
web/scripts/app.js
View file @
02f062b5
...
@@ -5,6 +5,22 @@ import { api } from "./api.js";
...
@@ -5,6 +5,22 @@ import { api } from "./api.js";
import
{
defaultGraph
}
from
"
./defaultGraph.js
"
;
import
{
defaultGraph
}
from
"
./defaultGraph.js
"
;
import
{
getPngMetadata
,
getWebpMetadata
,
importA1111
,
getLatentMetadata
}
from
"
./pnginfo.js
"
;
import
{
getPngMetadata
,
getWebpMetadata
,
importA1111
,
getLatentMetadata
}
from
"
./pnginfo.js
"
;
function
sanitizeNodeName
(
string
)
{
let
entityMap
=
{
'
&
'
:
''
,
'
<
'
:
''
,
'
>
'
:
''
,
'
"
'
:
''
,
"
'
"
:
''
,
'
`
'
:
''
,
'
=
'
:
''
};
return
String
(
string
).
replace
(
/
[
&<>"'`=
\/]
/g
,
function
fromEntityMap
(
s
)
{
return
entityMap
[
s
];
});
}
/**
/**
* @typedef {import("types/comfy").ComfyExtension} ComfyExtension
* @typedef {import("types/comfy").ComfyExtension} ComfyExtension
*/
*/
...
@@ -1480,6 +1496,7 @@ export class ComfyApp {
...
@@ -1480,6 +1496,7 @@ export class ComfyApp {
// Find missing node types
// Find missing node types
if
(
!
(
n
.
type
in
LiteGraph
.
registered_node_types
))
{
if
(
!
(
n
.
type
in
LiteGraph
.
registered_node_types
))
{
n
.
type
=
sanitizeNodeName
(
n
.
type
);
missingNodeTypes
.
push
(
n
.
type
);
missingNodeTypes
.
push
(
n
.
type
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment