Back to skill

Security audit

Swiftlint

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward SwiftLint helper skill with disclosed linting, install, reporting, configuration, and autocorrect commands; the main practical risk is that autocorrect can edit source files.

Install this only for Swift projects where you want SwiftLint assistance. Treat `swiftlint --fix` as a file-modifying command, review your git diff afterward, and be cautious with workflow examples that use `git stash`, branch checkout, or `sudo xcode-select`.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

swiftlint rules | grep "force_cast"

text

### Show Rule Details

```bash
swiftlint rules force_cast

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger guidance uses broad natural-language phrases like 'check my code style' or 'lint my Swift code' to authorize running commands. In an agent environment, such generic phrasing can cause unintended invocation against the current project or directory without sufficient scoping, especially when the user did not explicitly request tool execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly instructs the agent to run swiftlint --fix, which modifies repository files, but the guidance does not require an explicit user confirmation immediately before making changes. In an agent setting, linting may be expected to be read-only, so automatically switching to write actions can cause unintended code edits, dirty working trees, or disruptive changes in the user's project.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

swiftlint lint --reporter github-actions-logging

text

### Xcode Summary (plist)

```bash
swiftlint lint --reporter xcode-summary

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
| `emoji` | Emoji-decorated | Fun terminal output |
| `html` | HTML report | Browser viewing |
| `junit` | JUnit XML | Test reporting tools |
| `xcode-summary` | Plist | Xcode build summaries |

> **Agent guidance:** Use `--reporter json` when you need to parse results programmatically. Use `--reporter github-actions-logging` on GitHub Actions to get inline annotations on PRs.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
|---|---|
| `No lintable files found` | Check `included` paths in config or run from project root |
| `Invalid configuration` | Validate YAML syntax in `.swiftlint.yml` |
| `SourceKit not found` | Run `sudo xcode-select -s /Applications/Xcode.app` |
| `Rule not found` | Check rule name with `swiftlint rules`, may be opt-in |
| `Slow linting` | Add `excluded` paths for Pods/DerivedData, use `--cache-path` |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The note says that when a user asks to 'clean up' or 'fix style' in Swift code, the agent should run swiftlint --fix first, which combines a vague trigger with immediate write actions. This makes unintended modification especially likely because ordinary conversational requests can be interpreted as authorization to alter source files.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.