Back to skill

Security audit

Gaode Map JSAPI - 高德官方 JavaScript SDK Skill

Security checks for vulnerabilities and agentic risk

Overview

This map-development skill is coherent and documentation-only, but it needs review because it can guide agents to handle API keys and location data using unsafe examples.

Review generated code before use. Keep AMap keys in environment variables or a backend proxy, remove any copied example key, use HTTPS, avoid raw innerHTML/template insertion for untrusted map data, avoid JSONP unless fully trusted, and add clear user notice/consent for precise location, IP-based city lookup, geocoding, and reverse-geocoding.

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
references/api/services-other.md:100
Finding

Hardcoded API Key Exposed in a Plaintext HTTP URL

Content
View full analysis

Vulnerability Details

File Location: references/api/services-other.md:100
Vulnerability Type: Hardcoded credential and plaintext transmission
Risk Level: Medium

Vulnerable Code

javascript
// Query live weather information. The cityName reference URL is:
// http://restapi.amap.com/v3/config/district?level=city&sublevel=0&extensions=all&output=xml&key=d9fba2f3196b6a4419358693a2b0d9a9
amapWeather.getLive('Beijing');

The original comment contains a credential-like, 32-character AMap API key directly in a URL and uses unencrypted HTTP.

Technical Analysis

API credentials must not be embedded in documentation, examples, generated source code, or URLs. A reader or AI agent may reproduce this reference URL in generated applications. Because the URL uses HTTP, the key and request parameters can also be observed or modified by parties with access to the network path.

URLs are routinely retained in source repositories, browser history, application telemetry, reverse-proxy logs, access logs, and monitoring systems. Consequently, placing a key in a URL substantially expands its exposure. Although the audit could not verify whether this historical key remains active, it must be treated as exposed until revoked or conclusively shown to be invalid.

Attack Path

  1. An agent or developer reads the weather-service example.
  2. The example URL is copied into generated code, documentation, or a browser.
  3. The embedded key is exposed through the project source, plaintext network traffic, browser history, or infrastructure logs.
  4. An attacker extracts the key.
  5. If the key remains active and lacks sufficient origin, IP, service, or quota restrictions, the attacker submits unauthorized AMap API requests with it.

Impact Assessment

Successful exploitation does not grant local operating-system privileges. Its scope is limited to the services and quotas authorized for the exposed AMa ...[truncated 231 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the embedded key and replace it with an unmistakable placeholder such as YOUR_AMAP_API_KEY.
  2. Revoke or rotate the exposed key through the AMap administrative console, even if it is believed to be an obsolete example.
  3. Replace the HTTP endpoint with HTTPS to protect requests in transit.
  4. Avoid placing secrets in URLs. Keep sensitive credentials in protected server-side environment variables or a secrets manager.
  5. Route credential-bearing requests through a hardened backend proxy when supported, ensuring that the secret is never delivered to browser code.
  6. Restrict replacement credentials by permitted API, origin or server IP, environment, and minimum required quota.
  7. Add automated secret scanning to documentation and source-control workflows.
  8. Review repository history, generated artifacts, browser-accessible examples, and relevant logs for further copies of the exposed value.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (62)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `references/routing.md` - 路径规划(驾车/步行/公交)。

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The section '使用 skills 必须遵循的规范' and subsequent usage instructions are written as mandatory operational guidance for the skill, but the file does not indicate that language is selectable by the user. This can violate a language/locale policy if the skill effectively constrains interaction or generated artifacts to Chinese without explicit opt-in or a documented regional justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. This markdown file presents all instructions and API descriptions only in Chinese, with no visible opt-in, alternative language, or justification that the content is intentionally region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

L252-L268 连续三处都使用 getNorthEast 作为方法名,但说明文字分别表示获取东北角、西北角、东南角坐标。相同方法名不可能同时对应三个不同方向角,这构成了明显的文档-接口意图冲突。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation describes precise geolocation capabilities, including high-accuracy positioning, reverse geocoding, and continuous/browser-based location, but does not warn developers to obtain informed user consent or disclose collection and use of location data. This can lead integrators to build features that collect sensitive location information without adequate notice, increasing privacy, compliance, and trust risks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The CitySearch documentation explains deriving a user's city from their IP address but does not disclose that IP-based location inference processes personal data and may require notice depending on jurisdiction and application context. Because this is developer guidance, omission of that warning can normalize silent IP-based geolocation and lead downstream applications to use location inference without transparency.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation explicitly allows content to be an HTML string or HTMLElement without warning that rendering untrusted HTML can enable DOM-based XSS in applications using the API. In a map InfoWindow context, developers commonly display user-controlled place names, descriptions, or business data, so omission of sanitization guidance increases the chance of unsafe usage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The documentation explicitly permits loading heatmap data from a remote JSONP URL and passing the result into a parser function, but provides no warning that JSONP is executable script fetched from a third party. This can lead developers to introduce cross-site script execution, untrusted data ingestion, privacy leakage, and supply-chain risk if they copy the example without understanding the security implications.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

L832 将条目标记为 getBounds,但紧随其后的说明 L834 表示“当canvas的内容发生改变是用于刷新图层,3D视图下调用”,这描述的是刷新/重绘动作而不是“获取范围”。同一节前面的 L826-L830 已经把 getBounds 正确描述为返回经纬度范围,因此这里的文档与方法意图直接冲突。

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 user-facing documentation exclusively in Chinese, and there is no indication that users may choose another language or that the content is intentionally limited to a Chinese-language audience. Under the language/locale policy, forcing a single language without opt-in can be a natural-language policy violation.

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 all user-facing documentation in Chinese, and it does not indicate that the skill is region-specific or provide an opt-in language choice. Under the language/locale policy, forcing a specific language without user choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The entire skill file is written in Chinese and does not provide any indication that users may choose another language or that the content is intentionally limited to a Chinese-only audience. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents the entire skill documentation only in Chinese, with no indication that language selection is optional or that the skill is intentionally limited 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.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file presents all instructions and API descriptions exclusively in Chinese, which can impose a fixed language on users without any stated opt-in or locale justification. Under the policy rule for language/locale constraints, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

SQP-3 applies to all file types and includes language or locale policy violations. This markdown reference file presents all headings and descriptions exclusively in Chinese and does not indicate that the locale is region-specific or provide an alternative language option.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation encourages sending user-entered addresses and clicked map coordinates to AMap's geocoding service but does not disclose that this data leaves the application and is processed by a third-party provider. Addresses and precise coordinates can be sensitive location data, so omitting a privacy warning or consent guidance can lead developers to build flows that unknowingly expose user location information.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The example builds InfoWindow content with div.innerHTML and later uses HTML strings as content without any sanitization guidance. If developers copy this pattern with user-controlled POI names, addresses, or other dynamic fields, it can lead to DOM XSS and arbitrary script execution in the page context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This complete example interpolates dynamic values such as poi.name and poi.address directly into an HTML template used by infoWindow.setContent, with no escaping or sanitization warning. In realistic apps these fields often come from APIs or user data, so an attacker could inject script or event-handler payloads that execute when the InfoWindow opens.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents all instructional content in Chinese and does not offer an alternative language, user opt-in, or a documented justification for restricting the skill content to a specific language/locale. Under the policy, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

该文件标题及全文内容均以中文固定呈现,未见任何允许用户选择语言、切换 locale 或说明该文档仅适用于特定中文区域场景的文字。根据规则,强制单一语言且无用户 opt-in 的自然语言说明属于语言/locale 政策风险。

Content

No source excerpt is available for this finding.

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/security.md (reported line 37)May include surrounding context.

javascript
window._AMapSecurityConfig = {
  serviceHost: 'https://您的代理服务器域名/_AMapService', 
  // 例如:'https://api.example.com/_AMapService'
};

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/security.md (reported line 58)May include surrounding context.

javascript
window._AMapSecurityConfig = {
  serviceHost: 'https://您的代理服务器域名/_AMapService', 
  // 例如:'https://api.example.com/_AMapService'
};

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The Java proxy example hardcodes the security key in source code immediately after the document warns against hardcoding secrets. This creates a real risk that developers will copy the pattern into production, leading to credential leakage through source control, code reviews, build artifacts, or decompilation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

在 L1009-L1017,条目标识为 isPointInBbox,参数也写明是 bbox,但说明文字却写成“判断点是否在环内”。这不是单纯信息缺失,而是把包围盒判断错误描述成环判断,属于文档意图与接口实际语义相冲突。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

L1228-L1238 中该接口描述为“计算P2P3到P1的距离。单位:米”,这表明返回结果应为数值距离;但返回类型却标成 LngLat。返回类型与接口说明直接冲突,会误导调用者对能力和输出的理解。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.