Просмотр исходного кода

test: cover every escaped site on the form page, not just three of seven

fszontagh 1 месяц назад
Родитель
Сommit
19803ad1b4
1 измененных файлов с 24 добавлено и 4 удалено
  1. 24 4
      tests/nodes/form-render-escaping.json

+ 24 - 4
tests/nodes/form-render-escaping.json

@@ -4,18 +4,38 @@
     {"id": "n1", "name": "Form", "type": "form-trigger", "position": {"x": 0, "y": 0},
     {"id": "n1", "name": "Form", "type": "form-trigger", "position": {"x": 0, "y": 0},
      "config": {"title": "<script>alert(1)</script>",
      "config": {"title": "<script>alert(1)</script>",
                 "description": "a \"quoted\" & <b>bold</b> description",
                 "description": "a \"quoted\" & <b>bold</b> description",
-                "fields": [{"name": "q", "label": "<img src=x onerror=alert(2)>", "type": "text"}]}}
+                "path": "/x\"><script>x4</script>",
+                "fields": [
+                  {"name": "q", "label": "<img src=x onerror=alert(2)>", "type": "text"},
+                  {"name": "ph", "label": "Placeholder field", "type": "text",
+                   "placeholder": "\"><script>x1</script>"},
+                  {"name": "sel", "label": "Select field", "type": "select",
+                   "options": ["\"><script>x2</script>"]},
+                  {"name": "file1", "label": "File field", "type": "file",
+                   "accept": "\"><script>x3</script>"}
+                ]}}
   ],
   ],
   "connections": [],
   "connections": [],
   "http": {
   "http": {
     "method": "GET",
     "method": "GET",
-    "path": "/webhook/{workflowId}",
+    "path": "/webhook/{workflowId}/x%22%3E%3Cscript%3Ex4%3C/script%3E",
     "expectStatus": 200,
     "expectStatus": 200,
     "expectBodyContains": [
     "expectBodyContains": [
       "&lt;script&gt;alert(1)&lt;/script&gt;",
       "&lt;script&gt;alert(1)&lt;/script&gt;",
       "&lt;img src=x onerror=alert(2)&gt;",
       "&lt;img src=x onerror=alert(2)&gt;",
-      "&amp;"
+      "&amp;",
+      "&quot;&gt;&lt;script&gt;x1&lt;/script&gt;",
+      "&quot;&gt;&lt;script&gt;x2&lt;/script&gt;",
+      "&quot;&gt;&lt;script&gt;x3&lt;/script&gt;",
+      "/x&quot;&gt;&lt;script&gt;x4&lt;/script&gt;"
     ],
     ],
-    "expectBodyExcludes": ["<script>alert(1)</script>", "<img src=x onerror"]
+    "expectBodyExcludes": [
+      "<script>alert(1)</script>",
+      "<img src=x onerror",
+      "\"><script>x1</script>",
+      "\"><script>x2</script>",
+      "\"><script>x3</script>",
+      "\"><script>x4</script>"
+    ]
   }
   }
 }
 }