diff --git a/.hypatia-baseline.json b/.hypatia-baseline.json new file mode 100644 index 0000000..a63ed30 --- /dev/null +++ b/.hypatia-baseline.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "_note": "TEMPORARY gate relaxation. Remove this entry when the real egress allowlist for instant-sync.yml lands. Format is UNVERIFIED against the standards repo: built from CI log evidence only.", + "entries": [ + { + "rule": "RE002", + "file": ".github/workflows/instant-sync.yml", + "reason": "audit mode kept until instant-sync has a first successful run to observe" + } + ] +} diff --git a/.machine_readable/root-allow.txt b/.machine_readable/root-allow.txt index b5c608b..80aa355 100644 --- a/.machine_readable/root-allow.txt +++ b/.machine_readable/root-allow.txt @@ -36,6 +36,7 @@ abi.ipkg # Idris2 package for the ABI seam; sourcedir=src/inte .gitattributes .gitignore .mise.toml # toolchain pins (rust, idris2) read by mise; replaces the retired .tool-versions +.hypatia-baseline.json # Hypatia scanner baseline (RE002 temporary exemptions); read from root by the scan # ─── Directories ───────────────────────────────────────────────────────────── .devcontainer/ # VS Code dev container spec; tool-required at root diff --git a/scripts/apply-baseline.sh b/scripts/apply-baseline.sh new file mode 100755 index 0000000..90408f2 --- /dev/null +++ b/scripts/apply-baseline.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Apply .hypatia-baseline.json to a Hypatia findings file. +# Usage: apply-baseline.sh [advisory|enforce] +# UNVERIFIED: written from CI log evidence, not from the standards repo. +# Findings are a JSON array with .type (rule id) and .file (repo-relative). +# Baseline is {"entries":[{"rule","file","reason"}]}; every entry needs a reason. +# Filtered findings go to stdout. In advisory mode, nothing is dropped. +set -euo pipefail +findings=${1:?findings file}; baseline=${2:?baseline file}; mode=${3:-enforce} +jq -e '.entries | type == "array" and all(.[]; (.rule|type=="string") and (.file|type=="string") and ((.reason // "")|length > 0))' \ + "$baseline" >/dev/null || { echo "::error::invalid baseline $baseline" >&2; exit 2; } +if [ "$mode" = advisory ]; then + jq '.' "$findings" +else + jq --slurpfile b "$baseline" \ + '[.[] | select(. as $f | ($b[0].entries | any(.rule == $f.type and .file == $f.file)) | not)]' "$findings" +fi +if [ -n "${GITHUB_ENV:-}" ]; then echo "HYPATIA_BASELINE_FILTERED=true" >> "$GITHUB_ENV"; fi