Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .machine_readable/hypatia-baseline.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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`.",
Expand Down
14 changes: 13 additions & 1 deletion scripts/apply-baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

@gitar-bot gitar-bot Bot Aug 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: type pattern fix not applied to authoritative schema

The inline jq validator in apply-baseline.sh:109 now accepts CamelCase Scorecard probe names, but the canonical schema .machine_readable/hypatia-baseline.schema.json:33 (titled the "Authoritative schema" for baselines) still has the old pattern ^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3})$. The script's own rejection message (line 136) even names this schema. Any other consumer that validates a baseline against the real JSON Schema (editors, CI, other tools) will still reject Scorecard findings, so the fix is incomplete and the two validators now disagree. Update the schema pattern to ^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3}|[A-Z][A-Za-z0-9]+)$ and extend the type description (line 31) to mention CamelCase Scorecard probe names.

Mirror the new alternative in the authoritative schema and update the neighbouring description to document CamelCase Scorecard probe names.:

"pattern": "^([a-z][a-z0-9_]*|[A-Z]{2,3}[0-9]{3}|[A-Z][A-Za-z0-9]+)$"

Was this helpful? React with 👍 / 👎

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),
Expand Down
Loading