Back to skill

Security audit

Bigquery Optimizer

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent BigQuery cost-analysis skill, but users should treat exported query, user, and billing metadata as sensitive before sharing it.

Install only if you are comfortable preparing BigQuery metadata for analysis. Before pasting results, review them locally and redact full SQL literals, user or service-account emails, project and dataset names, billing account identifiers, customer data, tokens, keys, and any other sensitive values.

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
SKILL.md:23
Finding
Collection of Unredacted BigQuery Query and Billing Metadata<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 23–35 **Vulnerability Type**: Excessive collection and potential disclosure of sensitive cloud metadata **Risk Level**: Medium ### Vulnerable Code ```markdown 1. **INFORMATION_SCHEMA.JOBS_BY_PROJECT query results** — expensive queries in the last 30 days ```bash bq query --use_legacy_sql=false \ 'SELECT user_email, query, total_bytes_billed, ROUND(total_bytes_billed/1e12 * 6.25, 2) as cost_usd, creation_time FROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT WHERE DATE(creation_time) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY) ORDER BY total_bytes_billed DESC LIMIT 50' ``` 2. **BigQuery storage usage per dataset** — to identify large datasets ```bash bq query --use_legacy_sql=false \ 'SELECT table_schema as dataset, ROUND(SUM(size_bytes)/1e9, 2) as size_gb FROM `project`.INFORMATION_SCHEMA.TABLE_STORAGE GROUP BY 1 ORDER BY 2 DESC' ``` 3. **GCP Billing export filtered to BigQuery** — monthly BigQuery costs ```bash gcloud billing accounts list ``` ``` ### Technical Analysis The skill directs users to export and submit complete BigQuery job SQL, user email addresses, dataset names, and billing-account metadata. These fields exceed the minimum information necessary for many cost-optimization tasks. The `query` field can contain sensitive literals embedded in SQL statements, including customer identifiers, email addresses, internal project or table names, access tokens, or other application data. The `user_email` field directly exposes user or service-account identities. Dataset names may disclose internal system structure or business functions. The command `gcloud billing accounts list` enumerates billing-account identifiers and display names but does not provide the requested monthly BigQuery cost data. It therefore introduces unnecessary metadata exposure without directly satisfying the stated analysis objective. Although the skill later tells th ...[truncated 1827 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Apply data minimization by removing `user_email` from the requested query unless identity-level attribution is explicitly required. 2. Do not request complete raw SQL by default. Prefer query hashes, normalized query patterns, destination table metadata, bytes billed, execution count, and timestamps. 3. If SQL text is required, instruct users to redact: - String and numeric literals - Email addresses and account identifiers - Project, dataset, and table names where feasible - Tokens, keys, passwords, and connection strings - Customer, tenant, or personal information 4. Replace `gcloud billing accounts list` with an aggregated billing-export query that returns only BigQuery cost totals for the relevant period and excludes billing-account identifiers. 5. Place the redaction warning before all export commands rather than checking only after data has been submitted. 6. Provide a minimal safe schema for submitted data, such as: - Sanitized query fingerprint - Total bytes billed - Execution count - Creation date rounded to the day - An anonymized principal identifier, if attribution is necessary 7. Explicitly tell users to inspect generated files locally before uploading or pasting them. 8. Recommend using synthetic or anonymized samples whenever raw production query text is unnecessary. ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The manifest claims 'credentials: none — user provides exported data', yet the documented workflow depends on IAM roles and authenticated CLI access to query BigQuery metadata. This mismatch can mislead users, reviewers, or policy engines about the real access requirements and data exposure involved, undermining informed consent and safe deployment decisions.

Intent-Code Divergence

Medium
Confidence
93% confidence
Finding
The skill states it is 'instruction-only' and does not access the user's GCP account, but it directly tells the user to run authenticated `bq` and `gcloud` commands in their own environment. This is a deceptive trust-boundary issue: users may believe the workflow is fully offline/export-based when it actually relies on live access to cloud metadata and billing context, increasing the chance they execute commands without appreciating the account exposure.

Static analysis

No suspicious patterns detected.