Back to skill

Security audit

Mapbox Web Performance Patterns

Security checks for vulnerabilities and agentic risk

Overview

This Mapbox performance skill has no install-time privileges or hidden execution, but some “good” examples teach unsafe popup rendering that could create XSS-prone web code.

Install only if you are comfortable treating it as performance guidance, not secure coding guidance. Review generated popup code carefully and replace setHTML() on map feature properties with setText() or a maintained sanitizer before using it with API, GeoJSON, vector-tile, uploaded, or third-party data.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:182
Finding

DOM-Based Cross-Site Scripting Through Unsanitized Map Popup Content

Content
View full analysis
{ const marker = new mapboxgl.Marker() .setLngLat([restaurant.lng, restaurant.lat]) .setPopup(new mapboxgl.Popup().setHTML(restaurant.name)) .addTo(map); }); ``` `SKILL.md:222-225`: ```javascript map.on('click', 'restaurants', (e) => { const feature = e.features[0]; new mapboxgl.Popup().setLngLat(feature.geometry.coordinates).setHTML(feature.properties.name).addTo(map); }); ``` `references/memory.md:48-50`: ```javascript map.on('click', 'restaurants', (e) => { new mapboxgl.Popup().setLngLat(e.lngLat).setHTML(e.features[0].properties.name).addTo(map); // Popup never removed! }); ``` `references/memory.md:55-58`: ```javascript let popup = new mapboxgl.Popup({ closeOnClick: true }); map.on('click', 'restaurants', (e) => { popup.setLngLat(e.lngLat).setHTML(e.features[0].properties.name).addTo(map); }); ``` ### Technical Analysis The examples pass map feature properties directly to `mapboxgl.Popup.setHTML()`. Values such as `restaurant.name` and `feature.properties.name` may originate from APIs, uploaded GeoJSON, third-party datasets, or other untrusted sources. `setHTML()` treats its argument as HTML rather than plain text. If an attacker can control a feature property, the attacker can insert active HTML, such as an element containing an event handler. When the popup is rendered and the relevant event is triggered, the payload can execute in the security context of the application origin. Reusing a popup instance addresses resource consumption but does not provide output encoding or sanitization. The recommended “good” memory-management example therefore preserves the injection ...[truncated 1747 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (1)

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/data-loading.md (reported line 68)May include surrounding context.

md
// ✅ Server generates tiles, client loads only visible area (self-hosted tilesets)
map.addSource('large-dataset', {
  type: 'vector',
  tiles: ['https://api.example.com/tiles/{z}/{x}/{y}.pbf'],
  minzoom: 0,
  maxzoom: 14
});