mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 18:02:27 +00:00
[security] replace innerHTML in RevertModal.js
Migrated `js/ui/components/RevertModal.js` to safe DOM APIs (`createElement`, `textContent`, `DOMParser`). Extracted rendering logic to `js/ui/components/revertModalRenderers.js`. Updated baseline in `scripts/check-innerhtml.mjs` (0 remaining usages). Updated tests to mock DOMParser. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
83587ea3ea
commit
f676fb2ff5
9 files changed
+1001
-621
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
# Agent Completion Log
|
||||
|
||||
**Agent:** `innerhtml-migration-agent`
|
||||
**Date:** 2026-02-14
|
||||
**Cadence:** Daily
|
||||
|
||||
## Task Summary
|
||||
Migrated `js/ui/components/RevertModal.js` from `innerHTML` to safe DOM APIs. This file had the highest usage (10 assignments).
|
||||
|
||||
## Actions Taken
|
||||
1. **Refactoring:**
|
||||
* Replaced all `innerHTML` assignments with `document.createElement`, `textContent`, and `replaceChildren`.
|
||||
* Switched `load()` and `reset()` logic to use `DOMParser` for safe parsing of trusted templates.
|
||||
* Extracted complex rendering logic (NIP-71 media metadata, variants, tracks) to a new module `js/ui/components/revertModalRenderers.js` to manage file size complexity.
|
||||
|
||||
2. **Verification:**
|
||||
* Updated `tests/modal-accessibility.test.mjs` to mock `DOMParser` in the test environment.
|
||||
* Ran `npm run lint` and `npm run test:unit` successfully.
|
||||
* Verified `innerHTML` usage for the file dropped to 0.
|
||||
|
||||
3. **Baseline Update:**
|
||||
* Updated `scripts/check-innerhtml.mjs` to remove `RevertModal.js` from the tracking list.
|
||||
|
||||
## Artifacts
|
||||
* `js/ui/components/RevertModal.js`
|
||||
* `js/ui/components/revertModalRenderers.js`
|
||||
* `scripts/check-innerhtml.mjs`
|
||||
* `tests/modal-accessibility.test.mjs`
|
||||
* `decisions/DECISIONS_2026-02-14_17-35-00.md`
|
||||
* `test_logs/TEST_LOG_2026-02-14_17-35-00.md`
|
||||
Reference in new issue
Block a user