Enhance WikiLink XSS protection with comprehensive validation #201

Closed
opened 2026-02-02 18:08:07 +00:00 by jason.woltje · 0 comments
Owner

Context: Issue #191 was resolved with basic slug validation and HTML escaping. However, agent a3f2854 designed more comprehensive protections.

Current Implementation (basic):

  • Alphanumeric whitelist for slugs
  • HTML escaping in title attribute

Proposed Enhancements:

  1. Protocol filtering with decode validation (checks raw, percent-decoded, and entity-decoded)
  2. Defense against percent-encoding bypass (%6A%61%76%61%73%63%72%69%70%74:)
  3. HTML entity bypass prevention (javascript:)
  4. Protocol-relative URL blocking (//)
  5. Unicode null byte filtering
  6. SVG XSS vector blocking
  7. Base64 data URI validation

Benefits:

  • Blocks sophisticated encoding-based XSS attacks
  • Defense-in-depth with 4 security layers
  • Handles edge cases not caught by basic validation

Test Coverage: 82.3% (15 security tests covering advanced attack vectors)
Priority: P2 (enhancement) - Core vulnerability patched

References: Agent a3f2854 transcript

Context: Issue #191 was resolved with basic slug validation and HTML escaping. However, agent a3f2854 designed more comprehensive protections. Current Implementation (basic): - Alphanumeric whitelist for slugs - HTML escaping in title attribute Proposed Enhancements: 1. Protocol filtering with decode validation (checks raw, percent-decoded, and entity-decoded) 2. Defense against percent-encoding bypass (%6A%61%76%61%73%63%72%69%70%74:) 3. HTML entity bypass prevention (javascript:) 4. Protocol-relative URL blocking (//) 5. Unicode null byte filtering 6. SVG XSS vector blocking 7. Base64 data URI validation Benefits: - Blocks sophisticated encoding-based XSS attacks - Defense-in-depth with 4 security layers - Handles edge cases not caught by basic validation Test Coverage: 82.3% (15 security tests covering advanced attack vectors) Priority: P2 (enhancement) - Core vulnerability patched References: Agent a3f2854 transcript
jason.woltje added the p2securityweb labels 2026-02-02 18:08:07 +00:00
jason.woltje added this to the M7.1-Remediation (0.0.8) milestone 2026-02-03 22:31:44 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#201