Adopt shared escapeHtml utility across codebase
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- eslint, javascript
- Domain
- documentation, frontend, security
Research direction
Start with js/utils.js and grep the listed patterns for local escape helpers, dynamic innerHTML, setAttribute, template attributes, DOMParser, and outerHTML uses. Review each match for appropriate shared escaping, then update CONTRIBUTING.md or DEVNOTES.md and add JSDoc in js/utils.js. Done means no local helpers remain outside _site/ and audited dynamic insertions use escapeHtml where appropriate.
Written by the indexing model from the issue text.
Description
Summary
We centralized HTML escaping with a shared helper: escapeHtml in js/utils.js.
This follow-up issue tracks (a) sweeping the codebase to migrate local escape methods and risky templating to use the shared utility, and (b) announcing its availability to contributors after the PR merges.
Why
- Consistent, safe escaping reduces XSS risk and eliminates duplicate implementations.
- One utility improves maintainability and developer ergonomics.
Scope
- Replace local
escapeHtml/escapeHTMLimplementations withimport { escapeHtml } from '/js/utils.js'. - Audit and update places building
innerHTMLor HTML attributes with dynamic values.
Tasks
Migration
- Replace local
escapeHtml/escapeHTMLin components with the shared utility. - Audit for direct template insertions of dynamic values and wrap with
escapeHtmlas needed. - Review uses of
.innerHTMLandsetAttributewith dynamic content. - Grep patterns to review:
this.escapeHtml(|this.escapeHTML(|escapeHTML(.innerHTML =title="...${...}"/aria-label="...${...}"with dynamic valuesnew DOMParser()or stringifiedouterHTML
Documentation
- Update CONTRIBUTING.md or a DEVNOTES.md snippet: "Always use
escapeHtmlwhen inserting dynamic text into HTML or attributes." - Add JSDoc to
js/utils.jsescapeHtmlwith usage examples.
Communication (post-merge)
- Announce the shared
escapeHtmlutility in the dev channel and encourage adoption in new code. - Link to
js/utils.js.
Optional safeguards
- Consider adding an ESLint rule or code review checklist item to flag raw
innerHTMLwith dynamic inputs.
Acceptance criteria
- No local escape helpers remain in source (excluding generated files under
_site/). - All audited dynamic insertions use
escapeHtmlwhere appropriate.
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CenterForDigitalHumanities/TPEN-interfaces
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
License link borkedOpen
Difficulty 1/5 Under an hour Newbie friendliness 68/100
All issues in CenterForDigitalHumanities/TPEN-interfaces
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PhyberApex/slds-json-schema-renderer#372 ·
Maintainers usually reply within 1 day
-
usage: a custom provider's balance meters ("…%" in the balance path) ignore the Left/Used switchOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[BUG] rag: sentence content can cross the reported sentence boundariesPossibly taken @LJK-ikun claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ericcornelissen/depreman#591 ·
Maintainers usually reply within 1 day
-
bug/1-unconfirmed kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
prisma/orm#30818 · 1 comment ·
Maintainers usually reply within 1 day