Back to skill

Security audit

ai-pr-doctor

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent PR automation workflow, but it defaults to high-impact repository changes and external report publishing with weak safety gates.

Review this skill carefully before installing. Use it only on repositories where autonomous PR modification and merge are acceptable, disable auto_merge and notify_feishu by default if possible, restrict GitHub token permissions, avoid untrusted test_command values, and require human approval after review failures or before publishing reports externally.

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
workflow.json:18
Finding

Unvalidated Test Command Is Passed to a Privileged Execution Skill

Content
View full analysis

Vulnerability Details

File Location: workflow.json, lines 18-22 and 95-102
Vulnerability Type: Command injection risk through unrestricted workflow input
Risk Level: High

Vulnerable Code

json
"test_command": {
  "type": "string",
  "default": "npm test",
  "description": "Test command used by auto-pr-merger to rerun tests"
}
json
"input": {
  "pr": "${inputs.pr}",
  "test": "${inputs.test_command}",
  "retries": 2,
  "auto_merge_if_passed": true
}

Technical Analysis

The workflow accepts test_command as an unrestricted string and passes it directly to the write-capable auto-pr-merger Skill. The configuration does not define an executable allowlist, argument schema, shell-metacharacter filtering, working-directory restriction, or sandbox requirement.

The implementation of auto-pr-merger is not included in this project, so this audit cannot confirm how it invokes the command. If that Skill executes the value through a shell, an attacker who can control workflow parameters could inject additional commands. Even without shell interpretation, allowing callers to select arbitrary executables exceeds what is necessary to run repository tests.

Attack Path

  1. An attacker or untrusted automation gains the ability to invoke the Skill and control test_command.
  2. The attacker supplies a command containing an unintended executable or, if shell interpretation is used, command separators and a secondary payload.
  3. The workflow forwards the string unchanged to auto-pr-merger.
  4. The delegated Skill executes the test command in the repository or agent environment.
  5. The injected process operates with the filesystem, network, credentials, and repository permissions available to the agent.

Exploitation depends on the command-execution semantics of the external auto-pr-merger Skill, which are not present in this package.

Impact Assessment

Successful exploitation could provide command execution with the agent's p ...[truncated 494 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove free-form command input from untrusted callers.
  2. Replace test_command with an enum of repository-approved test tasks, such as unit, integration, or lint.
  3. Resolve each task to a fixed executable and fixed argument array maintained in trusted configuration.
  4. Invoke the executable directly without a shell.
  5. If customization is essential, reject shell metacharacters and validate every argument against a strict allowlist.
  6. Run tests in an ephemeral container with no production credentials, read-only host mounts, restricted outbound networking, and resource limits.
  7. Give the test process a short-lived repository credential with no merge or administrative permissions.
  8. Log the resolved executable and arguments and require approval when they differ from repository-owned configuration.

T09 · Insecure Skill Coding Practices

Error
Location
workflow.json:168
Finding

Failed Code Review Falls Through to Automatic Remediation and Merge

Content
View full analysis

Vulnerability Details

File Location: workflow.json, lines 94-102 and 168-174
Vulnerability Type: Fail-open security workflow
Risk Level: High

Vulnerable Code

json
{
  "id": "step3_auto_fix",
  "name": "Automatic remediation, testing, and merge",
  "skill": "auto-pr-merger",
  "condition": "${inputs.auto_merge} AND ${step2.critical} == 0",
  "input": {
    "pr": "${inputs.pr}",
    "test": "${inputs.test_command}",
    "retries": 2,
    "auto_merge_if_passed": true
  }
}
json
"fallback": {
  "step1": "Return an error when PR information retrieval fails",
  "step2": "Skip AI review and proceed directly to automatic remediation",
  "step3": "Mark the PR for manual review and note it in the report",
  "step4": "Print Markdown to the terminal instead of publishing to Feishu"
}

The second snippet is an English rendering of the workflow's fallback messages; its step2 behavior explicitly directs the workflow to skip failed review and continue to automatic remediation.

Technical Analysis

The code-review stage is a security gate for the later write and merge operation. The error handler nevertheless instructs the workflow to bypass that gate when review fails. Automatic merge is enabled by default, and the merger receives auto_merge_if_passed: true.

A review error is not equivalent to a result containing zero critical issues. Continuing after an unavailable, incomplete, malformed, or timed-out review creates a fail-open path. The exact interaction between the fallback and the ${step2.critical} == 0 expression depends on the workflow engine, but the declared fallback explicitly intends progression into the privileged remediation stage.

Attack Path

  1. An attacker submits or identifies a PR containing unsafe changes.
  2. The attacker causes the review stage to fail, time out, return malformed output, or otherwise enter its fallback path.
  3. The workflow skips the AI review rather than stopping.
  4. auto-pr-merger rece ...[truncated 865 chars]
Remediation
View remediation

Remediation Suggestions

  1. Fail closed whenever code review fails, times out, produces malformed output, or cannot conclusively report issue counts.
  2. Prevent automatic remediation, pushes, and merges unless the review stage returns a validated success result.
  3. Distinguish explicitly between review_succeeded, critical_count, and review_error; never infer approval from missing values.
  4. Require human approval after any fallback or degraded execution.
  5. Set auto_merge and auto_merge_if_passed to false by default.
  6. Enforce protected branches, required CI checks, signed commits where appropriate, and independent reviewer approval on GitHub.
  7. Use separate credentials for reading PR data and writing or merging changes.
  8. Add tests that verify review errors cannot reach any write-capable workflow step.

T09 · Insecure Skill Coding Practices

Warning
Location
workflow.json:111
Finding

Repository and Security Review Information Is Published to Feishu by Default

Content
View full analysis

Vulnerability Details

File Location: workflow.json, lines 28-32 and 111-121
Vulnerability Type: Default external disclosure of repository information
Risk Level: Medium

Vulnerable Code

json
"notify_feishu": {
  "type": "boolean",
  "default": true,
  "description": "Whether to publish the Feishu diagnostic report after completion"
}
json
{
  "id": "step4_report",
  "name": "Generate Feishu diagnostic report",
  "skill": "feishu_doc",
  "condition": "${inputs.notify_feishu}",
  "input": {
    "action": "create",
    "title": "PR diagnostic report | ${step1.pr_title}",
    "content": "${report_markdown}",
    "folder_token": "${inputs.feishu_folder}",
    "grant_to_requester": true
  }
}

The snippets preserve the operative configuration while rendering descriptive source text in English.

Technical Analysis

External Feishu reporting is part of the declared functionality, so the network transfer is not covert. However, it is enabled by default and sends the complete generated report rather than a minimal notification.

The report template includes repository and author information, review findings, changed or fixed-file information, and merge results. Security findings can reveal weaknesses in private code even when source code is not included verbatim. The workflow defines no redaction pass, sensitivity classification, destination ownership validation, tenant restriction, or preview-and-consent step.

The option grant_to_requester: true additionally broadens access automatically. The package does not establish that every requester is authorized to view the private repository or its vulnerability findings.

Attack Path

  1. A user invokes the Skill for a private or sensitive PR while leaving the default notification setting unchanged.
  2. The workflow collects PR metadata and generates security-review and remediation results.
  3. The complete report is passed to the external feishu_doc Skill.
  4. A Feishu document is ...[truncated 803 chars]
Remediation
View remediation

Remediation Suggestions

  1. Change notify_feishu to opt-in, particularly for private repositories.
  2. Display the destination, recipients, and exact report content before publication.
  3. Validate that the Feishu tenant, folder, and requester are authorized for the source repository.
  4. Disable grant_to_requester by default and use an explicit recipient allowlist.
  5. Send a minimal notification containing a link to an access-controlled internal report rather than full findings where possible.
  6. Redact source fragments, secrets, credentials, internal paths, vulnerability details, and personal information before transmission.
  7. Add repository-level policies that can prohibit external reporting for confidential projects.
  8. Record an auditable authorization decision for every external publication.
  9. Apply retention limits and least-privilege permissions to created Feishu documents.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill advertises an end-to-end flow that automatically reviews, fixes, merges PRs, and publishes reports to Feishu, but the warning about repository writes and external publication appears only later and is not prominent at the point of invocation. This creates a high risk of users triggering source-control changes and data disclosure without informed consent, especially when combined with broad triggers and auto_merge_if_passed: true.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The workflow enables automatic fixing and merging after a limited condition check, but it does not present a clear destructive-action warning to the user. Because this skill can alter code and merge into the target branch, misuse, misconfiguration, or weak review outcomes could introduce bad code directly into the repository.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The fallback for step2 explicitly bypasses AI review and proceeds to automatic remediation flow, which undermines the workflow's primary safety gate. In this skill, that is especially dangerous because step3 can automatically modify and merge PRs, so a review failure can directly convert into unreviewed code changes being tested and merged.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README advertises automatic PR fixes, test reruns, merges, and report publication as normal behavior without clearly warning that these actions can modify repositories, trigger CI, merge code, and publish potentially sensitive review details. In an agent skill context, missing consent and safety boundaries around state-changing actions increases the chance of unintended repository changes or disclosure, especially if users treat the skill as analysis-only.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The example workflow explicitly says that if tests pass, the PR is automatically merged, but it does not mention any explicit human approval, policy checks, or protected-branch safeguards. This is dangerous because passing tests alone is not a sufficient security or quality gate, and users may be misled into enabling autonomous merges that can introduce flawed or malicious code into production branches.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases include very broad natural-language requests like '代码审查这个 PR' and '帮我看看这个 PR', which can easily match ordinary developer conversation and invoke a workflow that performs high-impact actions. In this skill, unintended invocation is especially risky because downstream steps can modify code, merge PRs, and publish reports externally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill name and descriptions are entirely in Chinese, and no option is provided for alternate language output or user locale selection. This creates a language policy issue because the skill appears to impose a specific language without explicit opt-in or a documented region-specific justification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The description promises an end-to-end path of AI review, automatic fixing, and merging without clearly stating the narrow conditions, limitations, or required safeguards. In an automation skill that operates on live GitHub PRs, this can mislead users into enabling risky repository mutations without understanding when merges occur or what protections exist.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

PR content is forwarded to external skills for AI review and Feishu reporting without a clear disclosure of what data leaves GitHub or who can access it. In practice, PR titles, bodies, code context, comments, and remediation details may include proprietary or sensitive information, creating confidentiality and compliance risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file presents the skill name, usage examples, and operational details exclusively in Chinese. A language-only presentation can create a locale policy issue when no user language choice, bilingual alternative, or scope limitation is documented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language description and trigger guidance are presented entirely in Chinese, with no indication that users may interact in another language or select their locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.