Back to skill

Security audit

中国法律合规AI技能包

Security checks for vulnerabilities and agentic risk

Overview

Review is recommended because the bundle claims legal data stays local, but its legal Q&A feature sends user questions to DeepSeek whenever an API key is configured.

Install only after reviewing the data-flow mismatch. Treat this as a China-law compliance toolkit that may handle confidential contracts, employee data, personal information, and legal strategy. Do not configure DEEPSEEK_API_KEY or pass --api-key unless third-party processing is approved, and avoid submitting privileged or regulated data without redaction and organizational approval. Also treat generated case-law and compliance outputs as drafts or samples, not authoritative legal research.

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
scripts/legal_qa.py:150
Finding

Undisclosed External Transmission of Potentially Sensitive Legal Questions

Content
View full analysis

Vulnerability Details

File Location: scripts/legal_qa.py:150-189; contradictory documentation at README.md:10 and SKILL.md:92
Vulnerability Type: Undisclosed third-party data transmission and misleading privacy configuration
Risk Level: Medium

Vulnerable Code

python
async def generate_llm_response(question: str, api_key: str) -> Optional[str]:
    """Generate response using LLM with legal context."""
    results = search_knowledge(question)
    context = ""

    if results:
        top = results[0]
        context = json.dumps(top["data"], ensure_ascii=False, indent=2)

    system_prompt = f"""你是一位专业的中国法律顾问,擅长用通俗易懂的语言解答法律问题。
请基于以下知识库信息回答用户问题。如果知识库中没有相关信息,明确告知。
请在回答末尾提醒用户"以上仅供参考,不构成法律意见"。

知识库信息:
{context}"""

    try:
        async with httpx.AsyncClient(timeout=30) as client:
            resp = await client.post(
                "https://api.deepseek.com/v1/chat/completions",
                headers={
                    "Authorization": f"Bearer {api_key}",
                    "Content-Type": "application/json",
                },
                json={
                    "model": "deepseek-chat",
                    "messages": [
                        {"role": "system", "content": system_prompt},
                        {"role": "user", "content": question},
                    ],
                    "temperature": 0.3,
                    "max_tokens": 1024,
                },
            )
            resp.raise_for_status()
            data = resp.json()
            return data["choices"][0]["message"]["content"]
    except Exception as e:
        print(f"[WARN] LLM调用失败: {e}")
        return None

The behavior is invoked automatically when an API key is available:

python
async def answer_question(question: str, api_key: str = "") -> str:
    """Main entry point for legal Q&A."""
    # Try LLM first if API key available

