T09 · Insecure Skill Coding Practices
- Location
gmail_to_calendar.py:322- Finding
Entire Gmail Message Body Is Replicated to Google Calendar and Standard Output
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does the advertised Gmail-to-Calendar workflow, but it also asks for broad email/account authority and handles private email content and API keys in risky ways.
Install only if you are comfortable giving this skill access to sensitive Gmail and Calendar data through Maton. Prefer using dry-run first, review the event payload before creating anything, avoid emails with confidential thread history, and do not source or print the .env file; use a safer secret store or tightly permissioned environment variable instead.
gmail_to_calendar.py:322Entire Gmail Message Body Is Replicated to Google Calendar and Standard Output
SKILL.md:27Documentation Encourages Plaintext Secret Exposure and Shell Execution of the Environment File
The skill instructs operators to store a long-lived API key in a local .env file within the skill directory and then load it into execution contexts. Storing credentials in plaintext in a predictable path increases the risk of accidental exposure to other tools, logs, backups, or overly broad file-read capabilities.
This skill also includes a bundled helper script, `gmail_to_calendar.py`, for a tested Gmail -> Google Calendar workflow. Use it when an email contains schedule details and you want to create a calendar event through the same Maton account.
## .env 文件说明
API Key 保存在 skill 目录的 `.env` 文件中(**不要提交到 Git**)。首次使用前需要创建:
The explicit command to write the API key into ~/.openclaw/workspace/skills/gmail-to-calendar/.env normalizes plaintext credential persistence in a shared workspace location. That increases the chance of credential theft by other skills, local users, or accidental disclosure through sync, support bundles, or version-control mistakes.
API Key 保存在 skill 目录的 .env 文件中(不要提交到 Git)。首次使用前需要创建:
# 在 skill 目录下创建 .env 文件
echo "MATON_API_KEY=你的API密钥" > ~/.openclaw/workspace/skills/gmail-to-calendar/.env
Instructing all exec calls to source the .env file broadens credential exposure to every spawned shell process. This increases the blast radius of a compromise because unrelated commands, subprocesses, or debug output may inherit the API key.
# 在 skill 目录下创建 .env 文件
echo "MATON_API_KEY=你的API密钥" > ~/.openclaw/workspace/skills/gmail-to-calendar/.env
所有 exec 调用会自动从该文件加载环境变量(通过 set -a; source ~/.openclaw/workspace/skills/gmail-to-calendar/.env; set +a)。
The quick-start workflow demonstrates loading the secret and immediately making authenticated network calls, which encourages a pattern where credentials are broadly available during interactive execution. In an agent environment, that increases the likelihood the token is reused by adjacent commands or exfiltrated through logs and failures.
# 自动从 .env 加载环境变量后,列出邮件
set -a; source ~/.openclaw/workspace/skills/gmail-to-calendar/.env; set +a
python <<'EOF'
import urllib.request, os, json
The troubleshooting step tells the operator to cat the .env file, which directly exposes the secret on screen and potentially into terminal logs, transcripts, or agent memory. This is a classic secret-handling anti-pattern that materially increases credential disclosure risk.
.env 文件是否存在且包含有效密钥:cat ~/.openclaw/workspace/skills/gmail-to-calendar/.env
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
ROOT = pathlib.Path(__file__).resolve().parent
ENV_PATH = ROOT / ".env"
FIELD_ALIASES = {
"summary": ["Title", "Summary", "标题", "主题"],
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if "MATON_API_KEY" in os_environ():
return os_environ()["MATON_API_KEY"]
if not ENV_PATH.exists():
raise RuntimeError(f"Missing .env file: {ENV_PATH}")
values: dict[str, str] = {}
for raw_line in ENV_PATH.read_text().splitlines():
line = raw_line.strip()
The skill requires environment-variable access, file reads, and network access, but it does not declare any explicit tool scope or allowed-tools boundaries. That makes the effective privilege surface broader and less auditable, increasing the chance an agent can perform sensitive actions beyond the user's expectation.
The documentation expands the skill from promoting Gmail schedule details into calendar events to a general Gmail management tool that can send, manage, and alter mailbox state. This scope drift is dangerous because an agent or user may invoke capabilities like email sending or modification that are unrelated to the advertised purpose and have privacy or integrity impact.
The skill describes reading mailbox contents, sending/modifying/trashing emails, and creating calendar events without a clear privacy and data-impact warning. In a mailbox/calendar context, lack of explicit disclosure is dangerous because users may not realize the skill can access sensitive communications or alter account state.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
Access the Gmail API with managed OAuth authentication. Read, send, and manage emails, threads, labels, and drafts.
This skill also includes a bundled helper script, `gmail_to_calendar.py`, for a tested Gmail -> Google Calendar workflow. Use it when an email contains schedule details and you want to create a calendar event through the same Maton account.
## .env 文件说明
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
Access the Gmail API with managed OAuth authentication. Read, send, and manage emails, threads, labels, and drafts.
This skill also includes a bundled helper script, `gmail_to_calendar.py`, for a tested Gmail -> Google Calendar workflow. Use it when an email contains schedule details and you want to create a calendar event through the same Maton account.
## .env 文件说明
This section advertises connection management and other write-capable or destructive operations that are not necessary for turning Gmail content into calendar events. Exposing account-linking, deletion, or broader API operations increases the chance of unintended account changes or misuse if an agent follows the documentation literally.
The API reference includes mail sending, label modification, trashing, and draft operations, all of which exceed the declared read-from-Gmail/create-in-Calendar workflow. Such overbroad instructions create a capability mismatch that can lead to unauthorized or surprising data changes in a sensitive communication system.
The code copies the full email body into the calendar event description during free-text extraction, which can move unrelated confidential message content into Calendar. Since calendar entries are often more widely visible than email, this can expose private information, internal notes, signatures, or threads beyond the original message scope.
Appending the Gmail message ID and source subject into the event description leaks email-derived metadata into calendar records. This can reveal internal identifiers and message context to anyone with access to the calendar event, expanding exposure beyond the original Gmail message.
Defaulting to Asia/Shanghai when no timezone is found can silently create events at incorrect times for users in other locales. In a scheduling skill, this is a meaningful integrity and privacy issue because users may miss meetings or inadvertently reveal incorrect availability to others.
The workflow reads Gmail content, derives fields from it, and then transmits those fields to the Google Calendar API without any explicit disclosure at the point of transfer. Even though Gmail and Calendar are expected integrations for this skill, the automatic cross-service propagation of email-derived content can expose sensitive information from messages into another system or audience scope.
The script creates a calendar event immediately from parsed Gmail content unless --dry-run is used, with no interactive confirmation or review gate. In this skill’s context, that means potentially sensitive or misparsed email-derived data can be written into Google Calendar automatically, causing unintended disclosure or integrity issues in the user’s calendar.
The prominent initialization rule is written only in Chinese, while the rest of the document is largely in English. This creates a language-policy issue because it imposes a specific language for a required operational step without giving the user an explicit language or locale choice.
Stating that the skill can 'Read, send, and manage emails, threads, labels, and drafts' contradicts the narrower manifest description and materially changes user expectations. Even without hidden code, this kind of mismatched description encourages overbroad use of a skill that handles highly sensitive inbox data.