chore(memory): capitalize session decisions and learnings

BDR-020 (pathology editor standalone), BDR-021 (zoneMatch inline port),
LRN-025 (importNode XSS), LRN-026 (inline port pattern). Journal
updated for 2026-05-22 sessions.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude committed 2026-05-22 06:17:32 +02:00
1 parent f2c9c9bdb7
commit dee98e3eac
3 files changed
+36

No files matched your search

+16
View File
@@ -192,3 +192,19 @@ Fix paths:
- Never `corepack prepare pnpm@latest` — re-resolves at every cold build, silently bumps toolchain across deploys with no commit.
**Why:** Floating tag = drift bomb between cached dev + fresh prod resolve. Same risk for unpinned `node:lts`, `:alpine`, GitHub Actions `uses: foo@v1` (prefer SHA). Lockfile pins app deps; Dockerfile must pin toolchain.
**How to apply:** Before first prod deploy, audit every Dockerfile, docker-compose, and CI workflow for floating upstream refs. For pnpm specifically, check Node version against pnpm minimum (pnpm 11 ↔ Node 22.13, pnpm 10 ↔ Node 18+, pnpm 9 ↔ Node 18+).
---
## LRN-025 | 2026-05-22 | SVG importNode executes inline scripts — sanitize before append
`DOMParser.parseFromString(text, 'image/svg+xml')` is safe — doesn't execute scripts during parse. But `document.importNode(svg, true)` into a live document DOES allow `<script>`, `on*` event handlers, and `<foreignObject>` to execute. Must strip these after importNode, before appending to DOM.
**Why:** discovered during pathology editor code review — file upload path accepts arbitrary SVG.
**How to apply:** any tool accepting user-uploaded SVG: strip `script`, `foreignObject`, and all `on*` attributes after importNode. Or use DOMPurify. Applies to both standalone HTML tools and React-wrapped vanilla editors.
---
## LRN-026 | 2026-05-22 | Standalone HTML tools: port logic inline, don't share modules
When standalone .html tools (no build step) need logic from TS modules (zoneMatch, ID generation), port algorithm inline as vanilla JS. Cannot import .ts files. Keep algorithms identical to source for consistency. Document which .ts file was ported so future changes can sync.
**Why:** pathology-editor.html ports normalizeLabel/levenshtein/scorePair/matchZone from src/lib/zoneMatch.ts.
**How to apply:** if zoneMatch.ts changes, pathology-editor.html matching must be updated manually. Consider a test that compares outputs of both implementations on a shared fixture set.