Back to skill

Security audit

sonarqube-autofix

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly aligned with SonarQube remediation, but it gives the agent broad repository-changing and tool-execution authority with several unsafe or under-scoped behaviors.

Install only if you are comfortable with an agent downloading SonarQube data, using SonarQube tokens, writing project files, running build/test/formatter tools, and potentially invoking another skill to modify code. Review or remove the scanner-configuration deletion instruction, require explicit approval before repository writes or formatter fixes, and avoid running the npm validation scripts unless dependencies are pinned and already installed from a trusted lockfile.

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

T09 · Insecure Skill Coding Practices

Error
Location
references/download-issues.sh:73
Finding
SonarQube bearer token may be exposed through plaintext transport and process arguments<![CDATA[ ## Vulnerability Details **File Location**: `references/download-issues.sh`, lines 73-80 **Vulnerability Type**: Bearer-token exposure through unrestricted transport and command-line arguments **Risk Level**: High ### Vulnerable Code ```bash AUTH_HEADER="" if [ -n "$SONAR_TOKEN" ]; then AUTH_HEADER="Authorization: Bearer $SONAR_TOKEN" fi if [ -n "$AUTH_HEADER" ]; then curl -fs "$API_URL" -H "$AUTH_HEADER" else curl -fs "$API_URL" fi ``` ### Technical Analysis The SonarQube base URL is obtained from environment-controlled configuration, but the script does not require HTTPS before attaching the bearer token. If a configured URL uses plain HTTP, the authorization header and returned SonarQube issue data are transmitted without transport encryption. The authorization header is also supplied to `curl` as a command-line argument. Depending on operating-system process visibility and execution environment, another local user or monitoring process may be able to inspect the argument while `curl` is running. Shell tracing or command-capture infrastructure could expose it as well. Although sending a token to the configured SonarQube server is necessary for the Skill's declared function, allowing plaintext transport and exposing the header through command arguments are not necessary privileges or disclosures. ### Attack Path 1. An attacker influences the SonarQube URL configuration or convinces a user to configure an `http://` endpoint. 2. The Skill constructs `API_URL` from that endpoint. 3. The script invokes `curl` with `Authorization: Bearer $SONAR_TOKEN`. 4. The token traverses the network without TLS and can be captured by an on-path observer. 5. Alternatively, a local process with permission to inspect process arguments reads the bearer header while `curl` is running. 6. The attacker reuses the recovered token against the SonarQube API. ### Impact Assessment A successful attacker obtains the permissions assigned to the exposed SonarQube to ...[truncated 320 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Reject non-HTTPS SonarQube URLs by default. 2. Permit HTTP only for explicitly approved loopback endpoints such as `localhost` or `127.0.0.1`, with a clear development-only opt-in. 3. Validate the URL scheme and host before attaching an authorization header. 4. Avoid placing the complete bearer header in process arguments. Use a protected temporary curl configuration or supported credential mechanism that is not visible in the ordinary process list. 5. If a temporary configuration file is used: - Create it with mode `0600`. - Store it in a securely created temporary directory. - Install an `EXIT` trap to remove it. - Never print its contents. 6. Disable shell tracing around credential-bearing operations and document that verbose command logging must not capture secrets. 7. Apply minimum scopes and expiration periods to SonarQube tokens. ]]>

T08 · Insecure Dependencies

Error
Location
references/validate-angular.sh:27
Finding
Validation scripts can download and execute unpinned npm registry packages<![CDATA[ ## Vulnerability Details **File Locations**: - `references/validate-angular.sh`, lines 27-41 - `references/validate-js.sh`, lines 10-17 **Vulnerability Type**: Unpinned third-party package retrieval and execution **Risk Level**: High ### Vulnerable Code From `references/validate-angular.sh`: ```bash else echo "⚠️ ng not found, trying eslint..." npx eslint src/ || { echo "❌ Error: eslint failed" exit 1 } fi # Formatting with Prettier echo "✨ Formatting code with Prettier..." npx prettier --write src/ || { echo "⚠️ Warning: Prettier failed, continuing..." } # Formatting with ESLint --fix echo "✨ Formatting code with ESLint..." npx eslint --fix src/ || { echo "⚠️ Warning: ESLint --fix failed, continuing..." } ``` Relevant commands from `references/validate-js.sh`: ```bash npx eslint src/ npx prettier --check src/ npx vitest run --coverage ``` ### Technical Analysis `npx` may resolve and download a package from the configured npm registry when the corresponding local executable is unavailable. These invocations do not specify exact versions and do not require offline, lockfile-backed resolution. Consequently, the code executed by the validation step can change after the Skill has been audited. A compromised registry package, compromised package release, malicious registry mirror, or unsafe npm configuration could cause arbitrary package code to execute with the Agent's privileges. The implementation also contradicts the Skill's own documented restriction in `SKILL.md`, which states that `npx` is allowed only with pinned versions. The Angular commands using `--write` and `--fix` additionally grant the resolved tool permission to rewrite project source files. ### Attack Path 1. The project does not have the requested ESLint, Prettier, or Vitest executable installed locally, or package resolution is redirected through attacker-controlled npm configuration. 2. The Agent runs one of the validation scripts. 3. ` ...[truncated 1004 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not allow validation scripts to download packages implicitly. 2. Require dependencies to be declared in the project manifest and locked by a committed lockfile. 3. Execute only project-local binaries, for example through an offline/no-install mode that fails if the dependency is absent. 4. Verify lockfile integrity before execution and use reproducible installation controls such as `npm ci`. 5. If remote package retrieval is unavoidable: - Pin an exact version rather than a range or tag. - Use a trusted registry. - Enforce package integrity metadata. - Require explicit user approval before downloading and executing it. 6. Align the scripts with the existing `SKILL.md` rule that permits `npx` only with pinned versions. 7. Run third-party validation tools in a restricted environment with minimum filesystem access, filtered environment variables, and constrained network access. 8. Prefer non-mutating checks during audit validation. Make `--write` and `--fix` separate, explicitly approved operations. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:401
Finding
Skill instructs the Agent to remove repository analysis configuration outside the required remediation scope<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, line 401 **Vulnerability Type**: Excessive repository modification and destructive configuration removal **Risk Level**: High ### Vulnerable Instruction ```text - ✅ Remove SonarQube scanner files that may be present, such as `sonar-project.properties`, `sonar-scanner.properties`, etc. Also remove other scanners, such as the `SonarScanner for Maven` usually present in the POM.xml, since our pipeline is autonomous and does not depend on these files to work. (For now, keep only SonarQube-related configurations in `.csproj` files). ``` ### Technical Analysis The declared primary function is to download SonarQube issues, classify them, generate remediation specifications, and hand implementation to another Skill. Removing existing scanner configuration or editing scanner integrations out of `pom.xml` is not required for those operations. The instruction applies broadly rather than limiting removal to files directly implicated by a downloaded issue. It can therefore cause the Agent to use repository write privileges outside the minimum scope authorized by the task. The instruction is also internally inconsistent with the local scanning workflow: `references/sonar-local-scan.sh` uses and may create `sonar-project.properties`, while this instruction directs the Agent to remove that configuration. ### Attack Path 1. A user invokes the Skill to analyze or remediate SonarQube issues. 2. The Agent follows the completion requirements in `SKILL.md`. 3. The Agent deletes `sonar-project.properties` or `sonar-scanner.properties`, or removes scanner configuration from `pom.xml`. 4. The repository's established CI/CD analysis configuration is lost or altered. 5. Subsequent builds or security-analysis jobs fail, use incomplete settings, or stop reporting expected findings. ### Impact Assessment The instruction can exercise the Agent's repository write permission beyond the task's legitimate need. Potential ...[truncated 489 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the blanket instruction to delete SonarQube and build-tool scanner configuration. 2. Preserve all existing scanner files and build integrations by default. 3. Modify scanner configuration only when: - A specific downloaded SonarQube issue directly requires it. - The change is narrowly scoped. - The effect is documented. - The user explicitly approves destructive or CI-affecting changes. 4. Before any proposed removal, display the exact files and configuration entries that would change. 5. Use version-control diffs and create backups or rely on reversible edits. 6. Reconcile the local-scan workflow with repository policy so that one phase does not create configuration another phase deletes. 7. Keep generated temporary scan configuration outside tracked project files when possible. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/sonar-local-scan.sh:62
Finding
Local SonarQube scan exposes credentials in process arguments and falls back to a hardcoded default credential<![CDATA[ ## Vulnerability Details **File Location**: `references/sonar-local-scan.sh`, lines 62-65 **Vulnerability Type**: Command-line secret exposure and insecure default credential **Risk Level**: Medium ### Vulnerable Code ```bash sonar-scanner \ -Dsonar.projectKey="$PROJECT_KEY" \ -Dsonar.host.url="http://localhost:9000" \ -Dsonar.login="${SONAR_TOKEN:-admin}" ``` ### Technical Analysis The scanner credential is supplied through the `-Dsonar.login=...` command-line argument. On systems where process arguments are visible to other users or monitoring software, the active SonarQube token can be disclosed. When `SONAR_TOKEN` is absent, the script silently substitutes the hardcoded value `admin`. This encourages operation with a default credential and makes authentication behavior ambiguous. If the local SonarQube instance still accepts that credential, any local process or user aware of the default may gain the same access. The use of HTTP is constrained to `localhost:9000`, reducing remote network interception risk, but local proxies, diagnostics, process monitors, or other same-host actors may still observe scanner activity or credentials. ### Attack Path 1. A user exports a valid `SONAR_TOKEN` and invokes the local scan script. 2. The script starts `sonar-scanner` with the token embedded in a command-line property. 3. Another local process or monitoring component records or inspects the scanner arguments. 4. The token is recovered and reused against the local SonarQube instance. 5. Alternatively, no token is configured and the script attempts the known `admin` fallback. 6. If that credential is accepted, an attacker with access to the endpoint can use the same credential. ### Impact Assessment An attacker who obtains the token gains the permissions granted to that SonarQube account, potentially including access to source-analysis findings, project configuration, issue metadata, or administrative functions. The endpoint is explicitly l ...[truncated 284 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `${SONAR_TOKEN:-admin}` fallback and fail safely when no explicit credential is configured. 2. Never embed the token in ordinary command-line arguments. 3. Use the scanner's supported protected environment-variable or secured configuration mechanism. 4. Ensure any generated credential file has mode `0600`, is excluded from version control, and is securely deleted after use. 5. Bind the development SonarQube service strictly to loopback unless remote access is explicitly required and protected. 6. Require users to replace default SonarQube credentials during installation. 7. Avoid logging complete scanner invocations and disable shell tracing around the scan command. 8. Grant the local scan token only the minimum project-analysis permissions required. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (40)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Scala build and coverage tooling are active codebase operations, not merely issue analysis. The discrepancy makes the skill more dangerous because build tools can execute repository-controlled code or plugins.

Intent-Code Divergence

High
Confidence
97% confidence
Finding
The skill contains contradictory instructions: one section says not to implement code, while others require issues to be fixed, tests added, and validation/formatting run. Contradictory operational guidance is dangerous in agent workflows because it obscures whether the skill is read-only or code-modifying, increasing the chance of unauthorized changes.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The skill instructs removal of SonarQube and scanner-related configuration files even though its stated purpose is issue analysis and SPEC generation. This is dangerous because it can degrade security/quality controls, disrupt CI, and remove organizational scanning safeguards from the repository.

Context-Inappropriate Capability

High
Confidence
96% confidence
Finding
The skill is described as analyzing SonarQube issues and producing SDDs, but this script can lint, rewrite files, run tests, and perform a production build of an Angular project. That capability is broader than the stated purpose and increases attack surface: builds/tests can trigger arbitrary project-defined tooling, scripts, bundler plugins, and dependency code execution unrelated to SonarQube-to-SDD transformation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill invokes shell commands, network access, and repository-modifying workflows but declares no explicit tool scope such as allowed-tools or permissions. In an agent environment, this broad implicit capability increases the chance of unintended command execution, file modification, or network use beyond what a user expects from the metadata.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The skill says it generates SPECs and hands off implementation, but the instructions also encompass broad validation and repository modification activity. This scope inflation is risky because users may not realize the skill can transition from planning into operational changes across the repo.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The skill directs creation and modification of project files such as TODO boards and support files without a clear up-front warning that invoking it causes repository writes. Hidden write behavior is risky in shared or sensitive repositories because users may expect analysis only.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
### Cleanup of Isolated Environments (Optional)

If the user asks to remove isolated environments after completion, **list the paths first and ask for explicit confirmation** before deleting anything. Do not run `rm -rf` or `find -exec rm -rf` without consent.

```bash
# List what would be removed (do not delete automatically)
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The line explicitly states `Language: English (en-us) for content`, which is a natural-language locale constraint. Under SQP-3, forcing a specific language without offering user choice or opt-in is a policy violation, especially since the skill otherwise supports invocation in both English and Portuguese.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
This shell script creates sonar-project.properties if it does not exist and appends configuration lines based on detected project type. Although the script logs that it is creating the file, it does not clearly warn up front that it may alter repository files or append duplicate properties, which is a user-impacting file write operation.

Missing User Warnings

Medium
Confidence
82% confidence
Finding
The script reads SONAR_TOKEN from the environment and passes it to sonar-scanner via the login parameter. While this may be expected for authentication, there is no explicit warning in comments or user-facing output that the script consumes a sensitive credential from the environment.

Rp1

Medium
Category
MCP Rug Pull
Confidence
89% confidence
Finding
The script invokes `npx eslint` without pinning a specific package version, so execution may resolve to whatever is locally installed or fetch a package version at runtime. That creates a supply-chain and reproducibility risk, especially in automation, because an unexpected or compromised package version could run arbitrary code during validation.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
This file is presented as a validation script, but it performs source modifications via `prettier --write` and `eslint --fix`. In agent or automation contexts, users may reasonably expect read-only validation; silent mutation increases the risk of unintended code changes, integrity issues, and abuse of the script as a write primitive.

Static analysis

No suspicious patterns detected.