Back to skill

Security audit

Git Security Scanner & Repo Health Auditor

Security checks for vulnerabilities and agentic risk

Overview

GitGuard mostly matches its repo-auditing purpose, but its scanner can follow symlinks and read files outside the chosen repository, so private files could be partially exposed in results.

Use this only on repositories you control and trust. Before scanning untrusted repos, avoid symlinks or run it in a sandbox with access only to the target repo, because a crafted repo could make the scanner inspect readable files elsewhere on your machine. Treat GitHub token use and dependency checks as network-enabled features, and verify the remote MCP endpoint before using it with private repository data.

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

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
gitguard_skill/entropy.py:195
Finding

Repository Boundary Escape Through Symbolic-Link File Scanning

Content
View full analysis

Vulnerability Details

File Location: gitguard_skill/entropy.py, lines 195-212
Vulnerability Type: Symbolic-link traversal and unauthorized local-file read
Risk Level: Medium

Vulnerable Code

python
def scan_repo(repo_path: str, entropy_threshold: float = 4.0,
              max_files: int = 5000) -> list[SecretFinding]:
    """Walk a repository and scan all text files for exposed secrets."""
    root = Path(repo_path)
    findings: list[SecretFinding] = []
    scanned = 0
    for p in root.rglob("*"):
        if scanned >= max_files:
            break
        if not p.is_file():
            continue
        if any(part in SKIP_DIR_NAMES for part in p.parts):
            continue
        if p.suffix.lower() not in SCANNABLE_EXTENSIONS and p.name != ".env":
            continue
        scanned += 1
        findings.extend(scan_file(p, entropy_threshold))
    return findings

The file is subsequently read by scan_file():

python
def scan_file(path: Path, entropy_threshold: float = 4.0) -> list[SecretFinding]:
    findings: list[SecretFinding] = []
    try:
        text = path.read_text(errors="ignore")
    except (UnicodeDecodeError, OSError):
        return findings

Technical Analysis

The repository scanner recursively discovers paths using Path.rglob(), checks them with Path.is_file(), and reads accepted paths using Path.read_text(). Both is_file() and read_text() follow symbolic links. The implementation does not:

  • Reject symbolic links.
  • Resolve candidate paths before reading them.
  • Verify that a resolved candidate remains beneath the resolved repository root.
  • Open files with operating-system controls that prohibit symbolic-link following.

As a result, a repository can contain a symbolic link with a supported extension—or named .env—whose target is outside the selected repository. The scanner will treat the link as an ordinary file and read the external target using the privileges of the GitGuard pr ...[truncated 2098 chars]

Remediation
View remediation

Remediation Suggestions

  1. Reject symbolic links explicitly

    Check p.is_symlink() before calling is_file() or reading the candidate:

    python
    if p.is_symlink():
        continue
    
  2. Enforce containment using resolved paths

    Resolve the repository root once, resolve every candidate, and require the candidate to remain inside that root:

    python
    root = Path(repo_path).resolve()
    
    for p in root.rglob("*"):
        if p.is_symlink():
            continue
    
        try:
            resolved = p.resolve(strict=True)
            resolved.relative_to(root)
        except (OSError, ValueError):
            continue
    
        if not resolved.is_file():
            continue
    

    On supported Python versions, resolved.is_relative_to(root) may be used instead of catching ValueError.

  3. Prevent time-of-check/time-of-use link replacement

    A candidate could theoretically be replaced with a symbolic link after validation but before reading. Where supported, open files using operating-system facilities equivalent to O_NOFOLLOW, validate the opened file descriptor, and read through that descriptor rather than reopening the pathname.

  4. Minimize disclosure in findings

    Consider fully masking secret values instead of preserving the first and last four characters. A safer preview can include only the secret length or pattern classification.

  5. Apply filesystem least privilege

    Run the scanner under an account or sandbox that can read only the repositories intended for analysis. Avoid granting the service broad access to home directories, deployment secrets, SSH material, or other sensitive files.

  6. Add regression tests

    Add tests covering:

    • A file symlink pointing outside the repository.
    • A .env symlink pointing outside the repository.
    • A valid internal regular file.
    • Broken symbolic links.
    • Symbolic-link replacement between validation and reading, where practical.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

Although the narrative text mentions optional GitHub API reads, the skill lacks formal permissions/triggers metadata reflecting network access and authenticated API use. In agent ecosystems, that gap matters because safety controls and users often rely on structured metadata, so undeclared remote access and token use can bypass expectation-setting and increase the chance of unintended data exposure or overbroad execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Although the narrative text mentions optional GitHub API reads, the skill lacks formal permissions/triggers metadata reflecting network access and authenticated API use. In agent ecosystems, that gap matters because safety controls and users often rely on structured metadata, so undeclared remote access and token use can bypass expectation-setting and increase the chance of unintended data exposure or overbroad execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Although the narrative text mentions optional GitHub API reads, the skill lacks formal permissions/triggers metadata reflecting network access and authenticated API use. In agent ecosystems, that gap matters because safety controls and users often rely on structured metadata, so undeclared remote access and token use can bypass expectation-setting and increase the chance of unintended data exposure or overbroad execution.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · gitguard_skill/entropy.py (reported line 69)May include surrounding context.

