Back to skill

Security audit

pytest-config

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent pytest testing-pattern guide, with minor adoption risks around broad triggers, CI examples, and sample helper code but no artifact-backed malicious behavior.

Before installing or using this skill, review any generated CI workflow before committing it, remove Codecov unless external coverage upload is intended, consider pinning GitHub Actions to commit SHAs, and harden the sample GitRepository.add_file helper if test input can include untrusted paths.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
modules/git-testing-fixtures.md:36
Finding

Path Traversal in Git Test Repository File Helper

Content
View full analysis
Path: """Add a file to the repository.""" full_path = self.path / file_path full_path.parent.mkdir(parents=True, exist_ok=True) full_path.write_text(content) return full_path ``` ### Technical Analysis The `add_file()` helper directly combines the repository path with the caller-controlled `file_path` without validating that the resulting destination remains inside the test repository. A path containing parent-directory components, such as `../../target`, can escape `self.path`. In addition, when `file_path` is absolute, `pathlib.Path` discards the preceding repository path and uses the absolute path directly. The subsequent calls to `mkdir()` and `write_text()` then create directories and write attacker-controlled content outside the intended temporary repository. No shell invocation is involved, so this is not command injection. It is an arbitrary file-write flaw constrained by the operating-system permissions of the test process. ### Attack Path 1. An attacker influences a filename passed to `GitRepository.add_file()`, such as through generated test data, an imported fixture, or an untrusted repository test case. 2. The attacker supplies a traversal path such as `../../project-file` or an absolute filesystem path. 3. `self.path / file_path` resolves to a location outside the temporary Git repository. 4. `full_path.parent.mkdir(parents=True, exist_ok=True)` creates any required parent directories. 5. `full_path.write_text(content)` creates or overwrites the selected file with attacker-controlled content. ### Impact Assessment Successful exploitation allows creation or overwrite of any file writable by the account running pytest. In a developer en ...[truncated 439 chars]
Remediation
View remediation
Path: """Add a file only within the test repository.""" relative_path = Path(file_path) if relative_path.is_absolute(): raise ValueError("file_path must be relative") root = self.path.resolve() target = (root / relative_path).resolve() if not target.is_relative_to(root): raise ValueError("file_path must remain inside the repository") target.parent.mkdir(parents=True, exist_ok=True) target.write_text(content) return target ``` Also add tests covering absolute paths, `../` traversal, nested traversal, valid nested paths, and symlink-based escape attempts. If compatibility with Python versions before `Path.is_relative_to()` is required, compare paths using `target.relative_to(root)` and reject `ValueError`. ]]>

T08 · Insecure Dependencies

Note
Location
modules/ci-integration.md:51
Finding

GitHub Actions Referenced Through Mutable Version Tags

Content
View full analysis
Remediation
View remediation
# v4 - uses: actions/setup-python@ # v5 with: python-version: "3.12" - run: pip install -e ".[dev]" - run: pytest --cov --cov-report=xml - uses: codecov/codecov-action@ # v4 ``` Apply the same changes to the multi-Python workflow. Record the corresponding release version in comments for maintainability, and use Dependabot or Renovate to propose reviewed SHA updates. Additionally, explicitly minimize `GITHUB_TOKEN` permissions with a workflow-level or job-level `permissions` block, avoid exposing secrets to untrusted pull-request jobs, and review the provenance and release notes of action updates before merging them. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest trigger list contains generic terms like "pytest," "testing," "configuration," and "fixtures" without additional scope constraints. These broad triggers may cause unintended invocation for many ordinary development conversations that are not specifically about standardized pytest configuration patterns.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This markdown file includes a GitHub Actions step that sends coverage results to codecov/codecov-action@v4, which involves network transmission of repository and test-coverage data to a third-party service. The surrounding skill description does not mention this external upload or warn users about the data-sharing implication.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The second workflow example again uses codecov/codecov-action@v4, which sends coverage information outside the CI environment. The markdown does not disclose that behavior, so users may adopt the example without realizing it shares build metadata with an external provider.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.