Back to skill

Security audit

Gmail to Calendar

Security checks for vulnerabilities and agentic risk

Overview

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.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:27
Finding

Documentation Encourages Plaintext Secret Exposure and Shell Execution of the Environment File

Content
View full analysis
~/.openclaw/workspace/skills/gmail-to-calendar/.env ``` ```text 所有 exec 调用会自动从该文件加载环境变量(通过 `set -a; source ~/.openclaw/workspace/skills/gmail-to-calendar/.env; set +a`)。 ``` ```bash # 自动从 .env 加载环境变量后,列出邮件 set -a; source ~/.openclaw/workspace/skills/gmail-to-calendar/.env; set +a python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://gateway.maton.ai/google-mail/gmail/v1/users/me/messages?maxResults=10') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF ``` The authentication section repeats the executable loading pattern: ```bash set -a; source ~/.openclaw/workspace/skills/gmail-to-calendar/.env; set +a ``` Troubleshooting explicitly recommends displaying the secret file: ```bash cat ~/.openclaw/workspace/skills/gmail-to-calendar/.env ``` ### Technical Analysis The setup command relies on the process umask and does not explicitly create the credential file with owner-only permissions. On systems with permissive defaults, the Maton API key may be readable by other local accounts or processes that can inspect the Skill directory. Entering the literal key in an interactive `echo` command can also retain it in shell history. More importantly, `source` does not parse `.env` as a passive key-value format. It executes the file using the current shell. Shell substitutions, redirects, function definitions, and arbitrary commands inserted into the file are executed with the privileges of the use ...[truncated 2449 chars]
Remediation
View remediation
~/.openclaw/workspace/skills/gmail-to-calendar/.env chmod 600 ~/.openclaw/workspace/skills/gmail-to-calendar/.env ``` 3. Avoid entering the real key directly in a command likely to be retained in shell history. Use a hidden prompt or secret-management interface. 4. Never load `.env` with `source`. Parse it strictly as key-value data, as the bundled Python helper already does. 5. Reject unexpected keys, malformed lines, duplicate keys, command substitutions, and shell metacharacters if a separate loader is introduced. 6. Validate file ownership, permissions, regular-file status, and symlink status before reading the secret. 7. Remove the recommendation to run `cat` on the credential file. Validate only whether the variable name exists, without printing its value. 8. Document key rotation and revocation procedures in case the key appears in logs, shell history, or terminal output. 9. Limit the Maton key and connected OAuth grants to only the Gmail-read and Calendar-event-create operations required by this Skill, where supported. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Credential Access

High
Category
Privilege Escalation
Confidence
82% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 23)May include surrounding context.

md
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**)。首次使用前需要创建:

Credential Access

High
Category
Privilege Escalation
Confidence
84% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 28)May include surrounding context.

API Key 保存在 skill 目录的 .env 文件中(不要提交到 Git)。首次使用前需要创建:

bash
# 在 skill 目录下创建 .env 文件
echo "MATON_API_KEY=你的API密钥" > ~/.openclaw/workspace/skills/gmail-to-calendar/.env

Credential Access

High
Category
Privilege Escalation
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 29)May include surrounding context.

bash
# 在 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)。

Credential Access

High
Category
Privilege Escalation
Confidence
83% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 37)May include surrounding context.

Quick Start

bash
# 自动从 .env 加载环境变量后,列出邮件
set -a; source ~/.openclaw/workspace/skills/gmail-to-calendar/.env; set +a
python <<'EOF'
import urllib.request, os, json

Credential Access

High
Category
Privilege Escalation
Confidence
87% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 418)May include surrounding context.

  1. 检查 .env 文件是否存在且包含有效密钥:
bash
cat ~/.openclaw/workspace/skills/gmail-to-calendar/.env
  1. Verify the API key is valid by listing connections:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · gmail_to_calendar.py (reported line 19)May include surrounding context.

python
ROOT = pathlib.Path(__file__).resolve().parent
ENV_PATH = ROOT / ".env"

FIELD_ALIASES = {
    "summary": ["Title", "Summary", "标题", "主题"],

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · gmail_to_calendar.py (reported line 202)May include surrounding context.

python
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()

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 21)May include surrounding context.

md
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 文件说明

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 21)May include surrounding context.

md
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 文件说明

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

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.

Content

No source excerpt is available for this finding.