T09 · Insecure Skill Coding Practices
- Location
scripts/db_query.py:547- Finding
Hardcoded Database Credentials Expose Sensitive Test Data
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill’s database-testing purpose is coherent, but it ships live-looking database credentials and business identifiers and includes unsafe database/file-write paths.
Review before installing. Treat the embedded database password and taxpayer identifier as exposed, rotate the credential, replace examples with environment variables or a secret manager, use a read-only least-privilege account, add parameterized SQL, and avoid exporting real invoice or taxpayer data unless explicitly approved.
scripts/db_query.py:547Hardcoded Database Credentials Expose Sensitive Test Data
scripts/db_query.py:171SQL Injection Through Direct Placeholder Substitution
scripts/db_query.py:120Write-Capable Database Interface Exceeds the Skill's Read-Only Requirements
scripts/db_query.py:83Database Connections Do Not Require Certificate-Validated TLS
SKILL.md:63Third-Party Database Drivers Are Installed Without Version or Integrity Pinning
The declared purpose says the skill is for database querying and validation, but the content also supports fixture injection, automated test-case generation, batch export, and includes live credentials. This mismatch materially increases risk because a reviewer or orchestrator may grant broader trust than warranted, while the skill can access and persist production-like data beyond simple querying.
The documentation contains plaintext database host, username, password, database name, and a business tax identifier. Exposing live credentials and business identifiers can directly enable unauthorized database access, data theft, tampering, or lateral movement, especially because the skill's context is specifically to connect and query that database.
The skill exposes live database access details and sensitive test data context without any warning about privacy, authorization, or system access risks. In a database-query skill, this omission is especially dangerous because users may treat the examples as safe defaults and access or disclose regulated business data without proper controls.
The usage example repeats the same live plaintext credentials in runnable sample code, making accidental reuse and credential scraping even more likely. Because these examples are designed to be copied verbatim, they increase the chance of direct unauthorized access and normalize insecure secret handling.
The fixture example propagates the same hardcoded credentials into a workflow that injects real database data into tests. This expands the blast radius from simple disclosure to automated extraction and reuse of sensitive records in downstream test artifacts and systems.
The later generator example again exposes real credentials and also hardcodes a real-looking tax number, tying secret access to identifiable business data. In this context, the skill is not merely generic documentation; it provides enough information to authenticate and query a specific dataset, which significantly heightens exploitation risk.
The skill is presented as query-oriented, but DatabaseClient exposes a generic execute() method that can run INSERT/UPDATE/DELETE and commit changes. In an agent skill context, this expands the trust boundary from read-only data access to destructive database modification, increasing the risk of unintended or unauthorized writes if other components invoke it.
The standalone example embeds what appear to be real database host, username, password, database name, and a real-looking tax identifier directly in source code. Hardcoded credentials can be harvested from the repository or package and used to access live systems and sensitive data, especially dangerous here because the skill connects to external databases and generates artifacts from real records.
These lines contain hard-coded database connection secrets without any disclosure or protection mechanism. Anyone with access to the code can recover the credentials and potentially query or modify a live database, leading to data exposure, compliance violations, or downstream compromise.
The skill demonstrates file-writing capability via gen.export_as_json("generated_cases.json") but does not declare any tool scope or permissions. Undeclared capabilities make the skill harder to sandbox and review, and can lead users or agents to persist sensitive database-derived data unexpectedly.
The example exports generated cases to JSON without warning that the file may contain database-derived sensitive data or may overwrite existing files. Because the generated test cases include mapped real invoice and tax data, silent persistence can create secondary data leaks on disk, in source control, or in shared workspaces.
Natural-language content throughout the file, including module documentation and later user-visible log strings, is written in Chinese only. There is no indication that the skill is region-specific or that users can opt into this locale, which conflicts with the policy against forcing a specific language without user choice or justification.
The DatabaseClient automatically connects to MySQL or PostgreSQL during initialization and later executes queries against the configured database. While the module describes its purpose, it does not clearly warn users that running the code will establish external database connections and may access real production-like invoice and tax data.
The manifest describes this as a database query skill for connecting to databases, executing SQL, retrieving test data, and validating interface responses. However, the code goes beyond query-oriented behavior by implementing a full TestCaseGenerator that constructs API test-case objects and can write them out as JSON files, which is a broader testing/fixture-generation function than the manifest states.
The export function writes generated cases, which may include sensitive fields derived from production-like database records, to an arbitrary file path without safeguards. In a testing skill context, this can cause inadvertent local persistence of tax numbers, invoice identifiers, or other business data where filesystem access is broader or retention is uncontrolled.