python
# File extensions worth scanning; skip binaries / lockfiles / minified assets.
SCANNABLE_EXTENSIONS = {
    ".py", ".js", ".ts", ".jsx", ".tsx", ".json", ".yaml", ".yml",
    ".env", ".sh", ".bash", ".toml", ".ini", ".cfg", ".php", ".rb",
    ".go", ".java", ".rs", ".html", ".md", ".txt",
}

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · gitguard_skill/entropy.py (reported line 208)May include surrounding context.

python
# File extensions worth scanning; skip binaries / lockfiles / minified assets.
SCANNABLE_EXTENSIONS = {
    ".py", ".js", ".ts", ".jsx", ".tsx", ".json", ".yaml", ".yml",
    ".env", ".sh", ".bash", ".toml", ".ini", ".cfg", ".php", ".rb",
    ".go", ".java", ".rs", ".html", ".md", ".txt",
}

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 · gitguard_skill/github_api.py (reported line 6)May include surrounding context.

python
Only reads data the authenticated user (or public API for public repos)
already has access to. No write operations are performed by this module.
A personal access token is optional -- without one, requests fall back to
unauthenticated calls which are rate-limited by GitHub (60/hour) but work
fine for occasional checks on public repos.
"""

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill declares broad capabilities in practice (environment variable access, file reads, network access, and shell/git execution) but does not constrain them with explicit permissions or allowed-tools metadata. This weakens policy enforcement and user awareness, making it easier for an agent to invoke sensitive operations beyond what the user expects, especially since repo scanning can touch arbitrary local paths and optional network features use credentials from the environment.

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 · gitguard_skill/git_local.py (reported line 10)May include surrounding context.

python
def _run(repo_path: str, args: list[str]) -> str:
    try:
        result = subprocess.run(
            ["git", "-C", repo_path, *args],
            capture_output=True, text=True, timeout=30, check=False,
        )

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes a local-first Git security scanner and repo health auditor focused on local repositories, with only optional GitHub API reads for declared checks like dependency freshness. This module adds GitHub PR and issue triage capabilities, which are materially different from the stated secret detection, health scoring, commit quality, stale branch cleanup, and dependency freshness functions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest advertises analysis of local repositories, secret scanning, dependency checks against live registries, and GitHub triage via a remote MCP endpoint, but it does not clearly warn users which operations may transmit repository metadata or identifiers off-device. In a tool explicitly handling potentially sensitive source code and secrets, missing privacy and data-flow disclosure increases the risk of unintended exposure and weakens informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The helper runs local subprocess commands via git -C <repo_path> ..., which is a safety-relevant operation for code files under this rule. Although the module docstring notes no network access is required, there is no confirmation prompt, print/log disclosure, or docstring warning near the execution path about invoking external processes on a user-supplied path.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code invokes repo scanning, branch/commit inspection, and dependency analysis over a user-supplied repository path, which can process potentially sensitive local source data. In this file there is no confirmation prompt, logging, or inline warning describing that repository contents and metadata will be inspected.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · gitguard_skill/skill.py (reported line 27)May include surrounding context.

python
if isinstance(obj, dict):
        return {k: _to_dict(v) for k, v in obj.items()}
    if hasattr(obj, "__dataclass_fields__"):
        return {f: _to_dict(getattr(obj, f)) for f in obj.__dataclass_fields__}
    return obj

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency is specified as requests>=2.28.0, which allows any newer release to be installed, reducing reproducibility and making it harder to ensure deployments avoid vulnerable or breaking versions. In a security-focused skill, leaving a core HTTP library unpinned increases supply-chain and maintenance risk because different environments may resolve to different package versions.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
requests>=2.28.0

Unverifiable Dependency: requests has 16 known advisory(ies) (CVE-2014-1830 (Exposure of Sensitive Information to an Unauthorized Actor in Requests); CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
92% confidence
Finding

The manifest includes requests without an exact version pin, so it is impossible to verify from this file whether the installed version is affected by any of the known advisories associated with that package. This creates uncertainty around exposure to real vulnerabilities, especially for a tool that may make network requests to GitHub APIs and therefore relies on the safety of its HTTP client.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This is a manifest file, so trigger clarity applies. The description lists many broad capabilities such as repo intelligence and triage but does not define when the skill should be invoked, what requests it should or should not respond to, or any exclusion conditions, which can lead to overly broad activation.

Content

No source excerpt is available for this finding.