Back to skill

Security audit

美国市场政策查询Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a simple policy-query helper, but its documented API-key configuration can leak those keys in query results and cache entries.

Review this package before installing if you plan to configure real API keys. Do not place secrets in dataSources unless the implementation is changed to keep credentials out of returned policy records, logs, and cache entries. The package otherwise appears limited and non-destructive, with no dependencies or install-time hooks found.

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
index.js:85
Finding

Sensitive Data-Source Credentials Exposed in Query Results and In-Memory Cache

Content
View full analysis

Vulnerability Details

File Location: index.js, lines 85–88 and 95–124
Vulnerability Type: Sensitive information exposure through returned objects and caching
Risk Level: Medium

Vulnerable Code

javascript
// From queryPolicies(), lines 85–88
const dataSource = this.config.dataSources[category];
const policies = await this.fetchFromDataSource(dataSource, category, options);

this.policyCache.set(cacheKey, policies);
return policies;
javascript
// From fetchFromDataSource(), lines 95–124
async fetchFromDataSource(dataSource, category, options) {
  // Simulated data
  const policies = [{
    title: this.config.language === 'zh-CN' ? '${name}投资政策' : '${name} Investment Policy',
    description: this.config.language === 'zh-CN'
      ? '${name}最新投资政策和法规'
      : 'Latest investment policies and regulations in ${name}',
    effectiveDate: '2026-01-01',
    authority: this.config.language === 'zh-CN' ? '${name}政府' : '${name} Government',
    dataSource,
    keyPoints: this.config.language === 'zh-CN' ? [
      '${name}市场准入政策',
      '外商投资优惠政策',
      '行业特定法规'
    ] : [
      '${name} market access policies',
      'Foreign investment incentives',
      'Industry-specific regulations'
    ]
  }];

  return {
    country: this.t('country'),
    category: this.t('categories', category),
    totalPolicies: policies.length,
    policies: policies,
    lastUpdated: new Date().toISOString(),
    dataSource,
    language: this.config.language
  };
}

Technical Analysis

The project documentation instructs users to populate dataSources with environment-derived API keys. The implementation reads the selected value from this.config.dataSources[category] and passes it into fetchFromDataSource().

That function does not use the value solely for authentication or source access. Instead, it places the value into both:

  1. Every generated policy object as policies[0].dataSource.
  2. The top-level response as dataSource.

The complete r ...[truncated 2145 chars]

Remediation
View remediation

Remediation Suggestions

  1. Separate source endpoint configuration from authentication credentials. For example, use distinct endpoint, sourceId, and apiKey properties.
  2. Use credentials only at the point where an authenticated request is made, preferably in an authorization header. Never add credentials to policy records, return objects, error messages, or logs.
  3. Remove both dataSource fields from the returned data or replace them with a non-sensitive source identifier:
javascript
return {
  country: this.t('country'),
  category: this.t('categories', category),
  totalPolicies: policies.length,
  policies,
  lastUpdated: new Date().toISOString(),
  sourceId: category,
  language: this.config.language
};
  1. Ensure cached objects contain only sanitized response data. If credentials are ever needed during retrieval, do not retain them in cache entries.
  2. Validate category against an explicit allowlist before reading configuration values.
  3. Add automated tests that configure a unique sentinel secret, invoke every public method, serialize the results and cache values, and assert that the sentinel never appears.
  4. Apply minimum privileges and short expiration periods to all API credentials so that accidental disclosure has limited impact.
  5. Update the documentation to distinguish data-source URLs from API keys and warn that credentials must not be used as response metadata.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README shows broad trigger examples like asking the agent to monitor policy changes or analyze business risks without defining scope, data boundaries, or explicit user confirmation requirements. In an agent ecosystem, vague natural-language invocations can cause overbroad actions, unintended tool use, or retrieval from untrusted external sources, especially for a skill centered on real-time policy data and analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill sets language to zh-CN by default, which imposes a specific locale unless the caller explicitly overrides it. Under the stated policy, forcing a language without user choice or 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
91% confidence
Finding

The manifest description is written entirely in Chinese for a skill focused on U.S. market policy queries, but it does not state that language selection is optional or that the skill is intended only for Chinese-speaking users. This can violate language/locale policy expectations because it imposes a specific language presentation without user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file explicitly sets the skill language to 'zh-CN' and 'en-US' in code, which hard-codes locale behavior rather than offering user opt-in or documenting why these are the only acceptable locales. Under the policy rule, forcing a specific language or locale without user choice is a natural-language policy concern even when it appears in code usage examples.

Content

No source excerpt is available for this finding.