Skip to content

fix: sanitize aircraft data in HTML output to prevent XSS - #299

Open
zagers wants to merge 1 commit into
flightaware:masterfrom
zagers:fix/xss-airframes-links
Open

fix: sanitize aircraft data in HTML output to prevent XSS#299
zagers wants to merge 1 commit into
flightaware:masterfrom
zagers:fix/xss-airframes-links

Conversation

@zagers

@zagers zagers commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Adds an escapeHtml() utility and applies it to three link-generation functions that previously inserted unsanitized aircraft data into HTML via innerHTML.

Changes

  • getAirframesModeSLink — ICAO code stripped to hex-only for onclick handler, display text HTML-escaped. Also upgraded link from http:// to https://`.
  • getFlightAwareModeSLinkcode and ident URL-encoded for href, linkText HTML-escaped.
  • getFlightAwareIdentLinkident URL-encoded for href, linkText HTML-escaped.

Vulnerability

An attacker controlling the ADS-B feed could inject arbitrary JavaScript through crafted ICAO codes or callsigns (e.g. "><img src=x onerror=alert(1)>). These values were concatenated directly into HTML strings and inserted via innerHTML.

Fixes #295
Fixes #296

Add escapeHtml() utility and apply it to getAirframesModeSLink,
getFlightAwareModeSLink, and getFlightAwareIdentLink to prevent
script injection via crafted ICAO codes or callsigns.

Fixes flightaware#295
@mutability mutability added the LLM has LLM-generated content, treat with extreme suspicion label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM has LLM-generated content, treat with extreme suspicion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XSS vulnerabilities in FlightAware link generation functions XSS vulnerability in getAirframesModeSLink via innerHTML onclick

2 participants