Skip to content

sonarcloud.yml runs the PR's Python test code with the SonarCloud token in the job environment #1392

Closed

Description

@don-petry

Coverage generation executes the queued revision's Python code with the analysis credential inherited from the job environment. Contributor-controlled code admitted to the queue can read that credential before the change merges.

Location: .github/workflows/sonarcloud.yml:37
Severity: low · Rule: CWE-200 · Reachability: external
Subsystem: Event-driven automation and agents

Evidence

  • Source/control: Contributor changes to the selected test, its imported validator, or other Python code loaded during test execution.
  • Sink/decision: Python execution through pytest with SONAR_TOKEN in its environment.
  • Missing mitigation: Contributor-selected coverage code and the credentialed scanner share a runner and security context. There is no isolation preventing that code from reading the analysis credential.

Assumptions
Based on these assumptions: A3 (Deployment configuration): The documented merge-queue deployment uses the shipped workflow and PR approval policy.; A4 (Third-party behavior): GitHub Actions follows its documented merge_group behavior: checkout defaults to the event revision, and a configured repository secret is available to this base-repository job.
Findings that rely on assumptions are published at medium severity at most. If an assumption does not hold for your deployment, dismiss this finding.

Reachability call stack
  1. .github/workflows/sonarcloud.yml:15 — merge_group entrypoint
  2. .github/workflows/sonarcloud.yml:25 — SONAR_TOKEN assigned to the job environment
  3. .github/workflows/sonarcloud.yml:27 — checkout of the event revision
  4. .github/workflows/sonarcloud.yml:32 — install checked-out Python requirements
  5. .github/workflows/sonarcloud.yml:37 — execute contributor-selected Python through pytest [sink]
  6. test/feature-ideation/test_validate_signals.py:17 — execute the checked-out validator during test collection

Filed from a CodeRabbit security scan (scan 2d23b5ee-606a-403f-b407-81ddebdb0115, revision 1ea9ee1fbecc). Finding IDs: aa7bb943-17b5-409f-ae50-d430101e8e52. CodeRabbit notes that findings relying on its stated assumptions are capped at medium severity; dismiss if an assumption does not hold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressAn agent is actively working this issuesecuritySecurity-related PRs and issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions