fix: append parsed nodes when loading initial HTML into the Lexical editor

EditorShell's ingest called $generateNodesFromDOM but discarded the
returned nodes, so stored content never appeared in the WYSIWYG editor
in edit mode (the E2E edit test only checked title/points and missed it).
The parsed nodes are now appended to the root (kept empty-paragraph
default when nothing parses).

Hardening tests added while auditing the M6 test checklist:
- E2E: edit view asserts the stored body renders in the editor; new
  hostile-HTML test loads <script> tags, onerror/onload handlers and
  javascript: links through the real editor and asserts none survive
  into the contenteditable and nothing executes.
- E2E/unit: create button is disabled while the request is in flight.
- Backend: SQL metacharacters in the search term behave as literal
  text and leave the table intact.

Milestone doc updated: QA checklist items now cite their tests, plus a
QA-findings note for the ingest bug.
This commit is contained in:
Daniel Samson committed 2026-10-30 21:58:23 +00:00
1 parent b440809548
commit e62fad4a10
5 files changed
+104 -3

No files matched your search

+17
View File
@@ -176,6 +176,23 @@ class TestListItems:
assert none["items"] == []
assert none["total"] == 0
def test_search_with_sql_metacharacters_is_treated_as_text(self, client, session) -> None:
"""Search input is a parameterized substring filter, never raw SQL."""
_make_user(session, "root", is_admin=True)
_seed_items(session, 5)
headers = _headers(session, "root")
attack = "1=1' OR '1'='1"
resp = client.get(BASE, params={"search": attack}, headers=headers)
assert resp.status_code == 200
body = resp.json()
assert body["items"] == []
assert body["total"] == 0
# The table is intact after the "attack".
intact = client.get(BASE, headers=headers).json()
assert intact["total"] == 5
@pytest.mark.parametrize("order, expected_first", [("asc", "Story 00"), ("desc", "Story 04")])
def test_sort_by_title(self, client, session, order, expected_first) -> None:
_make_user(session, "root", is_admin=True)