Add comprehensive XSS vulnerability analysis for TypeScript files#821
Draft
Add comprehensive XSS vulnerability analysis for TypeScript files#821
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Co-authored-by: willum070 <2319656+willum070@users.noreply.github.com>
Co-authored-by: willum070 <2319656+willum070@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Please find me any .ts files that contain XSS unsafe DOM (concatenating HTML instead of using textContent, etc)
Add comprehensive XSS vulnerability analysis for TypeScript files
Oct 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a complete security analysis identifying XSS (Cross-Site Scripting) vulnerabilities in TypeScript files across the repository. The analysis found 15 files using
innerHTML, with 7 files (46.7%) containing critical vulnerabilities where unsanitized dynamic data is inserted into the DOM.What's Included
Three comprehensive documentation files have been added to help the team understand and remediate these security issues:
📄 XSS_VULNERABILITY_ANALYSIS.md
A detailed technical report (13KB) containing:
📄 XSS_FINDINGS_SUMMARY.md
A quick reference guide (4.2KB) for developers:
📊 XSS_FINDINGS.csv
A tracking spreadsheet (3KB) for project management:
Key Findings
🔴 Critical Vulnerabilities (7 files)
These files use
innerHTMLwith dynamic data that could contain malicious content:Highest Priority (User-Controlled Data):
samples/deckgl-kml/index.ts(Line 132) - KML files can be user-uploaded; description field commonly contains HTMLsamples/deckgl-kml-updated/index.ts(Line 156) - Same KML vulnerabilityHigh Priority (External Data Sources):
samples/deckgl-heatmap/index.ts(Line 100) - External CSV/JSON data displayed in tooltipssamples/deckgl-polygon/index.ts(Line 110) - Similar external data vulnerabilityMedium Priority (API Data):
samples/advanced-markers-html/index.ts(Line 48) - Property data (type, price, address) inserted without escapingsamples/3d-places/index.ts(Lines 29, 30, 34) - Places API data concatenated into HTML using+=in a loopsamples/advanced-markers-graphics/index.ts(Line 93) - Font Awesome icon (currently hardcoded but establishes unsafe pattern)Example Vulnerability
In
samples/advanced-markers-html/index.ts:If
property.addresscontains<img src=x onerror="alert('XSS')">, malicious JavaScript will execute.Recommended Safe Pattern
Why This Matters
While these are sample/demo files, they serve as learning resources that developers copy into production applications. Vulnerable patterns in samples can propagate to real-world code, creating security risks. The highest-priority vulnerabilities involve user-uploaded KML files, which are a well-known XSS vector in mapping applications.
Category Analysis
Next Steps
The documentation provides everything needed to remediate these issues:
XSS_VULNERABILITY_ANALYSIS.mdfor detailed findingsXSS_FINDINGS.csvto track remediation progressinnerHTMLusage with dynamic dataNo Code Changes
This PR intentionally contains no code changes - only documentation. This allows the team to:
All files have been committed to the repository root for easy access.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.