Back to skill

Security audit

Gitcode Pr Comment Workflow

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent GitCode PR workflow, but it handles repository tokens in unsafe persistent and command-line forms and includes broad cleanup commands.

Review before installing. Use this only with a narrowly scoped GitCode credential, avoid putting tokens in MEMORY.md, avoid access_token query parameters where possible, confirm every push or PR reply destination, and do not run the blanket temp/ cleanup if that directory may contain unrelated work.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:430
Finding

GitCode Access Token Exposed in URL Query Parameters and Process Arguments

Content
View full analysis
"}' > /tmp/reply_body.json curl -s -X POST \ "https://api.gitcode.com/api/v5/repos///pulls//discussions//comments?access_token=${TOKEN}" \ -H "Content-Type: application/json" \ -d @/tmp/reply_body.json ``` ```bash TOKEN=$(python -c "from gitcode_cli.config import get_token; print(get_token())") echo '{"body": "暂不修改,建议级优化后续单独处理。"}' > /tmp/reply_body.json for did in "" "" ""; do curl -s -X POST \ "https://api.gitcode.com/api/v5/repos///pulls//discussions/${did}/comments?access_token=${TOKEN}" \ -H "Content-Type: application/json" \ -d @/tmp/reply_body.json done ``` The same unsafe query-parameter authentication pattern is also prescribed for retrieving comments: ```bash curl.exe -s "https://api.gitcode.com/api/v5/repos///pulls//comments?access_token=" ``` ### Technical Analysis GitCode authentication is necessary for the declared pull-request workflow. However, embedding the access token in the URL is not necessary and violates secure credential-handling practices. The expanded URL can expose the token through: - Process listings and process-monitoring software while `curl` is running. - HTTP client diagnostics and error reports. - Reverse-proxy, gateway, security-monitoring, or server access logs. - Debugging output and shell transcripts. - URL telemetry or request-recording systems. The Skill a ...[truncated 1562 chars]
Remediation
View remediation
//pulls//discussions//comments" \ -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" \ --data-binary @/tmp/reply_body.json ``` 3. Do not print the token as part of a Python subprocess. Retrieve it through an approved credential helper or inject it through a protected runtime secret channel. 4. Use narrowly scoped and short-lived credentials limited to the required repository operations. 5. Ensure command tracing is disabled while handling credentials and never log request headers containing secrets. 6. Clear temporary shell variables after use: ```bash unset TOKEN ``` 7. Redact URL query strings and authorization headers from diagnostics, proxy logs, and API error reports. 8. Update all examples in both `SKILL.md` and `references/gitcode-api.md` so they do not encourage query-parameter authentication. 9. Revoke and rotate any token that may already have appeared in process captures or logs. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:21
Finding

Persistent Storage of GitCode Tokens in Agent Memory

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:527
Finding

Overbroad Recursive Deletion of the Shared Workspace Temp Directory

Content
View full analysis
Remediation
View remediation
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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (26)

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

The skill explicitly instructs retrieving the access token from local CLI config using Python code. This is dangerous because it normalizes credential extraction into plain shell variables, making accidental disclosure through process listings, logs, shell history, copied commands, or downstream tools much more likely.

Content

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

Use the Reply to PR Comment API to post replies within each comment's discussion thread.

Get the access token from gitcode CLI config:

bash
TOKEN=$(python -c "from gitcode_cli.config import get_token; print(get_token())")

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

md
- The `discussion_id` comes from the `GET /repos/{owner}/{repo}/pulls/{number}/comments` API response's `discussion_id` field
- On Windows, always write JSON body to a file first and use `-d @file.json` to avoid encoding issues with non-ASCII characters
- Each reply is posted within the existing discussion thread, keeping the conversation context
- Clean up temp files after replying: `rm -f /tmp/reply_body.json`

#### 9.4 Confirm & Report

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
86% confidence
Finding

The workflow recommends recursive forced deletion of the entire temp/ directory. Broad destructive commands are risky in agent contexts because path confusion, workspace misresolution, or symlink issues can cause deletion of more data than intended.

Content

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

bash
Remove-Item -Recurse -Force temp/  # Windows
rm -rf temp/                        # Linux/macOS

GitCode API Reference (PR Comments)

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 · references/gitcode-api.md (reported line 190)May include surrounding context.

md
| Parameter | Type | Required | Description |
|:---|:---|:---|:---|
| `access_token` | string | yes | User access token |

