Skip to content

Conversation

@kargig
Copy link
Owner

@kargig kargig commented Jan 17, 2026

Fixes an issue where special characters like apostrophes were being stored and displayed as double or triple-encoded HTML entities (e.g., ' instead of ').

Backend Changes:

  • Update sanitize_input in dive_routes.py to unescape text before escaping it. This makes the operation idempotent and prevents the double-encoding cycle during repeated saves.

Frontend Changes:

  • Implement recursive decoding in htmlDecode.js (up to 3 passes) to properly handle legacy triple-encoded data from the database.
  • Update multiple React components (Admin tables, search inputs, previews, and edit forms) to decode HTML entities before rendering via JSX. This ensures correct visual display while relying on React's native escaping for XSS protection.
  • Fix a pre-existing XSS vulnerability in DiveDetail.js by removing explicit decoding from Leaflet map popup template strings. These now leverage the browser's native entity decoding in innerHTML, which is safe from script injection.

Fixes an issue where special characters like apostrophes were being
stored and displayed as double or triple-encoded HTML entities (e.g.,
' instead of ').

Backend Changes:
- Update sanitize_input in dive_routes.py to unescape text before
  escaping it. This makes the operation idempotent and prevents the
  double-encoding cycle during repeated saves.

Frontend Changes:
- Implement recursive decoding in htmlDecode.js (up to 3 passes) to
  properly handle legacy triple-encoded data from the database.
- Update multiple React components (Admin tables, search inputs,
  previews, and edit forms) to decode HTML entities before rendering
  via JSX. This ensures correct visual display while relying on
  React's native escaping for XSS protection.
- Fix a pre-existing XSS vulnerability in DiveDetail.js by removing
  explicit decoding from Leaflet map popup template strings. These
  now leverage the browser's native entity decoding in innerHTML,
  which is safe from script injection.
@kargig kargig force-pushed the decodehtml_improvements branch from 3a13e1e to 74fea7d Compare January 17, 2026 09:51
@kargig kargig merged commit a5f86fc into main Jan 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants