Skip to content

Search JSON → client-side XSS (high priority) #26

@kallal79

Description

@kallal79

Short summary
A client-side search feature consumed a generated search.json and rendered results by injecting HTML strings. If search.json contains malicious content, a visitor using search could execute arbitrary JavaScript in the site origin. This is a high-impact vulnerability and should be fixed and CI‑checked immediately.

Fix applied (summary)

  • search.json generation: fields serialized with Liquid jsonify to produce valid, safe JSON.
  • src/js/simpleJekyllSearch.js: switched from string-based templating to DOM construction with textContent to avoid HTML parsing of untrusted values.
  • src/js/target_blank.js: added rel="noopener noreferrer" for external links to prevent reverse tabnabbing.

Verification (quick commands)

  • Manual PoC test: create malicious search.json and open poc-search-xss.html.
  • Run the verification scripts added in scripts/:
# run these from repo root
node scripts/check_search_json.js
node scripts/check_target_blank_rel.js .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions