Back to skill

Security audit

api-test-reporter

Security checks for vulnerabilities and agentic risk

Overview

The skill is an API testing/reporting tool, but it publishes real-looking database credentials and can run broad database-backed tests while saving sensitive request and response data without redaction.

Review before installing. Rotate the exposed database password if it was ever valid, replace examples with placeholders, run only against approved staging systems, use least-privilege read-only database accounts, restrict fixture SQL to reviewed SELECT queries, redact secrets and personal/business data from generated reports, and pin dependencies or bundle report assets locally.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:117
Finding
Plaintext Database Credentials Embedded in Skill Documentation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:117-122` **Vulnerability Type**: Hard-coded secret exposure **Risk Level**: High ### Vulnerable Code ```json "db_fixture": { "connection": { "host": "10.115.96.247", "port": 3306, "user": "jxindependent", "password": "Xj2zCkLJXTkEJ5j", "database": "jxindependent0", "charset": "utf8mb4" }, ``` ### Technical Analysis The skill documentation contains a concrete internal database address, username, database name, and plaintext password. These are not presented as generic placeholders, unlike values such as `db_user` and `db_password` elsewhere in the project. Secrets committed to documentation are exposed to every user, artifact system, source-code mirror, backup, and log with access to the package. Removing the credential in a later revision is insufficient if previous versions remain in source-control history or artifact caches. ### Attack Path 1. An attacker obtains the skill package, a repository copy, or a cached artifact. 2. The attacker reads `SKILL.md` and extracts the database host, username, password, and database name. 3. The attacker attempts to reach the internal database directly, through a compromised internal host, or through an available network tunnel. 4. If the credential remains valid, the attacker authenticates to MySQL. 5. The attacker accesses or modifies any database resources permitted to that account. ### Impact Assessment Successful exploitation grants the privileges assigned to the exposed database account. Depending on its grants, this could include disclosure of invoice or customer records, modification or deletion of business data, enumeration of database structure, and access to additional secrets stored in the database. Password reuse could extend the compromise to other services. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Immediately revoke and rotate the exposed database password. 2. Review authentication and database audit logs for use of the exposed account. 3. Replace all concrete connection information with unmistakable placeholders. 4. Store credentials in environment variables or an approved secret manager rather than test configurations or documentation. 5. Create a dedicated read-only fixture account restricted to the required schema, tables, source networks, and query operations. 6. Scan repository history, release artifacts, caches, and documentation mirrors for earlier copies. 7. Enable automated secret scanning in pre-commit and continuous-integration workflows. 8. Do not treat deletion from the current revision as sufficient remediation; assume the exposed credential is compromised. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_api_test.py:97
Finding
Arbitrary Configuration-Supplied SQL Execution Against the Fixture Database<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run_api_test.py:97-105` **Vulnerability Type**: Unrestricted SQL execution **Risk Level**: High ### Vulnerable Code ```python for q in queries: name = q.get("name", "unnamed") sql = q.get("sql", "") mapping = q.get("mapping", {}) if not sql: continue try: cur.execute(sql) row = cur.fetchone() ``` ### Technical Analysis The runner obtains an entire SQL statement from `db_fixture.queries[].sql` and passes it directly to `cur.execute`. It does not enforce read-only statements, parse or validate the SQL, start a read-only transaction, restrict permitted schemas, or request confirmation before execution. This is not conventional string-concatenation SQL injection because the configuration intentionally supplies a complete statement. Nevertheless, it creates an arbitrary SQL execution boundary: anyone who can provide or modify a test configuration can execute SQL with the database account's privileges when an operator invokes the documented test command. The fixture feature only requires sample-data retrieval, so permitting data-definition and data-modification statements exceeds its legitimate operational need. ### Attack Path 1. An attacker creates or modifies a test configuration accepted by `run_api_test.py`. 2. The attacker inserts a destructive or unauthorized statement into `db_fixture.queries[].sql`, such as an `UPDATE`, `DELETE`, or `DROP` statement. 3. The attacker convinces an operator or automation job to run the configuration with valid database credentials. 4. `load_db_fixture` connects to the configured database. 5. The statement is passed unchanged to `cur.execute`. 6. The database performs all operations allowed by the configured account and server transaction settings. ### Impact Assessment The attainable scope equals the privileges of the configured MySQL account. A broadly privileged account could allow unauthorized reads, bulk modif ...[truncated 250 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Use a dedicated database account that has only `SELECT` permission on explicitly required tables or views. 2. Validate statements with a proper SQL parser and reject every statement that is not a single read-only `SELECT`. 3. Reject multi-statement input, comments used to obscure statement boundaries, data-definition statements, data-modification statements, stored-procedure calls, and access to unapproved schemas. 4. Start fixture operations in a database-enforced read-only transaction where supported. 5. Prefer predefined, reviewed query identifiers over arbitrary SQL supplied in configuration. 6. Add an allowlist of accessible schemas, tables, and columns. 7. Require an explicit command-line option to enable database fixtures rather than activating them solely because a configuration node exists. 8. Fail closed if validation, database connectivity, or fixture loading fails; do not silently continue with unresolved placeholders. 9. Log query identifiers and hashes for audit purposes without logging returned sensitive values. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/generate_report.py:36
Finding
Generated Reports Load Remote Executable JavaScript Without Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_report.py:36,237` and `scripts/report_template.html:7,208` **Vulnerability Type**: Unverified remote dependency loading **Risk Level**: Medium ### Vulnerable Code ```html <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> ``` ```html <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> ``` The same remote references are present in both the embedded template in `generate_report.py` and the standalone `report_template.html`. ### Technical Analysis Generated local reports load Bootstrap JavaScript and CSS from a third-party CDN. The references do not include Subresource Integrity hashes or an accompanying restrictive Content Security Policy. Opening the report therefore initiates an external connection and trusts code supplied at viewing time rather than code included and reviewed with the skill. If CDN delivery, dependency publication, DNS resolution, TLS trust, or the client environment is compromised, altered JavaScript can execute in the report's browser context. The report context is sensitive because `__REPORT_DATA__.js` contains complete API request and response content. The remote dependency also contradicts the documentation's assertion that report CSS and JavaScript are fully embedded. ### Attack Path 1. The test runner produces an HTML report and `__REPORT_DATA__.js`. 2. A user opens the report while network access is available. 3. The browser requests Bootstrap assets from `cdn.jsdelivr.net`. 4. An attacker compromises or substitutes the delivered script through a supply-chain or network trust failure. 5. The altered script executes in the report document. 6. The script reads rendered report data or the global `reportData` variable and may transmit it to an attacker-controlled endpoint. ### Impact Assessment Exploitation could disclose all API requests, responses, database ...[truncated 319 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Bundle reviewed Bootstrap assets locally with the skill, or replace them with the existing embedded styling. 2. Remove Bootstrap JavaScript if the report does not require its runtime components. 3. If remote delivery is unavoidable, use an immutable versioned asset and add verified `integrity` and `crossorigin` attributes. 4. Add a restrictive Content Security Policy that limits scripts and connections to the minimum required sources. 5. Prefer a fully offline report so opening it never sends network requests. 6. Keep the embedded and standalone report templates synchronized so remediation applies to both. 7. Document any remaining external network behavior accurately. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_api_test.py:419
Finding
Complete API Requests, Responses, and Fixture Values Are Persisted Without Redaction<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run_api_test.py:419-427,471-472` and `scripts/generate_report.py:475-490` **Vulnerability Type**: Plaintext sensitive-data storage **Risk Level**: Medium ### Vulnerable Code ```python results.append({ "id": tc["id"], "group": tc.get("group", "未分组"), "name": tc["name"], "desc": tc.get("desc", ""), "request_url": url, "request_body": body, "expect": tc.get("expect", {}), "response_status": resp["status_code"], "response_body": resp["body"], ``` ```python with open(json_path, "w", encoding="utf-8") as f: json.dump(results, f, ensure_ascii=False, indent=2, default=str) ``` The report generator then duplicates the data into an executable JavaScript file: ```python json_str = json.dumps(data, ensure_ascii=False, indent=2, default=str) with open(js_path, "w", encoding="utf-8") as f: f.write("var reportData = ") f.write(json_str) f.write(";\n") with open(output_path, "w", encoding="utf-8") as f: f.write(HTML_TEMPLATE) ``` ### Technical Analysis The runner records complete request bodies and parsed response bodies. Database fixture values substituted into a request become part of the persisted request body. The same information is written to both a JSON result file and `__REPORT_DATA__.js`. No configurable redaction, sensitive-key detection, restrictive permission mode, encryption, retention policy, or user warning is applied. As a result, authentication tokens, customer information, invoice details, account identifiers, and other confidential data may be stored in plaintext. The `.js` output is also executable content rather than a passive data format. ### Attack Path 1. A test case includes a secret or personal value directly or obtains one from the fixture database. 2. The runner sends the request and receives potentially sensitive response data. 3. The complete request and response are added to the `results` structure. 4. The runner writes ...[truncated 748 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Add configurable redaction for keys such as `password`, `secret`, `token`, `authorization`, `cookie`, `apiKey`, and project-specific sensitive fields. 2. Apply redaction recursively before data is logged or added to the report structure. 3. Provide options to omit request bodies, response bodies, raw responses, or database fixture values. 4. Create output files with restrictive permissions, such as owner read/write only, where the operating system supports it. 5. Warn users before generating a report that contains unredacted production data. 6. Avoid using production credentials or production personal data for routine testing. 7. Define retention and secure-deletion requirements for generated artifacts. 8. Consider encrypted report storage when sensitive content must be retained. 9. Generate unique data filenames per report rather than repeatedly using the shared `__REPORT_DATA__.js` name in a common directory. ]]>

T08 · Insecure Dependencies

Note
Location
SKILL.md:221
Finding
Python Dependencies Are Installed Without Version or Hash Pinning<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:221-223` **Vulnerability Type**: Unpinned third-party dependencies **Risk Level**: Low ### Vulnerable Code ```bash pip install requests pymysql ``` The same unpinned installation pattern is documented in `references/workflow.md:112-115`. ### Technical Analysis The installation instructions retrieve whichever versions of `requests`, `pymysql`, and their transitive dependencies satisfy the package resolver at installation time. No lock file, exact version, package hash, or reviewed artifact source is provided. This makes installations non-reproducible and allows the effective third-party code to change after the skill itself has been audited. Although no malicious package is presently identified in the project, mutable dependency resolution increases exposure to compromised releases, dependency substitution, and future incompatible or vulnerable versions. ### Attack Path 1. A user follows the documented installation command. 2. `pip` queries the configured package index and resolves current package versions. 3. A compromised package release, package index, mirror, or dependency is selected. 4. Package installation hooks or imported runtime code execute in the user's environment. 5. The compromised dependency gains the permissions of the user running installation or the test tool. ### Impact Assessment The possible impact depends on the compromised dependency and the privileges used during installation. It can include arbitrary code execution, theft of API or database credentials, modification of test results, access to local files, and compromise of the environment running the skill. Installing as an administrator would increase the affected scope. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Provide a dependency lock file containing exact reviewed versions. 2. Use `--require-hashes` with verified hashes for direct and transitive dependencies. 3. Install dependencies in an isolated virtual environment under a non-privileged account. 4. Use a trusted, controlled package index or internal mirror. 5. Scan dependencies for known vulnerabilities and review version upgrades before adoption. 6. Add automated lock-file maintenance and security review to the release process. 7. Update all installation examples so users do not bypass the locked dependency process. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (13)

Missing User Warnings

High
Confidence
96% confidence
Finding
The skill explicitly instructs the agent to pull real values from a database, send them to HTTP endpoints, and include full request/response data in generated reports, but provides no user warning or consent gate for handling sensitive data. In this context, that can expose credentials, tax identifiers, invoice data, and live business records to external services and to persistent local artifacts such as HTML and JS report files.

Vague Triggers

Medium
Confidence
89% confidence
Finding
This markdown skill lists trigger phrases such as "生成测试报告" and "逐个验证参数", which are broad enough to overlap with common requests outside this specific API-testing skill. The description does not provide negative examples or tighter activation constraints to distinguish when the skill should or should not activate.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The natural-language comments and labels are written entirely in Chinese, indicating the skill configuration is intended to be used in a single language without any opt-in or alternative locale. Under the policy, forcing a specific language without user choice or a documented regional justification is a natural-language policy concern.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The document describes automatically generating and executing API tests against a configurable base URL and collecting results, but it does not warn about targeting staging-only environments or the possible effects on live systems. Without such guardrails, users may unintentionally send bulk or malformed test traffic to production endpoints, causing data corruption, operational noise, or service disruption.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The workflow explicitly instructs the test runner to connect to MySQL, execute configured SQL queries, and pull real values into API tests, but it provides no warning to avoid production systems, minimize sensitive data access, or protect credentials. In a testing skill, this omission can lead users to run queries against live databases and expose customer or business data in logs, reports, or downstream requests.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The script supports connecting to a real MySQL instance using provided credentials and executing arbitrary configured SQL to pull production-like data into test requests. In this skill context, that increases the chance of exposing sensitive database contents into logs, reports, or downstream HTTP requests, especially because there are no environment restrictions, query safeguards, or masking controls.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
This code sends API requests using user-supplied configuration and request bodies, which can include business or system data, but there is no user-facing disclosure at the point of transmission beyond generic test-run output. The surrounding docstring describes functionality, but it does not warn that request payloads and target URLs will be transmitted over the network to the configured endpoint.

External Transmission

Medium
Category
Data Exfiltration
Content
if http_method.upper() == "GET":
            resp = requests.get(url, params=body, headers=headers, timeout=timeout)
        else:
            resp = requests.post(url, json=body, headers=headers, timeout=timeout)
        try:
            return {"status_code": resp.status_code, "body": resp.json(),
                    "raw": resp.text, "error": None}
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The tool persists full request bodies and response bodies to JSON and HTML reports, which can include credentials, personal data, tokens, invoices, or other sensitive business data returned from real APIs. In this testing context, the risk is elevated because the script also supports loading real database values and transmitting them to live services, so the saved artifacts can become a durable local data leak.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
report_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), "generate_report.py")
    if os.path.exists(report_script):
        import subprocess
        subprocess.run(
            [sys.executable, report_script,
             "--results", json_path,
             "--output", html_path,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The HTML declares `lang="zh-CN"`, which fixes the report to a specific language/locale. The policy for this audit flags locale constraints when the skill does not offer user opt-in or explain why the report must be Chinese.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
Visible strings such as the title, loading text, labels, and error messages are all written in Chinese, indicating the skill forces one language for generated output. There is no evidence in this file of a user-selectable language option or documented regional scope.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
The file's user-facing docstring and command guidance are entirely in Chinese, with no indication that another language is available or that the locale is intentionally constrained. Under the stated policy, user-facing language constraints should be optional or clearly justified.

Static analysis

Detected: suspicious.dynamic_code_execution, suspicious.install_untrusted_source

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/run_api_test.py:495

Install source points to URL shortener or raw IP.

Warn
Code
suspicious.install_untrusted_source
Location
references/test_config.example.json:6