T09 · Insecure Skill Coding Practices
- Location
SKILL.md:360- Finding
Unredacted Database Query Plans May Be Disclosed to an External Service
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 360–380
Vulnerability Type: Sensitive information transmitted to a third-party API without redaction or explicit consent
Risk Level: MediumVulnerable Code
python SKILLBOSS_API_KEY = os.environ["SKILLBOSS_API_KEY"] API_BASE = "https://api.heybossai.com/v1" def pilot(body: dict) -> dict: r = requests.post( f"{API_BASE}/pilot", headers={"Authorization": f"Bearer {SKILLBOSS_API_KEY}", "Content-Type": "application/json"}, json=body, timeout=60, ) return r.json() # AI-assisted query analysis through the SkillBoss API Hub chat capability def analyze_slow_query(query_plan: str) -> str: result = pilot({ "type": "chat", "inputs": { "messages": [ {"role": "user", "content": f"Analyze this PostgreSQL query plan and suggest optimizations:\n{query_plan}"} ] }, "prefer": "balanced" }) return result["result"]["choices"][0]["message"]["content"]Technical Analysis
The example submits the complete
query_planvalue tohttps://api.heybossai.com/v1/pilot. Production query plans can expose SQL text, schema names, table and column names, business logic, tenant identifiers, literal query values, cardinality information, and other sensitive operational metadata.The Skill does not require redaction, content minimization, user confirmation, destination allowlisting, or review of the third party's retention and privacy terms before transmission. External disclosure is not essential to the Skill's core database-optimization functionality because query plans can be analyzed locally. Consequently, this behavior exceeds the minimum network privileges needed for the declared functionality.
The API key is read from an environment variable and used as an authorization credential for the declared endpoint. There ...[truncated 1234 chars]
- Remediation
View remediation
Remediation Suggestions
- Make local query-plan analysis the default and treat external analysis as an optional feature.
- Require explicit, informed user confirmation immediately before transmitting database information.
- Redact SQL literals, comments, tenant identifiers, personal data, secrets, and sensitive schema identifiers before submission.
- Send only the minimum plan fragments necessary for analysis rather than the complete plan.
- Restrict outbound requests to an explicitly configured and allowlisted HTTPS endpoint.
- Clearly document what information is transmitted, the receiving party, applicable retention policies, and privacy implications.
- Add a validation step that rejects content resembling credentials, tokens, connection strings, or regulated data.
- Add
r.raise_for_status()and robust response validation so error responses are not silently treated as valid API output. - Provide a preview of the sanitized payload so users can inspect it before approving transmission.
- Avoid submitting production plans unless they have been generated with sensitive values removed or replaced.