**Request Body (application/json):**

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill directs use of a GitCode token stored in MEMORY.md or provided by the user, but does not prominently warn about secret handling risks. Storing long-lived credentials in workspace files can expose them to other tools, commits, backups, or accidental disclosure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill includes functionality to post PR comments/replies, which expands behavior beyond the declared description of fetching comments, modifying code, and pushing changes. Scope drift is dangerous because users and policy systems may authorize the skill based on the manifest, while the implementation performs additional external write actions that can affect public collaboration history.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

A full workflow step for replying to unaddressed review comments is added without being reflected in the skill metadata. This creates an integrity and consent problem: the skill can perform externally visible writes on behalf of the user that are not obvious from the advertised scope.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The workflow instructs extracting a GitCode access token from local CLI configuration for direct API use. Pulling credentials from local config increases the chance of secret exposure through logs, shell history, process inspection, or accidental reuse outside the CLI's intended trust boundary.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The workflow combines token extraction from local config with direct API calls, yet lacks explicit security warnings about credential exposure. This pattern materially raises the risk of leaking secrets via command history, scripts, temp files, or debugging output while performing network actions.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This instruction performs an external POST to GitCode to publish a reply comment. Even though it is part of the intended workflow, it transmits user-generated content and repository context to an external service, creating integrity and privacy implications if done unexpectedly or with the wrong target.

Content

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

md
# Write body to file to avoid encoding issues on Windows
echo '{"body": "<reply text>"}' > /tmp/reply_body.json

curl -s -X POST \
  "https://api.gitcode.com/api/v5/repos/<owner>/<repo>/pulls/<number>/discussions/<discussion_id>/comments?access_token=${TOKEN}" \
  -H "Content-Type: application/json" \
  -d @/tmp/reply_body.json

External Transmission

Medium
Category
Data Exfiltration
Confidence
87% confidence
Finding

The batch reply loop can send multiple external POST requests, amplifying the impact of mistakes such as wrong discussion IDs, incorrect reply text, or unintended mass posting. Bulk external actions are more dangerous because a single approval can create multiple visible writes across a PR discussion.

Content

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

md
for did in "<discussion_id_1>" "<discussion_id_2>" "<discussion_id_3>"; do
  curl -s -X POST \
    "https://api.gitcode.com/api/v5/repos/<owner>/<repo>/pulls/<number>/discussions/${did}/comments?access_token=${TOKEN}" \
    -H "Content-Type: application/json" \
    -d @/tmp/reply_body.json
done

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 97)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 440)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 538)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 544)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 577)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · references/gitcode-api.md (reported line 6)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · references/gitcode-api.md (reported line 81)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · references/gitcode-api.md (reported line 215)May include surrounding context.

Base URL

text
https://api.gitcode.com/api/v5

Authentication

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documentation instructs users to pass access tokens in URL query parameters, which are commonly exposed in shell history, process listings, proxy logs, browser history, and server access logs. In a skill that automates PR review workflows and branch modifications, this increases the chance that a long-lived repo token is unintentionally disclosed during normal use.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · references/gitcode-api.md (reported line 81)May include surrounding context.

Cross-repo PR example (fork → upstream):

bash
curl -s -X POST "https://api.gitcode.com/api/v5/repos/Ascend/msinsight/pulls?access_token=<token>" \
  -H "Content-Type: application/json" \
  -d @payload.json

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example curl command embeds the access token directly in the request URL, creating a concrete copy-paste path for credential leakage. Because this skill is meant to be run by users handling live PRs and pushing code, leaked tokens could allow unauthorized repository API actions under the user's identity.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · references/gitcode-api.md (reported line 214)May include surrounding context.

md
# Write body to file to avoid encoding issues on Windows
echo '{"body": "暂不修改,后续单独处理。"}' > /tmp/reply_body.json

curl -s -X POST \
  "https://api.gitcode.com/api/v5/repos/{owner}/{repo}/pulls/{number}/discussions/{discussion_id}/comments?access_token=<token>" \
  -H "Content-Type: application/json" \
  -d @/tmp/reply_body.json

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This reply-to-comment example again places the access token in the URL, which can leak through terminal history, logs, monitoring tools, or copied transcripts. Since the workflow interacts with PR discussions and code changes, a stolen token may enable comment spoofing, data access, or code-related actions depending on token scope.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The workflow saves PR review comments and metadata locally in temp/pr_review_comments.json without an explicit user-facing disclosure about local retention. While operationally useful, this can preserve potentially sensitive repo discussion data on disk longer than expected.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.