Back to skill

Security audit

Mapbox Google Maps Migration

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Mapbox migration guide; its network and token examples are expected for the topic, but developers should add privacy and HTML-safety safeguards when copying the examples.

Installers can treat this as a documentation skill, not an executing integration. Before copying its code into a real app, review Mapbox token handling, disclose Mapbox geocoding/directions data sharing, avoid sending sensitive location data unnecessarily, and sanitize popup content or use text-only rendering for untrusted 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

Warning
Location
SKILL.md:184
Finding

Potential DOM-Based Cross-Site Scripting Through Unsanitized Popup HTML

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 184–190
Vulnerability Type: Unsanitized dynamic HTML rendering
Risk Level: Medium

javascript
map.on('click', 'points-layer', (e) => {
  const coordinates = e.features[0].geometry.coordinates.slice();
  const description = e.features[0].properties.description;

  new mapboxgl.Popup().setLngLat(coordinates).setHTML(description).addTo(map);
});

Technical Analysis

The example reads description from a GeoJSON feature and passes it directly to mapboxgl.Popup.setHTML(). Unlike a text-only rendering method, setHTML() interprets the supplied value as markup.

If the GeoJSON data originates from an untrusted or insufficiently validated source, an attacker may place malicious HTML in the description property. Applications that copy this pattern could render attacker-controlled elements or event handlers in their page. The example does not sanitize the value, restrict permitted markup, or warn developers that feature properties must be treated as untrusted input.

Attack Path

  1. An application adopts the documented popup pattern.
  2. The application loads GeoJSON containing feature properties from a user-controlled, compromised, or otherwise untrusted data source.
  3. An attacker supplies a malicious value in a feature's description property, such as markup containing an executable event handler.
  4. A user clicks the corresponding feature in points-layer.
  5. The event handler retrieves the malicious description.
  6. setHTML(description) inserts the value into the popup as HTML.
  7. If the browser and the application's Content Security Policy permit the payload, attacker-controlled script executes in the application's origin.

Impact Assessment

Successful exploitation could execute JavaScript with the privileges of the affected web application origin. Depending on the application's architecture and browser protections, the at ...[truncated 442 chars]

Remediation
View remediation

Remediation Suggestions

  • Use setText(description) whenever popup content is intended to be plain text.
  • If rich HTML is required, sanitize the value with a maintained allowlist-based HTML sanitizer before passing it to setHTML().
  • Permit only the minimum necessary elements and attributes; remove script-capable elements, event-handler attributes, unsafe URL schemes, and dangerous embedded content.
  • Validate and normalize GeoJSON properties when data enters the application rather than relying exclusively on rendering-time checks.
  • Document explicitly that remote, uploaded, or user-generated feature properties are untrusted.
  • Deploy a restrictive Content Security Policy as defense in depth, avoiding unsafe-inline and limiting script sources to trusted origins.
  • Add tests containing malicious markup and event-handler payloads to verify that popup content is rendered safely.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (13)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · AGENTS.md (reported line 18)May include surrounding context.

md
## Quick Migration Checklist

✅ Install `mapbox-gl` package
✅ Get Mapbox access token
✅ Swap coordinate order (lat,lng → lng,lat)
✅ Replace Google Maps API with Mapbox equivalents
✅ Use Symbol layers for 100+ markers (not HTML markers)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · AGENTS.md (reported line 310)May include surrounding context.

md
## Quick Migration Checklist

✅ Install `mapbox-gl` package
✅ Get Mapbox access token
✅ Swap coordinate order (lat,lng → lng,lat)
✅ Replace Google Maps API with Mapbox equivalents
✅ Use Symbol layers for 100+ markers (not HTML markers)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · AGENTS.md (reported line 339)May include surrounding context.

md
## Quick Migration Checklist

✅ Install `mapbox-gl` package
✅ Get Mapbox access token
✅ Swap coordinate order (lat,lng → lng,lat)
✅ Replace Google Maps API with Mapbox equivalents
✅ Use Symbol layers for 100+ markers (not HTML markers)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 55)May include surrounding context.

md
## Quick Migration Checklist

✅ Install `mapbox-gl` package
✅ Get Mapbox access token
✅ Swap coordinate order (lat,lng → lng,lat)
✅ Replace Google Maps API with Mapbox equivalents
✅ Use Symbol layers for 100+ markers (not HTML markers)

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

This example performs a live fetch to Mapbox's geocoding API, which transmits the queried address and access token to an external service. In context, the transmission itself is expected, but the security concern is the lack of warning about third-party data disclosure and the tendency to encourage direct client-side requests with user data.

Content

Scanner excerpt · AGENTS.md (reported line 159)May include surrounding context.

md
// Mapbox
fetch(
  `https://api.mapbox.com/search/geocode/v6/forward?q=1600+Amphitheatre+Parkway&access_token=${mapboxgl.accessToken}`
)
  .then((r) => r.json())
  .then((data) => {

External Transmission

Medium
Category
Data Exfiltration
Confidence
83% confidence
Finding

This example sends routing coordinates to Mapbox's directions API, disclosing travel origin/destination data to an external provider. While normal for directions functionality, it becomes a security/privacy issue when a guide omits disclosure and safeguards for potentially sensitive location data.

Content

Scanner excerpt · AGENTS.md (reported line 186)May include surrounding context.

md
// Mapbox
fetch(
  `https://api.mapbox.com/directions/v5/mapbox/driving/-122.4194,37.7749;-118.2437,34.0522?access_token=${mapboxgl.accessToken}`
)
  .then((r) => r.json())
  .then((data) => {

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · references/api-services.md (reported line 31)May include surrounding context.

md
- Charges per map load
- Free tier: 50,000 map loads/month
- Unlimited API requests per map session
- More predictable costs

**Migration Tip:** Understand how pricing models differ for your use case.

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 · SKILL.md (reported line 219)May include surrounding context.

md
const destination = [-118.2437, 34.0522];

fetch(
  `https://api.mapbox.com/directions/v5/mapbox/driving/${origin.join(',')};${destination.join(',')}?geometries=geojson&access_token=${mapboxgl.accessToken}`
)
  .then((response) => response.json())
  .then((data) => {

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 · SKILL.md (reported line 220)May include surrounding context.

md
const destination = [-118.2437, 34.0522];

fetch(
  `https://api.mapbox.com/directions/v5/mapbox/driving/${origin.join(',')};${destination.join(',')}?geometries=geojson&access_token=${mapboxgl.accessToken}`
)
  .then((response) => response.json())
  .then((data) => {

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/directions-controls.md (reported line 34)May include surrounding context.

md
const destination = [-118.2437, 34.0522];

fetch(
  `https://api.mapbox.com/directions/v5/mapbox/driving/${origin.join(',')};${destination.join(',')}?geometries=geojson&access_token=${mapboxgl.accessToken}`
)
  .then((response) => response.json())
  .then((data) => {

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/shapes-geocoding.md (reported line 179)May include surrounding context.

md
const destination = [-118.2437, 34.0522];

fetch(
  `https://api.mapbox.com/directions/v5/mapbox/driving/${origin.join(',')};${destination.join(',')}?geometries=geojson&access_token=${mapboxgl.accessToken}`
)
  .then((response) => response.json())
  .then((data) => {

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file includes Google Maps and Mapbox geocoding examples that transmit user-provided address data to third-party geocoding services. The surrounding documentation does not warn that entered locations or queries may be sent off-device to external providers, which is the type of privacy-affecting behavior SQP-2 covers for markdown files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The guide demonstrates geocoding and directions requests to Mapbox but does not mention that user-entered addresses, coordinates, and routing inputs are sent to a third-party service. In a migration guide, this omission can cause developers to integrate privacy-sensitive data flows without appropriate disclosure, consent checks, or data handling review.

Content

No source excerpt is available for this finding.