Back to skill

Security audit

Swagger V2 Retrofit Generator

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it claims, but it handles API credentials and generates app source code with too little safety guidance or input hardening.

Install only if you are comfortable reviewing generated Kotlin before it is compiled, and use it only with trusted Swagger documents. Prefer HTTPS URLs, short-lived read-only credentials, and safer secret input methods than command-line passwords or tokens. Avoid query-string API keys and avoid fetching from untrusted or internal-only URLs unless you understand the network exposure.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/fetch_swagger.py:41
Finding

Unrestricted URL Fetching Enables Server-Side Request Forgery

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fetch_swagger.py:46
Finding

Authentication Secrets Can Be Exposed Through Plaintext Transport, URLs, and Process Arguments

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_retrofit.py:516
Finding

Untrusted Swagger Fields Can Inject Arbitrary Kotlin Source into Generated Files

Content
View full analysis
str: """Generate Kotlin data class for a model.""" lines = [] # Doc comment if model.description: lines.append(f'/**') lines.append(f' * {model.description}') lines.append(f' */') lines.append(f'data class {model.name}(') # Properties props = [] for prop in model.properties: doc = f' // {prop.description}' if prop.description else '' props.append(f' val {prop.name}: {prop.type_name}{doc}') lines.append(',\n'.join(props)) lines.append(')') ``` Swagger summaries, descriptions, tags, endpoint paths, and parameter names are also inserted directly: ```python if doc_parts: lines.append(f' /**') for part in doc_parts: lines.append(f' * {part}') lines.append(f' */') # HTTP method annotation annotation = self.HTTP_METHOD_ANNOTATIONS.get(endpoint.method, '@GET') lines.append(f' {annotation}("{endpoint.path}")') # Build parameters params = [] body_param = None for param in endpoint.parameters: param_name = param.get('name', '') param_in = param.get('in', '') required = param.get('required', False) if param_in == 'path': params.append(f'@Path("{param_name}") {param_name}: {parser.get_type(param)}') elif param_in == 'query': param_type = parser.get_type(param) if not required: param_type = f'{param_type}? = null' params.append(f'@Query("{param_name}") {param_name}: {param_type}') elif param_in == 'header': param_type = parser.get_type(param) if not required: param_type = ...[truncated 3219 chars]
Remediation
View remediation
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 (41)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The implemented script accurately covers the fetching/authentication portion of the description, including HTTP retrieval of Swagger v2 docs with none/basic/bearer/api-key auth and optional file output. However, the declared primary purpose is broader and centered on generating Android Retrofit/Kotlin client code from Swagger documentation. No code generation logic exists in this chunk: it neither parses Swagger into Kotlin models nor emits Retrofit service interfaces. Therefore the description materially overstates the code's functionality, making it a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code clearly matches the core code-generation portion of the description: it reads Swagger v2 JSON, parses definitions and paths, supports endpoint filtering/search/tag selection, and generates Retrofit/Kotlin models and service interfaces. However, the declared description materially claims support for fetching Swagger docs via HTTP with multiple auth schemes. This code has no networking logic, no HTTP client usage, no URL input handling beyond a local file path or stdin, and no auth-related implementation. Therefore the description overstates key capabilities that are not present in the supplied code chunk.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill promotes fetching authenticated Swagger documents over plain HTTP without warning that Basic Auth, bearer tokens, or API keys could be transmitted in cleartext. In this context the danger is elevated because the skill specifically supports multiple credential types and demonstrates insecure http:// URLs in examples.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

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
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

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
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
使用 `scripts/generate_retrofit.py` 生成代码: