T09 · Insecure Skill Coding Practices
- Location
SKILL.md:51- Finding
OAuth Credentials Exposed Through Command-Line Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent Gmail helper, but it needs Review because it can send, read, and modify email using powerful Gmail credentials without enough confirmation, scoping, or credential-safety guidance.
Install only if you are comfortable giving the skill access to send, read, and modify your Gmail. Use the narrowest OAuth scopes you can, avoid long-lived refresh tokens unless necessary, keep tokens out of prompts and logs, and require manual confirmation before any send, reply, label change, or bulk mailbox action.
SKILL.md:51OAuth Credentials Exposed Through Command-Line Arguments
SKILL.md:270Overly Broad Google Network Policy Exceeds Runtime Requirements
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## Setup
### Option 1: OAuth2 Access Token (recommended)
1. Create OAuth2 credentials at https://console.cloud.google.com/apis/credentials
2. Enable the Gmail API at https://console.cloud.google.com/apis/library/gmail.googleapis.com
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. Create OAuth2 credentials at https://console.cloud.google.com/apis/credentials
2. Enable the Gmail API at https://console.cloud.google.com/apis/library/gmail.googleapis.com
3. Obtain an access token via OAuth2 flow with scopes:
- `https://www.googleapis.com/auth/gmail.send`
- `https://www.googleapis.com/auth/gmail.readonly`
- `https://www.googleapis.com/auth/gmail.modify`
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
1. Create OAuth2 credentials at https://console.cloud.google.com/apis/credentials
2. Enable the Gmail API at https://console.cloud.google.com/apis/library/gmail.googleapis.com
3. Obtain an access token via OAuth2 flow with scopes:
- `https://www.googleapis.com/auth/gmail.send`
- `https://www.googleapis.com/auth/gmail.readonly`
- `https://www.googleapis.com/auth/gmail.modify`
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- Gmail API rate limit: 250 quota units per second per user.
- Sending has a daily limit of 2,000 messages for Google Workspace, 500 for free Gmail.
- Access tokens expire after ~1 hour. Use refresh token flow for long-running sessions.
- Attachments require multipart MIME encoding — for large files, use the resumable upload endpoint.
## Examples
The skill is user-invocable and performs high-impact actions such as sending mail, replying, drafting, and modifying labels, yet it lacks an upfront requirement for confirmation before state-changing operations. That makes accidental or socially engineered email actions more likely, especially when prompts are ambiguous or maliciously crafted.
The setup section instructs users to provide powerful Gmail credentials and refresh tokens but does not warn about their sensitivity, scope minimization, storage handling, or the risks of long-lived tokens. This increases the chance of insecure deployment and overprivileged access to a mailbox.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
All API calls use Bearer auth:
curl -s -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
"https://gmail.googleapis.com/gmail/v1/users/me/..."
The skill expands from Gmail operations into arbitrary web searching and page fetching, which is outside the declared Gmail-only scope. That creates unnecessary data egress and prompt-surface expansion: email content or user-provided topics could be sent to third-party sites, and fetched content could influence generated emails in unsafe ways.
A Gmail management skill does not need general web browsing to fulfill its core purpose, so this capability materially broadens attack surface without justification. It enables unintended external transmission of user prompts or email-derived content to arbitrary websites and introduces untrusted content into downstream email composition.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
ENCODED=$(echo -n "$RAW_MESSAGE" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
# Send
curl -s -X POST \
-H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
"https://gmail.googleapis.com/gmail/v1/users/me/messages/send" \
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
ENCODED=$(echo -n "$RAW_MESSAGE" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
# Send
curl -s -X POST \
-H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
"https://gmail.googleapis.com/gmail/v1/users/me/messages/send" \
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
ENCODED=$(echo -n "$RAW_MESSAGE" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
curl -s -X POST \
-H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
"https://gmail.googleapis.com/gmail/v1/users/me/drafts" \
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"https://gmail.googleapis.com/gmail/v1/users/me/labels" | jq '.labels[] | {name, id}'
# Add label to a message
curl -s -X POST \
-H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
"https://gmail.googleapis.com/gmail/v1/users/me/messages/{MESSAGE_ID}/modify" \
The proposed network policy grants broad GET/POST access to accounts.google.com, but the documented flows only require Gmail API and token refresh endpoints. Overbroad egress permissions increase the chance of unintended authentication interactions, data leakage, or abuse if the skill or surrounding agent is prompted to access unrelated Google account pages.