...[truncated 3065 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove or qualify the local-only claims in README.md and SKILL.md. Explicitly document:

    • DeepSeek as the data recipient
    • The API endpoint used
    • That the complete question and selected legal context are transmitted
    • When remote processing is activated
    • Relevant retention, jurisdiction, and provider-policy considerations
  2. Require explicit opt-in for each remote request rather than automatically enabling remote processing whenever an API key exists.

  3. Add an enforceable local-only mode, such as --local-only, that prevents all network requests regardless of environment configuration.

  4. Display a clear warning before transmission and advise users not to submit privileged, personal, regulated, or commercially confidential information unless external processing has been approved.

  5. Introduce data minimization and redaction controls for names, identifiers, contact details, account numbers, and other sensitive fields before constructing the external request.

  6. Avoid accepting secrets through --api-key. Prefer an environment variable, protected configuration store, operating-system keychain, or secret manager. Ensure secrets are never logged.

  7. Add network-policy controls and audit logging that record the fact and destination of remote processing without recording question contents or credentials.

  8. Provide clear organizational guidance for assessing third-party processing terms, cross-border transfer requirements, and confidentiality obligations before enabling the remote mode.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (65)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The entire skill description presents the bundle as a Chinese legal compliance package and all examples and documentation are exclusively in Chinese, with no indication that users may choose another language or locale. This creates a natural-language locale constraint that is not framed as an explicit user opt-in or clearly limited to a region-specific compliance requirement in the user interaction layer.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill bundle is designed for highly sensitive legal, labor, and data-protection workflows, yet the documentation does not warn users about handling confidential contracts, employee data, personal information, or privileged legal materials. Without clear data-handling warnings and usage boundaries, users may input regulated or confidential data into tools without understanding retention, disclosure, or access risks.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation makes a strong security claim that all data is processed locally and not transmitted, while also listing an optional DeepSeek API dependency for advanced legal Q&A. For a legal/compliance bundle that may handle contracts, employee records, and personal information, this mismatch can mislead users into sending sensitive data to an external service under false assumptions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This plain-text skill content forces a specific language/locale for all users, and there is no indication that Chinese is optional or that the file is intended only for a China-specific workflow. Under the policy, language constraints should either provide user opt-in or be clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and generated checklist are entirely in Chinese, including user-facing output and legal references, with no indication that the skill is region-specific or that users can opt into another language. This creates a natural-language policy concern because it forces a specific language/locale without user choice or explicit justification in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring and all generated report content are written exclusively in Chinese, and there is no option for the user to select another language or locale. This is a natural-language policy concern because the skill imposes a specific language without opt-in or justification as a region-specific tool.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and all generated policy text are fixed in Chinese, which imposes a specific language on users without any opt-in or alternative. Under the policy, forced language or locale behavior is a natural-language violation unless the constraint is explicitly offered as a choice or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The disclaimer claims the results are based on a public judgment-document database, but the code only searches a hard-coded local case list. This is a misleading provenance claim that can cause users to overtrust the completeness, freshness, and authority of the legal output, especially in legal decision-making contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file embeds all user-facing checklist content in Chinese, and the module title also uses Chinese text. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified; no such opt-in or justification appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python skill contains user-facing natural-language descriptions entirely in Chinese, including the module description and usage instructions, and does not provide any language selection or opt-in. Under the policy, forcing a specific language without user choice is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring states that the script generates an internal compliance audit checklist 'based on enterprise type and industry' and the usage syntax emphasizes a required --type parameter. In the implementation, --type is not used to model enterprise type at all; it is simply assigned to the scope variable as an alias, and no industry handling exists, so the documentation materially misrepresents the program's behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file contains natural-language instructions and descriptions only in Chinese, including the module docstring and CLI usage text. Because the skill does not offer the user a language/locale option and does not explain that it is intentionally limited to a Chinese-speaking or China-specific compliance context, it violates the language/locale policy criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s docstring, default topic, and all generated training material are hardcoded in Chinese, with no option for users to choose another language or locale. The stated policy flags language/locale constraints when they are forced without user opt-in or clear justification.

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's docstring and all generated user-facing content are written in Chinese, and there is no option for the user to choose another language or indication that the skill is intentionally limited to a Chinese-speaking or China-specific deployment context. This creates a natural-language policy concern because it imposes a specific language/locale without user opt-in.

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-level docstring names the skill in Chinese, and all user-facing messages and generated contract content in the code are Chinese-only. There is no indication that the skill is region-specific or that users can choose another language, which creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The docstring defines the skill ID, name, module, and purpose entirely in Chinese, and the returned content is also Chinese-first. Under the policy, forcing a specific language is a natural-language policy issue unless the skill offers language choice or clearly documents a justified locale constraint, which this file does not.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module description and usage text are written entirely in Chinese, and the skill's user-facing behavior later also emits Chinese-only messages. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation unless the constraint is explicitly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This Python file contains natural-language strings entirely in Chinese, including the skill docstring and all user-facing result fields/status messages. Under the policy, forcing a specific language without user opt-in is a language/locale violation unless the locale restriction is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file includes its primary description, usage text, and operational messaging entirely in Chinese, which imposes a specific language on users by default. The policy for natural-language violations applies to all file types, and there is no opt-in, alternative locale, or justification that this skill is intended only for a Chinese-language or region-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code includes natural-language metadata and user-facing messages entirely in Chinese, such as the skill title and the error response, with no indication that language selection is optional. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file includes natural-language documentation and runtime messages entirely in Chinese, including the module docstring and CLI usage text. The skill does not offer a language/locale option or explain that it is intentionally limited to Chinese contracts, which conflicts with the policy requirement to avoid forcing a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file’s natural-language metadata and all user-facing messages are exclusively in Chinese, indicating a fixed language choice. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation unless clearly justified as region-specific, which is not documented here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code includes natural-language strings such as the skill description and error message entirely in Chinese, and there is no indication that the skill is region-specific or that users can opt into the locale. That can violate language/locale policy because it forces a specific language experience by default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill identifier and description are written as '合同模板生成', and all built-in templates and user-facing result fields are hardcoded in Chinese. There is no indication that the skill is region-specific or that users can choose another language, which creates a locale-policy issue under the natural-language policy rules.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language strings entirely in Chinese, including the module description and generated report content. Under the policy rule, forcing a specific language without user opt-in is a language/locale policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.