diff --git a/.machine_readable/hypatia-baseline.schema.json b/.machine_readable/hypatia-baseline.schema.json index 75d01be5..e27f6a2c 100644 --- a/.machine_readable/hypatia-baseline.schema.json +++ b/.machine_readable/hypatia-baseline.schema.json @@ -30,7 +30,7 @@ "type": { "description": "Hypatia finding type within the rule module. Two shapes exist: lowercase snake_case (`banned_language_file`, `secret_detected`) and uppercase mnemonic codes emitted by structural_drift/git_state/code_scanning_alerts (`SD022`, `GS007`, `CSA001`). Entries must use the literal value the finding carries (standards#477).", "type": "string", - "pattern": "^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3})$" + "pattern": "^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3}|[A-Z][A-Za-z0-9]+)$" }, "file": { "description": "Repo-relative path to a single file the entry exempts. Mutually exclusive with `file_pattern`.", diff --git a/scripts/apply-baseline.sh b/scripts/apply-baseline.sh index c85d3bc9..b1308ceb 100755 --- a/scripts/apply-baseline.sh +++ b/scripts/apply-baseline.sh @@ -93,8 +93,20 @@ SCHEMA_ERRORS="$(jq -r ' and (($e.rule_module|test("^[a-z][a-z0-9_]*$"))|not) then "entry[\($i)]: rule_module fails pattern: \($e.rule_module)" else empty end), + # `type` accepts three shapes, and the third is not cosmetic: + # snake_case — the Hypatia rule modules (unsafe_block, ...) + # SD007-style codes — structural_drift + # CamelCase — SCORECARD PROBE NAMES (DependencyPinning, + # BranchProtection, ...). Hypatia emits these + # verbatim from Scorecard, and without this + # alternative NO SCORECARD FINDING COULD BE + # BASELINED BY ANY REPOSITORY — the validator + # rejected the whole file with exit 2, which + # reads as "your baseline is malformed" rather + # than "this finding is unrepresentable". + # Found 2026-08-06 in metadatastician/stapeln. (if ($e.type|type) == "string" - and (($e.type|test("^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3})$"))|not) + and (($e.type|test("^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3}|[A-Z][A-Za-z0-9]+)$"))|not) then "entry[\($i)]: type fails pattern: \($e.type)" else empty end), (if ($e|has("file")) and ((($e.file|type) != "string") or ($e.file == "")) then "entry[\($i)]: file must be a non-empty string" else empty end),