Back to skill

Security audit

dmap-jsapi-skill

Security checks for vulnerabilities and agentic risk

Overview

This DMap documentation skill is useful but needs review because its examples promote insecure HTTP script loading and unsafe copy-paste patterns.

Review before installing. Treat this as DMap API reference material, but do not copy the quick-start security posture into production: replace private HTTP endpoints with trusted HTTPS origins, pin or vendor scripts where possible, avoid setHTML with untrusted data, and gate precise location tracking behind explicit user consent.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:34
Finding

Mutable JavaScript Is Loaded from an Unauthenticated HTTP Origin

Content
View full analysis
``` ```javascript dmapgl.serviceUrl = 'http://172.26.64.84/api'; ``` ### Technical Analysis The Skill's primary quick-start instructions direct generated applications to load executable JavaScript from the private IP address `172.26.64.84` over plaintext HTTP. The remote script is executed with the privileges of the page that imports it. HTTP provides no transport authentication or integrity protection. An attacker able to intercept the connection, compromise the private server, manipulate routing or DNS infrastructure, or gain access to the relevant network segment could replace `dmap-gl.js` with arbitrary JavaScript. No Subresource Integrity hash is supplied to detect such modification. The payload may also change after the Skill package has been audited because the executable content is not included in the audited repository. This creates a remote payload execution channel whose effective behavior depends on the server response at runtime. The HTTP API and style endpoints also lack transport protection. Their responses could be modified in transit, potentially supplying malicious map data or style content. Applications served over HTTPS may reject these HTTP resources as mixed content, resulting in availability failures. ### Attack Path 1. A developer follows the Skill's quick-start example and deploys a page that imports `dmap-gl.js` from `http://172.26.64.84`. 2. An a ...[truncated 1436 chars]
Remediation
View remediation
``` 5. Configure a restrictive Content Security Policy that permits scripts only from explicitly trusted origins and does not allow `unsafe-inline` or `unsafe-eval`. 6. Serve map styles, tiles, and API requests exclusively through HTTPS. 7. Replace the hard-coded private address in every reference with an explicit deployment placeholder so generated code cannot accidentally depend on the audit environment. 8. Document the expected artifact digest and provide a process for verifying downloaded files before deployment. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/popup.md:313
Finding

Untrusted API and Map Feature Values Are Interpolated into HTML

Content
View full analysis
res.json()) .then(data => { loadingPopup.setHTML(`

${data.name}

${data.description}

`); }) ``` From `references/events.md:345-360`: ```javascript map.on('click', (e) => { const features = map.queryRenderedFeatures(e.point); if (features.length > 0) { const properties = features[0].properties; new dmapgl.Popup() .setLngLat(e.lngLat) .setHTML(createInfoPopup(properties)) .addTo(map); } }); function createInfoPopup(properties) { let html = '
'; for (const [key, value] of Object.entries(properties)) { html += `

${key}: ${value}

`; } html += '
'; return html; } ``` From `references/layers.md:447-455`: ```javascript map.on('click', 'my-layer', (e) => { const feature = e.features[0]; new dmapgl.Popup() .setLngLat(e.lngLat) .setHTML(`

${feature.properties.name}

