Back to skill

Security audit

gitlab-weekly-report

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent GitLab weekly-report purpose, but it handles GitLab tokens unsafely and disables normal network protections for authenticated requests.

Install only if you are comfortable editing the script first: remove curl -k and --noproxy *, avoid passing the GitLab token via --token or curl arguments, use a least-privilege token, and rotate any token that may have been used with the current version.

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
gitlab_weekly_report.py:16
Finding
GitLab Personal Access Token Exposed Through Process Arguments<![CDATA[ ## Vulnerability Details **File Location**: `gitlab_weekly_report.py:16-19`, `gitlab_weekly_report.py:132`; documented usage in `SKILL.md:38` and `SKILL.md:51-55` **Vulnerability Type**: Credential exposure through command-line and child-process arguments **Risk Level**: Medium ### Vulnerable Code ```python def curl_request(url, token=None): """使用 curl 请求 API(更稳定),绕过代理""" cmd = ["curl", "-s", "-k", "--noproxy", "*"] # --noproxy 绕过代理 if token: cmd.extend(["-H", f"PRIVATE-TOKEN: {token}"]) ``` ```python parser.add_argument("--token", required=True, help="GitLab Personal Access Token") ``` The documented invocation also instructs users to place the credential directly on the command line: ```bash python3 gitlab_weekly_report.py --token 你的token --user-id 46 --after 2026-03-09 --before 2026-03-13 ``` ### Technical Analysis The application requires the GitLab personal access token as a command-line argument. This can record the secret in shell history and expose it through process inspection, command auditing, diagnostic collection, or process-monitoring systems. The script then embeds the same token in the arguments of a spawned `curl` process using `-H "PRIVATE-TOKEN: ..."`. Consequently, the secret may be visible in both the Python process invocation and the child process command line. Although process visibility depends on the operating system and local security configuration, command-line arguments are not an appropriate secret transport mechanism. ### Attack Path 1. A user follows the documented command and supplies a valid GitLab personal access token through `--token`. 2. The command may be retained in shell history, terminal logging, job metadata, or operating-system audit records. 3. During execution, the script creates a `curl` command whose argument list contains the token in plaintext. 4. A local user, process-monitoring service, diagnostic collector, or compromised account with process-inspection access retrieves ...[truncated 841 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the required `--token` command-line option as the primary credential mechanism. 2. Read the token from a protected environment variable, permission-restricted configuration file, operating-system credential store, or an interactive stdin prompt that does not echo input. 3. Prefer a Python HTTP client so the authorization header is transmitted directly without creating a child process containing the token in its argument list. 4. If `curl` must be retained, provide the header through a protected temporary configuration or stdin mechanism that does not expose it in process arguments. Ensure any temporary resource has restrictive permissions and is deleted reliably. 5. Update `SKILL.md` so its examples do not place real tokens directly in command lines. 6. Recommend narrowly scoped, short-lived tokens and document prompt token revocation and rotation if exposure is suspected. 7. Avoid printing credentials in errors, debug logs, generated reports, or exception traces. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
gitlab_weekly_report.py:16
Finding
TLS Certificate Verification Disabled for Authenticated GitLab Requests<![CDATA[ ## Vulnerability Details **File Location**: `gitlab_weekly_report.py:16` **Vulnerability Type**: Improper certificate validation and unconditional proxy bypass **Risk Level**: High ### Vulnerable Code ```python cmd = ["curl", "-s", "-k", "--noproxy", "*"] # --noproxy 绕过代理 ``` ### Technical Analysis The `-k` option instructs `curl` to accept invalid or untrusted TLS certificates. This disables server-identity verification for every request made by the script, including requests that transmit the GitLab personal access token in the `PRIVATE-TOKEN` header. Without certificate verification, TLS encryption does not reliably authenticate the remote GitLab server. An attacker capable of intercepting or redirecting network traffic can present an arbitrary certificate, terminate the connection, and receive the authentication header. The unconditional `--noproxy "*"` option additionally bypasses all configured proxies. In managed environments, this may circumvent organization-provided TLS inspection, routing, access control, monitoring, or egress policy. It can also force traffic over a less trusted direct route. Proxy bypass is not required by the stated report-generation functionality and should not be globally imposed. ### Attack Path 1. A user runs the report generator with a valid GitLab personal access token. 2. An attacker gains a network interception position or influences DNS, routing, a gateway, or another network component between the host and the configured GitLab endpoint. 3. The attacker redirects the request to a server under their control and presents an invalid, self-signed, or otherwise untrusted certificate. 4. Because `curl` is invoked with `-k`, the client accepts the attacker's certificate without validating the server identity. 5. The script sends the `PRIVATE-TOKEN` header to the attacker's endpoint. 6. The attacker captures and reuses the token against the legitimate GitLab service. 7. The attacker may also return fabricated eve ...[truncated 724 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `-k` option and require normal TLS certificate and hostname verification. 2. Install the organization's trusted internal certificate authority in the operating system or application trust store when GitLab uses an internally issued certificate. 3. Never solve certificate failures by globally disabling verification. Fail closed and provide a clear configuration error instead. 4. Remove the unconditional `--noproxy "*"` option and respect standard proxy configuration. 5. If a proxy exception is operationally necessary, make it explicit, configurable, narrowly scoped to the trusted GitLab hostname, and documented with its security implications. 6. Prefer a maintained Python HTTP client with certificate verification enabled by default, explicit connection and read timeouts, and safe authentication-header handling. 7. Rotate any token that may previously have been transmitted over an intercepted or untrusted connection. 8. Consider certificate or public-key pinning only where the organization can securely manage pin rotation; it should supplement rather than replace sound certificate validation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (12)

Ssd 3

High
Confidence
97% confidence
Finding
The skill embeds and normalizes handling of sensitive token and personal account data in plain text, including a token placeholder and saved configuration fields for user identity details. In an agent-skill context, this is especially risky because users may paste real secrets into prompts or config, which can then leak through logs, transcripts, screenshots, debugging output, or downstream tooling.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
def curl_request(url, token=None):
    """使用 curl 请求 API(更稳定),绕过代理"""
    cmd = ["curl", "-s", "-k", "--noproxy", "*"]  # --noproxy 绕过代理
    if token:
        cmd.extend(["-H", f"PRIVATE-TOKEN: {token}"])
Confidence
98% confidence
Finding
This duplicate finding points to the same risky behavior: the tool invocation is crafted to evade proxy inspection and ignore certificate validation. Because the script uses a personal access token for API access, the misuse of tool parameters could expose credentials and reduce organizational visibility into outbound connections.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
def curl_request(url, token=None):
    """使用 curl 请求 API(更稳定),绕过代理"""
    cmd = ["curl", "-s", "-k", "--noproxy", "*"]  # --noproxy 绕过代理
    if token:
        cmd.extend(["-H", f"PRIVATE-TOKEN: {token}"])
Confidence
98% confidence
Finding
This duplicate finding points to the same risky behavior: the tool invocation is crafted to evade proxy inspection and ignore certificate validation. Because the script uses a personal access token for API access, the misuse of tool parameters could expose credentials and reduce organizational visibility into outbound connections.

Credential Access

High
Category
Privilege Escalation
Content
def main():
    parser = argparse.ArgumentParser(description="GitLab 周报生成器")
    parser.add_argument("--token", required=True, help="GitLab Personal Access Token")
    parser.add_argument("--user-id", type=int, required=True, help="GitLab 用户 ID")
    parser.add_argument("--after", required=True, help="开始日期 (YYYY-MM-DD)")
    parser.add_argument("--before", help="结束日期 (YYYY-MM-DD)")
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The invocation examples include phrases like “帮我查一下这周(或上周)的 git 提交” and “帮我整理上周的周报,” which are common natural-language requests that could overlap with normal conversation. The file does not provide exclusion conditions, a constrained command scope, or negative examples to clarify when this skill should or should not activate.

Intent-Code Divergence

Medium
Confidence
93% confidence
Finding
The skill instructs users to pass a personal GitLab token directly on the command line and stores account details and token references in the documentation. This is dangerous because CLI arguments can be exposed through shell history, process listings, logs, screenshots, or copied transcripts, increasing the chance of credential leakage and unauthorized GitLab API access.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill describes using a personal GitLab token for API access without warning users about credential sensitivity, storage risks, or privacy implications of querying commit history. In context, the skill accesses potentially sensitive developer activity and repository metadata, so the lack of credential-handling guidance materially increases the risk of accidental secret disclosure and overbroad data access.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
This skill deliberately invokes curl with --noproxy * and -k, causing requests to bypass enterprise proxy controls and TLS certificate validation. In context, the script also sends a GitLab personal access token, so this combination weakens network monitoring and enables credential exposure or man-in-the-middle interception.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The script transmits a personal access token over network requests while silently bypassing proxies and disabling certificate validation, without clearly warning the user that their credential will be used under these weakened protections. This makes the skill context more dangerous because the token is security-sensitive and could grant repository access if intercepted or mishandled.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
cmd.extend(["-H", f"PRIVATE-TOKEN: {token}"])
    cmd.append(url)
    
    result = subprocess.run(cmd, capture_output=True, text=True)
    if result.returncode != 0:
        raise Exception(f"curl failed: {result.stderr}")
    return result.stdout
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Low
Confidence
72% confidence
Finding
All instructions, examples, and output guidance are presented only in Chinese, and the skill does not indicate that users may choose another language. Under the stated policy, forcing a specific language without opt-in can be a natural-language policy issue unless the locale restriction is documented and justified.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The natural-language description, user-facing argparse description, and console output are all fixed in Chinese. Under the policy, forcing a specific language without user opt-in can be a locale-policy violation when no choice or justification is provided.

Static analysis

No suspicious patterns detected.