T09 · Insecure Skill Coding Practices
- Location
examples.md:118- Finding
Shell Command Injection Through Unsafely Interpolated Firestore Input
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is transparent about using Google Cloud credentials for Firestore CRUD, but its curl-based command construction creates a real review-worthy risk around shell injection and high-impact database actions.
Review this skill before installing. Use it only with a dedicated least-privilege service account and a non-production or tightly scoped project. Carefully inspect generated curl commands, especially any values containing quotes, dollar signs, backticks, newlines, semicolons, ampersands, or unusual path/query characters, because the current examples do not provide strong shell-injection safeguards.
examples.md:118Shell Command Injection Through Unsafely Interpolated Firestore Input
The skill is designed to obtain and use live OAuth access tokens from the local gcloud context, which grants the skill direct access to whatever Firestore permissions the active identity holds. Even though the document includes warnings and recommends service accounts, the mechanism still exposes a high-value credential path that could enable unauthorized data access or modification if the agent mishandles commands, context, or output.
## Credentials & Environment
This skill uses OAuth 2.0 access tokens generated by `gcloud auth print-access-token`. The token is valid for a limited time (typically 1 hour) and inherits the permissions of the authenticated Google Cloud account.
This skill must run only with a dedicated service account context. Do not use personal user credentials or broad admin identities.
This line provides a concrete command for generating a fresh access token and storing it in an environment variable, making credential acquisition operationally trivial. In the context of an agent skill with command execution capability, that creates a real risk of credential misuse, accidental disclosure, or use against the wrong project if safeguards fail.
This skill must run only with a dedicated service account context. Do not use personal user credentials or broad admin identities.
Before any operation, generate a fresh access token:
ACCESS_TOKEN=$(gcloud auth print-access-token)
Embedding token generation as a mandatory workflow step normalizes credential retrieval for every operation, including reads, which broadens opportunities for sensitive data access. Because the token inherits all permissions of the active Google Cloud account, any mistake in account selection, project targeting, or downstream command handling can have significant impact on confidentiality and integrity.
Check active context — Run gcloud config list --format='text(core.account,core.project)' to display the active account and project. Present this to the user so they are aware of which credentials and project will be used.
Generate access token — Always start by obtaining a fresh access token:
ACCESS_TOKEN=$(gcloud auth print-access-token)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
gcloud config list --format='text(core.account,core.project)'
## Access Token
Before any Firestore API request, generate a fresh access token:
```bash
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Before any Firestore API request, generate a fresh access token:
ACCESS_TOKEN=$(gcloud auth print-access-token)
Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.
- **Use proper JSON formatting** — Firestore requires specific field value types (stringValue, booleanValue, integerValue, etc.).
- **Document ID generation** — When creating documents, if you don't specify `?documentId=YOUR_ID` in the URL, Firestore will automatically generate a unique document ID.
- **Include field paths in updateMask** — When updating, use `updateMask.fieldPaths` to specify which fields to update.
- **Never execute any command autonomously** — always present the full curl command to the user and wait for explicit approval before running it, including read-only operations.
- **Parse responses carefully** — Firestore returns data in a nested format with typed values.
- **Verify project ID** — Always confirm you're targeting the correct project before executing commands.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
Expected agent behavior:
gcloud config list --format='text(core.account,core.project)' and show the active context to the usermy-project)ACCESS_TOKEN=$(gcloud auth print-access-token)
No suspicious patterns detected.