`) .addTo(map); }); ``` ### Technical Analysis The examples interpolate API response fields and map feature properties directly into strings passed to `setHTML()`. These values are not escaped or sanitized before the browser parses them as markup. API data and map feature properties are external trust-boundary inputs. If an attacker can create or modify a POI record, GeoJSON feature, vector tile attribute, or other source property, the attacker can insert HTML containing event handlers or other active content. Calling `setHTML()` causes that content to be interpreted in the application's DOM. The warning at `references/popup.md:457`, which ...[truncated 1739 chars]
Remediation
View remediation
{ if (!res.ok) throw new Error('Request failed'); return res.json(); }) .then(data => { const container = document.createElement('div'); container.className = 'poi-info'; const heading = document.createElement('h3'); heading.textContent = String(data.name ?? ''); const description = document.createElement('p'); description.textContent = String(data.description ?? ''); container.append(heading, description); loadingPopup.setDOMContent(container); }); ``` 3. For simple content, use `setText()` rather than `setHTML()`. 4. When rich HTML is a strict requirement, sanitize it with a maintained allowlist-based sanitizer before insertion. Do not rely on ad hoc regular expressions. 5. Treat feature property names as untrusted in addition to property values. 6. Validate upstream API and map data against an explicit schema, but do not use validation as a replacement for output encoding. 7. Apply a restrictive Content Security Policy without `unsafe-inline` to reduce the effect of injected event handlers. 8. Rewrite all dynamic examples consistently so developers are not encouraged to copy an insecure pattern despite the final XSS warning. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (43)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **事件系统**: `references/events.md` - 响应点击、拖拽、缩放、移动等交互事件

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The auto-trigger description is very broad ('when the user mentions dmap, dmapgl, jsapi-gl or related map development needs'), which can cause the skill to activate in loosely related contexts and inject authoritative guidance unexpectedly. In this skill's context, that is more dangerous because the guidance includes insecure-by-default HTTP examples, so over-triggering increases the chance those insecure patterns are propagated into unrelated or insufficiently reviewed code.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly promises 'production-grade secure defaults' but demonstrates loading the core JS/CSS and backend service over plain HTTP to an internal IP. That creates a real integrity and confidentiality risk: any on-path attacker on the local network, corporate proxy, Wi-Fi, or VPN path could tamper with the SDK, map styles, or API responses, leading to script injection, data exposure, or full client-side compromise.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file presents the API documentation content entirely in Chinese, beginning with a bilingual heading but then continuing in Chinese-only explanatory text. Under the stated policy, forcing a specific language without user opt-in or a documented region-specific justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file documents LngLat as geographic coordinates with longitude in -180..180 and latitude in -90..90, but multiple examples instantiate or pass LngLat values like [800000, 600000], which directly contradict those documented semantics. This is not mere incompleteness: the examples actively show invalid inputs for the documented type and can mislead users about what the API accepts.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

LngLatBounds is documented as a geographic bounding box defined by southwest and northeast corners, yet the examples create bounds with values such as [750000, 560000] and [850000, 650000]. Those numbers are incompatible with the documented longitude/latitude model and therefore contradict the intent conveyed by the surrounding documentation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The static method is documented as fromLngLat(lngLat, altitude), implying standard longitude/latitude input, but the example passes [800000, 600000], which is inconsistent with the documented geographic ranges elsewhere in the file. This creates intent-code/documentation divergence because the example teaches usage that conflicts with the stated API contract.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file presents the skill/API documentation exclusively in Chinese, starting with the title and continuing throughout the file. Under the policy rule, forcing a specific language without user opt-in or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example enables high-accuracy geolocation and continuous user-location tracking without any warning, consent guidance, or privacy caveat. In a developer-facing skill, this can normalize integrating location tracking without appropriate user notice, potentially leading downstream applications to collect sensitive location data in a privacy-invasive way.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s headings and instructional text are entirely in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

The example instructs consumers to load executable JavaScript from a third-party remote origin (api.mapbox.com) at runtime. This creates a supply-chain and external transmission risk: if the remote resource is compromised, changed, blocked, or violates deployment policy, applications using the example may execute untrusted code or leak metadata through outbound requests.

Content

Scanner excerpt · references/api/properties.md (reported line 75)May include surrounding context.

javascript
dmapgl.setRTLTextPlugin(
  'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js',
  (error) => {
    if (error) {
      console.error('RTL插件加载失败:', error);

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation recommends enabling GeolocateControl with high-accuracy tracking but does not mention that it requests and may continuously track the user's physical location. In a developer guide, this omission can lead downstream applications to deploy location features without clear notice, consent UX, or privacy documentation, increasing the risk of privacy violations and regulatory noncompliance.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file presents all instructional content in Chinese and does not indicate that language selection is optional or that the document is intentionally region-specific. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The popup example builds HTML by concatenating untrusted feature property keys and values directly into a string passed to setHTML(). If those properties originate from external GeoJSON, tiles, or API responses, an attacker can inject scriptable markup and trigger DOM-based XSS in applications that copy this example.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation states that performanceMetricsCollection defaults to true, meaning performance data may be collected and sent, but it does not explain what telemetry is transmitted, the privacy implications, or when users should disable it. In a developer skill, this omission can lead downstream users to deploy privacy-impacting defaults without informed consent or compliance review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation demonstrates innerHTML and Popup.setHTML() with dynamic content but does not warn that untrusted values must be sanitized or inserted via text-safe APIs. In a JSAPI skill, developers often copy examples directly; if ${location.name} or similar values come from user or external data, this can lead to DOM-based XSS in applications using the map markers or popups.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file is written entirely in Chinese and provides no indication that the language choice is optional or that the content is intentionally restricted to a Chinese-speaking audience. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

At L056-L066, match is documented and exemplified as a value-matching expression over discrete cases. But at L290-L298, the heading and examples describe match as performing regular-expression checks and capture-group extraction, which is a different capability and contradicts the earlier semantics in the same file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all instructions and examples exclusively in Chinese, and does not indicate that the skill is region-specific or provide any user opt-in for language preference. That can violate a language/locale policy when users are not given a choice or justification for the enforced language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file's instructional natural language is overwhelmingly in Chinese, including headings and explanatory text, and it does not indicate that the user can choose another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The geolocation example demonstrates continuous user location tracking with high-accuracy coordinates and automatic map recentering, but it does not mention consent, disclosure, or safe handling of precise location data. In developer documentation, this can propagate privacy-unsafe implementations into downstream apps, increasing the risk of collecting or exposing sensitive real-time location information without adequate user awareness.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation is entirely written in Chinese, including headings, explanations, and usage notes, with no indication that alternative languages are available. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains user-facing natural-language documentation exclusively in Chinese, beginning with the title and continuing throughout the file. Under the language/locale policy rule, forcing a specific language without user opt-in can be a policy violation when no alternative language or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains user-facing instructional content exclusively in Chinese, including headings, descriptions, and notes. Under the language/locale policy, forcing a specific language without user choice can be considered a natural-language policy violation unless clearly justified, and no such justification or language option is provided here.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file is presented as documentation for 'Markers and Controls', but the usage example adds dmapgl.GeolocateControl, which invokes user-location functionality rather than merely describing marker/control rendering basics. While still map-related, accessing device geolocation is a distinct capability with privacy implications and is not otherwise documented in this file's declared scope.

Content

No source excerpt is available for this finding.