diff --git a/crates/squabble-core/data/first-line-rules.tsv b/crates/squabble-core/data/first-line-rules.tsv index d7876c2..4eef618 100644 --- a/crates/squabble-core/data/first-line-rules.tsv +++ b/crates/squabble-core/data/first-line-rules.tsv @@ -31,6 +31,7 @@ SQ-GEN-01 FIX estate-rules reports the committed REPOSITORY-MAP.adoc is stale Ru SQ-GEN-02 FIX a deed or k9 line is over 998 octets (K9-E006) Wrap the string or description, layout only deed_lint.js and k9-validate --strict pass A wrap would change a value (identifier, hash, URL) SQ-GEN-03 FIX a job with if: always() and needs: that downloads an artifact (actions/download-artifact without run-id) runs after a cancelled run and fails on the missing artifact (Hypatia WF029) Change the job condition to ${{ !cancelled() }} The workflow is valid YAML, the job still runs after failed or skipped needs, and it does not run in a cancelled run The job must run after cancellation on purpose, or the workflow is vendored or third-party SQ-GEN-04 FIX kyaml-format: is not KYAML (quintessence run 43156792336: build/container/compose.yaml) Run scripts/kyaml-format.sh and commit the layout change. The generator is named here and is never taken from the log; it needs mikefarah Go yq (Python yq corrupts the file) The output is KYAML and the repository kyaml check passes; a missing yq means the check did not run, never a pass The output is not KYAML, the formatter changes a value, or yq is not the mikefarah Go build +SQ-GEN-05 FIX a gitleaks job on a pull_request run scans the full history (fetch-depth: 0, no range) and fails on a finding that is not in the PR's own commits (Hypatia WF031; gitbot-fleet run 43430810006: 551 commits scanned, 1 leak, verdict 1; the next run on the branch, 43438916211, passed) Scan base..head on pull_request and keep a full-history scan on schedule, workflow_dispatch and push to the default branch; never remove the full-history scan; report a finding that predates the PR to the owner gitleaks over base..head passes on the PR, the full-history scan is still triggered on schedule, dispatch or the default branch, and the older finding is reported, not hidden The finding is inside base..head (a real secret the PR adds), no full-history scan would remain, or the workflow is vendored or third-party SQ-CANON-01 FIX an instance's canon-lockstep job is an old inline copy and goes red on a canon release Run rsr-template-repo scripts/adopt-canon-lockstep.sh The canon-lockstep job passes with the lag notice The script refuses (lock coverage), or the pin itself must change (A2ML is never edited automatically) SQ-PERM-01 FIX Resource not accessible by integration at get-a-workflow-run in a job that uploads SARIF on a private repository Add actions: read to that job's permissions, with a comment that names the reason The upload step passes on a re-run The permission is already present, or the repository is public SQ-RUN-01 ACT a setup or download step fails with API rate limit exceeded and the same workflow passes on an adjacent commit Re-run the failed jobs once after the rate-limit reset, only if that commit is still the head The re-run passes It fails twice on the same commit, the log has no rate-limit text, or the step is not a setup or download step diff --git a/crates/squabble-core/src/rules.rs b/crates/squabble-core/src/rules.rs index 5b809fa..9c4bce3 100644 --- a/crates/squabble-core/src/rules.rs +++ b/crates/squabble-core/src/rules.rs @@ -51,7 +51,7 @@ use RuleClass::{Act, Fix, Noise, Owner, Refer}; /// here. const CATALOGUE_TSV: &str = include_str!("../data/first-line-rules.tsv"); -/// The 47 catalogue rows, in ADR 0004 order. +/// The 48 catalogue rows, in ADR 0004 order. /// /// The data file ships inside the crate, so a malformed row is a defect in /// this crate that a caller cannot repair. The catalogue never loads short: @@ -957,16 +957,16 @@ mod tests { #[test] fn shipped_catalogue_file_parses() { let parsed = parse_catalogue(CATALOGUE_TSV).expect("the shipped data file is well formed"); - assert_eq!(parsed.len(), 47); + assert_eq!(parsed.len(), 48); } #[test] fn catalogue_shape() { - assert_eq!(CATALOGUE.len(), 47); + assert_eq!(CATALOGUE.len(), 48); let uniq: HashSet<_> = CATALOGUE.iter().map(|r| r.id).collect(); - assert_eq!(uniq.len(), 47); + assert_eq!(uniq.len(), 48); let n = |c| CATALOGUE.iter().filter(|r| r.class == c).count(); - assert_eq!(n(Fix), 20); + assert_eq!(n(Fix), 21); assert_eq!(n(Act), 5); assert_eq!(n(Refer), 3); assert_eq!(n(Owner), 16); diff --git a/docs/decisions/0004-first-line-rule-catalogue.adoc b/docs/decisions/0004-first-line-rule-catalogue.adoc index a28853e..71d933f 100644 --- a/docs/decisions/0004-first-line-rule-catalogue.adoc +++ b/docs/decisions/0004-first-line-rule-catalogue.adoc @@ -148,6 +148,12 @@ holds, or when its check does not pass on the PR head. | The output is KYAML and the repository's kyaml check passes. A missing `yq` means the check did not run, never a pass. | The output is not KYAML, the formatter changes a value, or `yq` is not the mikefarah Go build. +| SQ-GEN-05 | FIX +| A gitleaks job on a `pull_request` run scans the full history (`fetch-depth: 0` and no range) and fails on a finding that is not in the PR's own commits. Seen in gitbot-fleet run 43430810006 (`scan / gitleaks`: 551 commits scanned, 1 leak, verdict 1); the next run on the same branch, 43438916211, passed. Detection is Hypatia WF031, a static workflow rule; this row only fixes it. +| Scan `base..head` on `pull_request`, and keep a full-history scan on `schedule`, `workflow_dispatch` and push to the default branch. Never remove the full-history scan. Report a finding that predates the PR to the owner; it is not hidden by the narrower range. +| `gitleaks` over `base..head` passes on the PR, the full-history scan is still triggered on schedule, dispatch or the default branch, and the older finding is reported. +| The finding is inside `base..head` (a real secret that the PR adds), no full-history scan would remain, or the workflow is vendored or third-party. + | SQ-CANON-01 | FIX | An instance's `canon-lockstep` job is an old inline copy and goes red on a canon release although its pin is provenance. | Run rsr-template-repo `scripts/adopt-canon-lockstep.sh` (replaces only that job and `scripts/canon-pin-check.sh`). @@ -387,6 +393,7 @@ and fix belongs to the squabbler. | `dependabot_ecosystem_mismatch` | SQ-TOOL-02 | config fix | `repository_map_stale` | SQ-GEN-01 | one to one | `kyaml_format` | SQ-GEN-04 | generator named in the rule +| `gitleaks_full_history_on_pr` (WF031) | SQ-GEN-05 | static fix; detection is Hypatia's | `ruleset_blocks_push` | SQ-OWN-13 | owner | `uuid_conformance` | SQ-OWN-14 | owner | `sonar_not_authorized` | SQ-OWN-15 | owner @@ -405,8 +412,8 @@ base). == Consequences -* 25 rules are first-line (20 `FIX`, 5 `ACT`), 3 are referrals, 16 are - owner-only and 3 are noise; 47 in all. Every rule names its check and its +* 26 rules are first-line (21 `FIX`, 5 `ACT`), 3 are referrals, 16 are + owner-only and 3 are noise; 48 in all. Every rule names its check and its referral condition. * A fix that changes code (`SQ-CODE-nn`) is first-line only when the code-fix guard passes on its diff, so a fix that could weaken a check never runs at