Back to skill

Security audit

自动周报助手

Security checks for vulnerabilities and agentic risk

Overview

This weekly-report skill mostly matches its stated purpose, but it needs Review because it handles credentials, sends report data externally, reads broad calendar data, and has unsafe local file and HTML handling.

Review before installing. Use only narrowly scoped tokens, avoid passing secrets as command-line arguments, do not enable cron automation until confirmations are added, verify email recipients and Feishu document targets before sending, and avoid feeding untrusted report content into HTML/email export until path validation and HTML sanitization are fixed.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
skills/weekly-report/scripts/history_manager.py:34
Finding

Path Traversal Enables File Read, Write, and Deletion Outside the History Directory

Content
View full analysis
Remediation
View remediation
str: return date.fromisoformat(value).isoformat() ``` 2. Construct filenames only from normalized values: ```python safe_start = normalize_date(week_start) safe_end = normalize_date(week_end) filename = f"{safe_start}_{safe_end}.md" ``` 3. Resolve and verify the final path before every read, write, or deletion: ```python history_dir = get_history_dir().resolve() filepath = (history_dir / filename).resolve() if filepath.parent != history_dir: raise ValueError("Invalid report path") ``` 4. Reject path separators, absolute paths, NUL characters, and traversal components as defense in depth. 5. Apply the same helper function consistently to save, get, and delete operations. 6. Create history files with restrictive permissions because weekly reports may contain confidential work information. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
skills/weekly-report/scripts/export_pdf.py:55
Finding

Untrusted Report Content Is Embedded into Exported HTML Without Sanitization

Content
View full analysis
str: """Markdown转HTML(无需pandoc)""" import re html = markdown_content # 标题 html = re.sub(r'^#### (.+)$', r'

\1

', html, flags=re.MULTILINE) html = re.sub(r'^### (.+)$', r'

\1

', html, flags=re.MULTILINE) html = re.sub(r'^## (.+)$', r'

\1

', html, flags=re.MULTILINE) html = re.sub(r'^# (.+)$', r'

\1

', html, flags=re.MULTILINE) # 粗体/斜体 html = re.sub(r'\*\*\*(.+?)\*\*\*', r'\1', html) html = re.sub(r'\*\*(.+?)\*\*', r'\1', html) html = re.sub(r'\*(.+?)\*', r'\1', html) # 代码 html = re.sub(r'`(.+?)`', r'\1', html) # 链接 html = re.sub(r'\[(.+?)\]\((.+?)\)', r'\1', html) # 列表 lines = html.split('\n') in_list = False new_lines = [] for line in lines: if line.startswith('- '): if not in_list: new_lines.append('
    ') in_list = True new_lines.append(f'
  • {line[2:]}
  • ') else: if in_list: new_lines.append('
') in_list = False new_lines.append(line) if in_list: new_lines.append('') html = '\n'.join(new_lines) # 段落 html = html.replace('\n\n', '

') # 完整HTML full_html = f''' {title} body {{ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif; max-width: 800px; margin: 0 auto; padding: 40px 20px; color: #333; line-height: ...[truncated 2846 chars]

Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
skills/weekly-report/scripts/email_sender.py:103
Finding

API Tokens and SMTP Passwords Are Accepted Through Process Command-Line Arguments

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
skills/weekly-report/scripts/calendar_fetcher.py:52
Finding

Feishu Calendar Fetcher Enumerates Every Calendar Accessible to the Token

Content
View full analysis
Dict: """获取飞书日历事件""" import requests headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } try: # 获取日历列表 cal_list_url = "https://open.feishu.cn/open-apis/calendar/v3/calendars" resp = requests.get(cal_list_url, headers=headers) if resp.status_code != 200: return {"events": []} calendars = resp.json().get("data", {}).get("calendars", []) all_events = [] for cal in calendars: cal_id = cal.get("id") if not cal_id: continue # 获取日历事件 events_url = f"https://open.feishu.cn/open-apis/calendar/v3/calendars/{cal_id}/events" params = { "start_time": since, "end_time": until } resp = requests.get(events_url, headers=headers, params=params) if resp.status_code == 200: events = resp.json().get("data", {}).get("items", []) for e in events: all_events.append({ "title": e.get("summary", "无标题"), "start": e.get("start", {}).get("date_time", ""), "end": e.get("end", {}).get("date_time", ""), "description": e.get("description", ""), "organizer": e.get("organizer", {}).get("name", "未知") }) return {"events": all_events} ``` ### Technical Analysis The function first requests the complete list of calendars visible to the supplied Feishu token and then requests events from every returned calendar. The c ...[truncated 1689 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (31)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill description materially overstates what the implementation does, including claims around API fetching, history management, export, email, and Feishu write-back. This mismatch is security-relevant because users may provide credentials or sensitive content under false assumptions about how data is handled, and reviewers may approve a skill whose real behavior and trust boundaries are unclear.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
def main():
    parser = argparse.ArgumentParser(description="获取飞书文档更新")
    parser.add_argument("--token", required=True, help="飞书Access Token")
    parser.add_argument("--docs", nargs="+", required=True, help="文档/知识库列表")
    parser.add_argument("--since", required=True, help="开始日期")
    parser.add_argument("--until", required=True, help="结束日期")

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · skills/weekly-report/scripts/feishu_fetcher.py (reported line 65)May include surrounding context.

python
def main():
    parser = argparse.ArgumentParser(description="获取飞书文档更新")
    parser.add_argument("--token", required=True, help="飞书Access Token")
    parser.add_argument("--docs", nargs="+", required=True, help="文档/知识库列表")
    parser.add_argument("--since", required=True, help="开始日期")
    parser.add_argument("--until", required=True, help="结束日期")

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · skills/weekly-report/scripts/github_fetcher.py (reported line 76)May include surrounding context.

python
def main():
    parser = argparse.ArgumentParser(description="获取飞书文档更新")
    parser.add_argument("--token", required=True, help="飞书Access Token")
    parser.add_argument("--docs", nargs="+", required=True, help="文档/知识库列表")
    parser.add_argument("--since", required=True, help="开始日期")
    parser.add_argument("--until", required=True, help="结束日期")

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

The script requires a Feishu access token and collects it through a command-line flag, creating an avoidable credential exposure path. In the context of an automation skill that may be invoked by agents, wrappers, or CI systems, argv-based secrets can be captured in logs, telemetry, job definitions, and process inspection, increasing the risk of account compromise and unauthorized document access.

Content

Scanner excerpt · skills/weekly-report/scripts/feishu_writer.py (reported line 177)May include surrounding context.

python
def main():
    parser = argparse.ArgumentParser(description="写入飞书文档")
    parser.add_argument("--token", required=True, help="飞书Access Token")
    parser.add_argument("--title", required=True, help="文档标题")
    parser.add_argument("--content", required=True, help="文档内容 (Markdown)")
    parser.add_argument("--doc-id", help="已有文档ID(追加模式)")

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The delete_report function unlinks an existing report file and rewrites metadata, but it does so without prompting the user or emitting any warning about the destructive action. This is a safety-critical irreversible operation on user data and lacks visible disclosure in the code.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises capabilities that involve file writes, network access, and shell execution, but it does not declare any explicit tool scope or permissions boundary. This is dangerous because an agent or platform may execute broader-than-expected actions such as writing reports to disk, sending data externally, or invoking local commands without clear user consent or policy enforcement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description omits clear warnings that report content may be stored locally and transmitted to third-party services such as SMTP or Feishu. Because weekly reports often contain sensitive internal project details, users may unknowingly expose confidential information or leave persistent local copies without informed consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manual trigger phrases are broad everyday expressions, increasing the chance of accidental activation during normal conversation. In a skill that can aggregate work history, write files, and potentially send content externally, unintended triggering can cause privacy leaks, surprise side effects, or unauthorized actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script retrieves potentially sensitive calendar event data from Google Calendar and Feishu, including titles, descriptions, times, and organizer names, via external network calls. While errors are printed, there is no confirmation prompt or explicit user-facing warning that personal calendar contents will be transmitted to and retrieved from third-party services.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language descriptions and CLI help text exclusively in Chinese, beginning with the module docstring. The policy allows locale constraints only when user opt-in or clear justification is provided, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The argparse description and all help messages are presented only in Chinese. Because the file does not offer language selection or explain a justified regional restriction, this is a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · skills/weekly-report/scripts/export_pdf.py (reported line 17)May include surrounding context.

python
"""使用pandoc将Markdown转换为PDF"""
    try:
        # 检查pandoc是否安装
        result = subprocess.run(['which', 'pandoc'], capture_output=True)
        if result.returncode != 0:
            return {"success": False, "error": "请先安装 pandoc: brew install pandoc"}

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · skills/weekly-report/scripts/export_pdf.py (reported line 39)May include surrounding context.

python
]
            
            # 执行转换
            result = subprocess.run(cmd, capture_output=True, text=True)
            
            if result.returncode == 0:
                return {"success": True, "path": output_path}

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring says '飞书文档/知识库更新获取脚本', the function docstring says '获取飞书文档更新', and comments describe document/wiki handling as if update retrieval were occurring. In practice, the code only performs simple GET requests for document details and wiki node listings, with no logic to inspect modification times or changes. That is an active contradiction between documentation intent and code behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring, function docstring, and CLI description all state that the script gets document/knowledge-base updates, and the API accepts since and until dates. However, after parsing those dates, the code never uses them in any request or filtering logic, and only fetches document titles and wiki node listings. This is a semantic mismatch between the stated behavior and the implemented behavior.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · skills/weekly-report/scripts/feishu_writer.py (reported line 106)May include surrounding context.

python
"blocks": blocks
    }
    
    resp = requests.post(url, headers=headers, json=data)
    
    if resp.status_code == 200:
        result = resp.json()

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · skills/weekly-report/scripts/feishu_writer.py (reported line 170)May include surrounding context.

python
"blocks": blocks
    }
    
    resp = requests.post(url, headers=headers, json=data)
    
    if resp.status_code == 200:
        result = resp.json()

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code sends the provided title and content to the external Feishu API, which may transmit user data off-system. While the function names and docstrings describe the mechanics, the script provides no explicit user-facing warning, confirmation, or privacy disclosure at the point of execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Accepting an access token via a command-line argument is security-sensitive because CLI arguments are often exposed through shell history, process listings, audit logs, and orchestration tooling. In a reporting skill that may run on shared developer machines or CI/agent environments, this can leak Feishu credentials to other local users or logging systems.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and all generated report headings/messages are hard-coded in Chinese, indicating the skill is designed to operate in a specific language with no user opt-in or locale selection. This matches the policy category for language/locale constraints because the script does not offer any alternative language or explain a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script accepts a GitHub Personal Access Token directly on the command line, which can expose the secret through shell history, process listings, job logs, or orchestration telemetry. In the context of an automation skill that aggregates data from multiple sources, this is more dangerous because tokens are likely to be used non-interactively and may be handled by wrappers or agents that persist command invocations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code performs file writes to the user's home directory and updates metadata, but there is no confirmation prompt or user-facing disclosure beyond internal docstrings. The same script also supports deletion, so these persistent data changes can affect user data without an explicit warning in the code file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The skill name and description are presented entirely in Chinese and the examples assume Chinese-language commands and report generation, with no indication that users may choose another language. This can violate a language/locale choice policy when the skill imposes a specific language by default without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

User-facing docstrings, argument descriptions, and help text are exclusively in Chinese, including the CLI description and option help strings. This imposes a language choice on users without offering an alternative or opt-in, which matches the locale/language policy violation criteria.

Content

No source excerpt is available for this finding.