Skip to content

Move ShellCheck SARIF conversion into a tested helper #6959

Closed

Description

@cv

Parent: #6952

Problem

The ShellCheck job in .github/workflows/code-scanning.yaml embeds a 74-line program that captures ShellCheck JSON, converts it to SARIF with a large jq filter, creates a fallback SARIF document, and decides whether upload is possible.

Work

  • Add one focused helper that accepts ShellCheck json1 input and writes validated SARIF 2.1.0 output.
  • Keep shell-file discovery, package installation, CodeQL action wiring, permissions, and SARIF upload in YAML.
  • Make ShellCheck process status and SARIF generation status explicit so findings can upload without hiding conversion failures.

Acceptance criteria

  • The large inline jq program and fallback document leave workflow YAML.
  • Error/warning/note mapping, rule de-duplication, file/region coordinates, messages, and empty-result behavior remain equivalent.
  • Malformed ShellCheck JSON fails or emits the documented empty fallback without producing invalid SARIF.
  • Direct tests validate the SARIF schema shape and representative findings.
  • The workflow still uploads findings when ShellCheck exits nonzero for findings and skips upload when there are no SARIF runs.

Activity

  1. added theissue type on Jul 15, 2026
  2. added
    area: ci
    area: architecture
    on Jul 15, 2026
  3. added
    help wanted
    on Jul 15, 2026
  4. agrovr commented on Jul 15, 2026

    @agrovr
    Contributor

    Hi! I’d like to work on this. I’ll extract the ShellCheck JSON1-to-SARIF conversion into a focused TypeScript helper, preserve the existing severity mapping, rule deduplication, locations, messages, and empty/malformed input behavior, then add direct transformation tests and thin workflow-wiring coverage. I’ll keep the implementation scoped to the requirements described here.

  5. agrovr commented on Jul 16, 2026

    @agrovr
    Contributor

    Before I finalize this, could you confirm the intended trust boundary for #6959? The current pull_request ShellCheck job declares security-events: write. My patch runs the checked-in TypeScript converter in that job and sets actions/checkout to persist-credentials: false, so the helper does not receive persisted Git credentials and is not invoked with sudo; only the preceding ShellCheck package-installation step uses sudo.

    Is that the intended design for this sub-issue, or should conversion run from a base-trusted checkout or a separate unprivileged job?

  6. added a commit that references this issue on Jul 18, 2026
    36ad7b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: architecturearea: cihelp wanted

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions