Skip to content

Story: ENFORCE — check_gitignore_baseline at error severity via the compliance engine #799

Closed

Description

@don-petry

ENFORCE — harden the compliance check to error/blocking via the existing compliance engine

Blocked by STORY1 (needs the BEGIN/END markers to detect the block). Runs on the same weekly compliance-audit-and-improvement.yml engine — no new workflow.

Current gap

  • pp_check_gitignore_secrets_block() in scripts/lib/push-protection.sh verifies only 3 substrings (.env, *.pem, *.key) at warning severity. A repo can be missing 390 baseline lines and still pass.

Deliverables

  1. New/upgraded check — check_gitignore_baseline (in compliance-audit.sh, or evolve the existing pp_check_gitignore_secrets_block):
    • Fetch repo .gitignore; locate the BEGIN … END petry-projects secrets baseline block.
    • Compare the block against the canonical block in .github/.gitignore (recommend a content hash of the marker span for a cheap exact-match; tolerate trailing-newline).
    • Severity = error (blocking tier), standard ref standards/gitignore-standard.md#….
    • Findings: no .gitignore / baseline block missing / baseline block drifted (hash mismatch).
  2. L2 stays free — anything below the END marker is never inspected; per-repo ecosystem/OS entries never trip the check.
  3. Retire the weak 3-pattern path (PP_REQUIRED_GITIGNORE_PATTERNS) once the block check supersedes it; keep the standard-ref anchor updated.
  4. Add/extend compliance-audit-tests.yml fixtures: compliant, missing-block, drifted-block, block-present-with-L2-extensions.

Enforcement note

  • Primary gate = error severity in the compliance engine (per decision + "leverage the compliance workflow"). Optionally, for a true PR-time gate, add a one-line assertion to the standard ci.yml so it becomes a required status check — flag if wanted; not required for this story.

Acceptance

  • check_gitignore_baseline reports error when the marker block is missing or drifted; passes when present + unmodified.
  • Repos with valid L2 extensions below END still pass.
  • Compliance-audit tests cover the four fixtures and are green.

Blocked by #797.

Activity

  1. don-petry commented on Jul 19, 2026

    @don-petry
    ContributorAuthor

    Part of Epic #801.

  2. don-petry commented on Jul 19, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead Implementation Plan

    Issue: #799 — Story: ENFORCE — check_gitignore_baseline at error severity via the compliance engine

    Scope

    Replace the weak 3-substring, warning-severity .gitignore check with a marker-block hash-drift check (pp_check_gitignore_baseline) that fires at error severity by comparing the repo's BEGIN … END petry-projects secrets baseline span against the org canonical block, leaving all L2 (below-END) entries free.

    Implementation Checklist

    • scripts/lib/push-protection.sh — add BEGIN/END marker constants, canonical-.gitignore path, pp_extract_baseline_block + pp_sha256 helpers, and pp_check_gitignore_baseline (findings: no .gitignore / baseline block missing / baseline block drifted; severity error; ref standards/gitignore-standard.md)
    • scripts/lib/push-protection.sh — retire PP_REQUIRED_GITIGNORE_PATTERNS + pp_check_gitignore_secrets_block; call the new check from pp_run_all_checks
    • scripts/compliance-remediate.sh — rename routing case gitignore_secrets_block → gitignore_baseline with baseline-copy guidance
    • standards/gitignore-standard.md + standards/push-protection.md — update enforced-by / compliance-check / severity-table references
    • .github/workflows/compliance-audit-tests.yml — trigger on scripts/lib/** and shellcheck the lib so the new check is gated

    Tests to Write

    • test/scripts/compliance-audit/gitignore-baseline.bats — four fixtures: compliant (pass), missing-block (error), drifted-block (error), block-present-with-L2-extensions (pass)
    • Update test/scripts/compliance-remediate/routing-messages.bats to the renamed gitignore_baseline check

    Test Command

    bats test/scripts/compliance-audit/ test/scripts/compliance-remediate/ plus bash .dev-lead/scripts/dev-lead-lint.sh

  3. don-petry commented on Jul 19, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead: Implementation Complete

    Plan Execution

    • Added pp_check_gitignore_baseline (marker-block SHA-256 drift check, error severity) + pp_extract_baseline_block / pp_sha256 helpers in scripts/lib/push-protection.sh
    • Retired PP_REQUIRED_GITIGNORE_PATTERNS + pp_check_gitignore_secrets_block; wired the new check into pp_run_all_checks
    • Renamed remediation routing case → push-protection/gitignore_baseline with baseline-copy guidance
    • Updated standards/gitignore-standard.md (compliance-check section) + standards/push-protection.md (findings table: error)
    • Extended compliance-audit-tests.yml to trigger on scripts/lib/**
    • Added 4 fixtures (compliant / missing-block / drifted / block-with-L2) as bats tests; updated the remediate routing test

    Test Results

    1..8
    ok 1 compliant .gitignore (verbatim block) → no finding
    ok 2 verbatim block with extra trailing newlines still passes (trailing-newline tolerant)
    ok 3 no .gitignore at all → error finding
    ok 4 .gitignore without the marker block → error finding
    ok 5 block with an edited line inside the markers → drift error
    ok 6 block with an extra line injected inside the markers → drift error
    ok 7 verbatim block followed by L2 ecosystem/OS entries → no finding
    ok 8 L2 re-adding a broad pattern below END does not trip the check (only the block is inspected)
    
    # full suites tail:
    ok 165 copilot-instructions-missing-language-links routes to the content-agent path
    ok 166 applies PATCH to security_and_analysis for non_provider_patterns_enabled
    ok 167 applies PATCH to security_and_analysis for secret_scanning_non_provider_patterns (legacy alias)
    ok 168 dry-run does not call the GitHub API but records the planned change
    ok 169 failed PATCH is reported as a failure
    ok 170 non-remediated push-protection findings still hit the skip path
    

    Also green: bash .dev-lead/scripts/dev-lead-lint.sh and shellcheck --severity=warning on the lib, audit, and remediate scripts.

    Files Changed

    • scripts/lib/push-protection.sh: new baseline-block hash check at error severity; retired the weak 3-substring/warning path
    • scripts/compliance-remediate.sh: routing case renamed to gitignore_baseline
    • standards/gitignore-standard.md, standards/push-protection.md: docs + findings-table updates
    • .github/workflows/compliance-audit-tests.yml: trigger on scripts/lib/**
    • test/scripts/compliance-audit/gitignore-baseline.bats: new (8 tests over the 4 fixtures)
    • test/scripts/compliance-remediate/routing-messages.bats: updated for the renamed check

    Notes

    • Everything below the END marker is never inspected — verified by two L2-extension fixtures (including one that re-adds *.pem in L2). Trailing-newline tolerance verified. A missing/unreadable canonical .gitignore fails safe (fires a finding rather than silently passing every repo). The optional ci.yml PR-time assertion was left out as the issue marks it not-required — flag if wanted.
  4. added a commit that references this issue on Jul 19, 2026
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

    dev-leadFor dev-lead agent pickupenhancementFeature requests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions