Back to skill

Security audit

Aliyun Codeup

Security checks for vulnerabilities and agentic risk

Overview

This Codeup helper appears purpose-built for read-only repository queries, but its token handling could expose a personal access token during normal use.

Review this skill before installing. Use only a least-privileged, short-lived Codeup token, and be aware that the current implementation may expose that token in local process listings or Git error output. Prefer a version that uses API headers or a safer Git credential mechanism and avoids token-bearing command-line URLs.

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

T09 · Insecure Skill Coding Practices

Warning
Location
codeup_cli.py:47
Finding
Personal Access Token Exposed in Git Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `codeup_cli.py:47-54, 69-74`; `SKILL.md:62, 143-146, 174-178, 216` **Vulnerability Type**: Credential exposure through process arguments and diagnostic output **Risk Level**: Medium ### Vulnerable Code `codeup_cli.py:47-54`: ```python git_url = f"https://oauth2:{token}@codeup.aliyun.com/{project_path}.git" print(f"📥 正在克隆项目 {repo_name}...") subprocess.run( ['git', 'clone', '--quiet', '--no-tags', git_url, repo_path], check=True, capture_output=True, timeout=120 ) ``` `codeup_cli.py:69-74`: ```python except subprocess.CalledProcessError as e: return { 'success': False, 'error': f'Git 操作失败:{e.stderr.decode() if e.stderr else str(e)}' } ``` `SKILL.md:62` and `SKILL.md:216` document the same insecure credential-passing pattern: ```bash git clone --quiet "https://oauth2:$YUNXIAO_PERSONAL_TOKEN@codeup.aliyun.com/<path>.git" ``` `SKILL.md:143-146` duplicates the vulnerable implementation: ```python git_url = f"https://oauth2:{token}@codeup.aliyun.com/{project_path}.git" subprocess.run( ['git', 'clone', '--quiet', '--depth=1', git_url, repo_path], ``` ### Technical Analysis The personal access token is interpolated directly into an HTTPS repository URL and passed to `git clone` as a command-line argument. Although `subprocess.run` uses an argument list and is therefore not directly vulnerable to shell command injection, the resulting Git process contains the complete credential-bearing URL in its argument vector. Depending on operating-system process visibility controls, other local users, privileged monitoring agents, audit systems, crash reporters, or process telemetry collectors may be able to observe and retain the command line. The documented shell examples also expand the token before starting Git and may expose it through shell tracing, command auditing, or other terminal instrumentation. The exception handler returns Git's stderr without credential reda ...[truncated 1716 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Remove credentials from repository URLs and process arguments.** - Use a short-lived `GIT_ASKPASS` helper to provide the token only when Git requests credentials. - Set `GIT_TERMINAL_PROMPT=0` to prevent unexpected interactive prompts. - Ensure the helper file is created with owner-only permissions and deleted in a `finally` block. 2. **Prevent credential persistence.** - Do not configure a persistent global Git credential helper. - If a temporary credential helper is used, isolate it with a temporary Git configuration and ensure it does not write credentials to disk. 3. **Redact diagnostic output.** - Before displaying or logging stderr, replace the token and any URL user-information component with a fixed marker such as `[REDACTED]`. - Avoid returning raw subprocess diagnostics when they can contain authentication material. 4. **Correct the documentation.** - Remove all examples that embed `$YUNXIAO_PERSONAL_TOKEN` in a URL. - Document the secure authentication mechanism and warn users against passing tokens in command-line arguments. 5. **Apply least privilege and token lifecycle controls.** - Retain only the scopes required for repository reads. - Use short-lived tokens where supported and rotate any token that may have been exposed through process or command logs. - Restrict token access to the minimum necessary projects. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (18)

Chaining Abuse

High
Category
Tool Misuse
Content
# 临时克隆查询
git clone --quiet "https://oauth2:$YUNXIAO_PERSONAL_TOKEN@codeup.aliyun.com/<path>.git"
cd <repo> && git branch -a
cd /tmp && rm -rf <repo>
```

**优点:**
Confidence
91% confidence
Finding
The documented workflow chains repository operations with cleanup commands, including `rm -rf`, creating a pattern that can magnify mistakes and make destructive actions occur automatically after prior steps. In agent or copy-paste usage, command chaining reduces opportunities to validate paths and state before deletion, increasing the chance of unintended file removal.

Chaining Abuse

High
Category
Tool Misuse
Content
**执行:**
```bash
cd /tmp && rm -rf data-admin-api
git clone --quiet "https://oauth2:$YUNXIAO_PERSONAL_TOKEN@codeup.aliyun.com/flashexpress/ard/be/tools/data-admin-api.git"
cd data-admin-api && git branch -a | grep -v HEAD | sed 's/remotes\/origin\///' | sort
cd /tmp && rm -rf data-admin-api
Confidence
95% confidence
Finding
This example explicitly performs `cd /tmp && rm -rf data-admin-api` before cloning, normalizing a destructive pattern that depends on current directory and exact path assumptions. If reused with modified variables or in a different context, it can delete unintended local content and is especially risky when executed by automation.

Chaining Abuse

High
Category
Tool Misuse
Content
cd /tmp && rm -rf data-admin-api
git clone --quiet "https://oauth2:$YUNXIAO_PERSONAL_TOKEN@codeup.aliyun.com/flashexpress/ard/be/tools/data-admin-api.git"
cd data-admin-api && git branch -a | grep -v HEAD | sed 's/remotes\/origin\///' | sort
cd /tmp && rm -rf data-admin-api
```

**输出:**
Confidence
95% confidence
Finding
The post-operation `cd /tmp && rm -rf data-admin-api` repeats the same destructive chaining pattern, encouraging automatic deletion without an explicit safety check. In agent workflows, such examples can be parameterized or generalized in unsafe ways, turning a benign cleanup into accidental data loss.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill invokes sensitive capabilities including environment-variable access, network access, and shell commands, but does not declare any explicit tool scope or permissions boundary. In an agent setting, this weakens reviewability and least-privilege controls, making it easier for the skill to access secrets and execute external commands without clear authorization constraints.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The documentation includes recursive deletion commands (`rm -rf`) as part of the normal workflow without prominently warning about local data-loss risk. Users or agents adapting the example could delete unintended directories if variables, paths, or working-directory assumptions differ.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The skill presents itself as a repository metadata query tool but actually performs a full local clone of the target repository. This mismatch increases risk because users may not expect disk writes, network transfer of full repository contents, or execution of local git tooling against untrusted repositories.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
Embedding the personal access token in the git URL creates a clear secret-exposure risk, especially since the tool gives no user-facing warning and may surface stderr from failed git operations. Tokens in URLs are historically prone to leakage through process lists, logs, shell history, diagnostics, and upstream tooling behavior.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# 克隆仓库(获取所有分支信息)
        git_url = f"https://oauth2:{token}@codeup.aliyun.com/{project_path}.git"
        print(f"📥 正在克隆项目 {repo_name}...")
        subprocess.run(
            ['git', 'clone', '--quiet', '--no-tags', git_url, repo_path],
            check=True,
            capture_output=True,
Confidence
77% confidence
Finding
Cloning an attacker-controlled repository causes the local git client to process untrusted remote content and metadata, which expands the attack surface beyond the stated metadata-query purpose. While this code avoids shell injection, invoking git on arbitrary repositories can expose the host to credential handling issues, resource exhaustion, and any client-side git/protocol weaknesses present in the environment.

Context-Inappropriate Capability

Medium
Confidence
84% confidence
Finding
Executing local git subprocesses is a stronger capability than necessary for listing branches, commits, or stats, and it processes attacker-influenced repository data on the user's machine. In this skill context, that unnecessary capability expansion raises the danger because a simple query tool should not need to clone and inspect repositories locally.

Tainted flow: 'git_url' from os.getenv (line 47, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Content
# 克隆仓库(获取所有分支信息)
        git_url = f"https://oauth2:{token}@codeup.aliyun.com/{project_path}.git"
        print(f"📥 正在克隆项目 {repo_name}...")
        subprocess.run(
            ['git', 'clone', '--quiet', '--no-tags', git_url, repo_path],
            check=True,
            capture_output=True,
Confidence
90% confidence
Finding
The personal access token is embedded directly into the clone URL and then passed to git, which can leak credentials via process inspection, logs, error output, crash reports, or git configuration side effects. Because the tool accepts arbitrary project URLs and clones them locally, the skill context makes this more dangerous than a normal metadata query utility.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def query_branches(repo_path, repo_name):
    """查询分支列表"""
    # 获取所有分支
    result = subprocess.run(
        ['git', 'branch', '-a', '--sort=-committerdate'],
        cwd=repo_path,
        capture_output=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def query_commits(repo_path, repo_name):
    """查询最近提交"""
    result = subprocess.run(
        ['git', 'log', '--oneline', '-20', '--all'],
        cwd=repo_path,
        capture_output=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def query_stats(repo_path, repo_name):
    """查询仓库统计"""
    # 分支数
    result = subprocess.run(
        ['git', 'branch', '-a'],
        cwd=repo_path,
        capture_output=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
branch_count = len([l for l in result.stdout.strip().split('\n') if l.strip() and 'HEAD' not in l])
    
    # 提交数
    result = subprocess.run(
        ['git', 'rev-list', '--count', '--all'],
        cwd=repo_path,
        capture_output=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
commit_count = int(result.stdout.strip())
    
    # 贡献者数
    result = subprocess.run(
        ['git', 'log', '--format=%aN', '--all'],
        cwd=repo_path,
        capture_output=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
文件标题及全文说明均以中文呈现,未说明这是面向特定中文用户群体的区域性技能,也未提供其他语言或用户选择。这可能构成对语言使用的隐性强制,属于自然语言层面的 locale/语言策略问题。

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
The skill description, headings, examples, and CLI output are entirely in Chinese, which effectively imposes a specific language/locale on users without stating that the skill is Chinese-only or offering alternatives. Under the policy, language constraints should be opt-in or clearly documented and justified.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
Docstrings and all user-facing CLI messages are written only in Chinese, with no option to select another language. This is a natural-language locale constraint that is not presented as opt-in and has no documented region-specific justification in the file.

Static analysis

No suspicious patterns detected.