Skip to content

SLSA level extraction falls back to a hardcoded level 2 heuristic #14

Closed

Description

@scttfrdmn

verifySLSA shells to gh attestation verify --format json and regex-extracts the SLSA level. When the regex doesn't match an explicit level but the output contains "verified", it assumes level 2:

// gh attestation verify success without explicit level = at least L2
if strings.Contains(strings.ToLower(ghOutput), "verified") { return 2 }

This can mis-report an L1 or L3 attestation as L2 — wrong in both the lenient and strict direction for a --min-slsa-level gate. The regex (?i)slsa[^"]*level["\s:]+(\d) is also fragile to gh output format changes and doesn't bound the captured digit.

Fix

Parse the gh attestation verify --format json output structurally (the predicate carries the builder + provenance), derive the level from the actual SLSA predicate rather than a substring heuristic, and treat "verified but level indeterminate" as a distinct state (not a silent L2). Add tests with captured gh JSON fixtures.

Refs: internal/verify/verify.go verifySLSA / extractSLSALevel.

Activity

  1. added
    bug
    priority:medium
    on Jun 9, 2026
  2. added 2 commits that reference this issue on Jun 9, 2026
    35a4cc7
    abf18b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions