about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-09-27 15:58:51 +0000
committerPjotr <wrk@bosa.lan>2026-09-27 15:58:51 +0000
commit75761501eb6e8574e8375bf040294acd4e8fb9cb (patch)
treed02dbc8168123406f04a9cb028faafea1158b06a
parentacae84a07fba819b6d5f3943e098533508a796d8 (diff)
downloadgn-bnw-75761501eb6e8574e8375bf040294acd4e8fb9cb.tar.gz
test: t18 now asserts the server-side GN2 conversion (no JS echo)
With the XSS fix the My_Gennenet POST returns the prepared-data page
in one request; t18 asserts that and that the genenetwork_data JS
echo is gone.  25/25.
-rw-r--r--test/bnw_http_tests.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/bnw_http_tests.py b/test/bnw_http_tests.py
index 311e7a9d..23fb3bda 100644
--- a/test/bnw_http_tests.py
+++ b/test/bnw_http_tests.py
@@ -279,14 +279,16 @@ GN2_DATA = ("Geno1,Geno2,Trait1,Trait2;"
 
 
 def t18_gn2_entry_point():
-    """GN2 posts My_Gennenet; the page must embed the JS handshake
-    (genenetwork_data() with the payload and the auto-submit stub)"""
-    r = request("/bn_genenet.php", post={"My_Genenet": GN2_DATA,
+    """GN2 posts My_Gennenet; the server converts it (commas -> tabs,
+    semicolons -> newlines) and serves the prepared-data page in ONE
+    request.  The old release echoed the raw payload into a JS string
+    (XSS on public deployments) -- that must be gone."""
+    r = request("/bn_genenet.php", post={"My_Gennenet": GN2_DATA,
                                          "My_key": GN2_KEY})
     return (r.status == 200
-            and "function genenetwork_data()" in r.body
-            and GN2_DATA in r.body
-            and 'getElementById("genenet")' in r.body)
+            and r.has("Perform Bayesian network modeling")
+            and r.has("var data1 = [")
+            and "genenetwork_data" not in r.body)
 
 
 def t19_gn2_data_loaded():
@@ -338,7 +340,7 @@ TESTS = [
         ("t15 example workflow (examplecar15node)", partial(t15_example_workflow, "examplecar15node", "eIA")),
     ("t16 network svg downloadable",              t16_svg_download),
     ("t17 script assets download with content",   t17_script_assets),
-    ("t18 GN2 entry point (My_Genenet)",          t18_gn2_entry_point),
+    ("t18 GN2 single-POST handshake (no XSS)",    t18_gn2_entry_point),
     ("t19 GN2 data load + preparation",           t19_gn2_data_loaded),
     ("t20 GN2 structure learning + rendering",    t20_gn2_structure_learning),
 ]