git
Technical notes on web development, DevOps, and AI integration.
30 articles
- 15:42devops
Three Red Commits That Must Not Be Rewritten
A new checker gate flagged three old index commits for a missing Task trailer. Rewriting history was the wrong answer; grandfathering by record was the fix.
TL;DR: Three regen commits to COMMITS.md failed the new Task: trailer gate because they predate the rule. Rewriting history would cascade new hashes and break tooling, and hooks only run at commit time, so retroactive enforcement is impossible. The fix: a GRANDFATHER allowlist keyed by hash with a documented reason, plus a DECISIONS.md rule for all future index commits.
#git#hooks#commit-convention - 19:55devops
Remapping Evidence Hashes After a Git History Scrub
Commit hashes change in bulk when git history is rewritten. Remap Bukti evidence references via commit-map, including zero-hash handling.
TL;DR: A PII history rewrite silently killed seven commit hashes stored as evidence on an issue board. Rewriting any commit changes its hash plus every descendant's, and only the commit-map file from git filter-repo reliably maps old hashes to new ones. Fix it by remapping and verifying each hash, then store future evidence as tags or exported mappings.
#git#git-filter-repo#commit-map - 05:30security
A Mechanical Security Net Designed for Silence
A secret-scanning hook that separates findings from errors, non-blocking CI scanners, and a weekly ZAP baseline that skips gracefully.
TL;DR: gitleaks uses exit code 1 for both real leaks and scan errors, so naive hooks block commits over environment failures and get disabled. The fix: block only when exit 1 comes with a valid JSON report containing findings, warn otherwise. CI and weekly ZAP scans collect findings as reports instead of failing builds.
#security#gitleaks#github-actions - 04:56devops
A Commit Gate Needs a Sanctioned Path, Not Just a Refuser
A hook that refuses direct commits is half a gate; a wrapper promised since Task 1 but never implemented turns security into a total lock.
TL;DR: The commit wrapper subcommand was promised since Task 1 but never implemented, so the gate blocked both unsafe and sanctioned paths. The fix: a 40-line cmd_commit that validates messages via the same check path before committing, with no silent rewriting. Fail-closed testing exposed the bug; write red tests for missing sanctioned paths up front.
#git-hooks#coding-agent#bash - 04:55devops
Blocking Direct Git Commits with a PreToolUse Hook
A PreToolUse hook makes bare git commit from coding-agent sessions technically impossible, not merely forbidden in a document.
TL;DR: This commit turned the review gate from a documented convention into actual enforcement, registering a PreToolUse hook that blocks bare git commit across settings and nine agent definition files. The first real test returned exit 2 because the sanctioned wrapper didn't exist yet. That rejection proved fail-closed works: a missing part never quietly permits.
#git-hooks#coding-agent#keamanan-proses - 03:53tooling
The Auditor Uses the Same Ruler as the Gate
An audit report accused eight documentation commits of missing trailers; all eight were false positives. One filter line aligned the auditor with the gate.
TL;DR: The audit flagged nineteen commits missing Security-review trailers, but eight were false positives on QA and doc paths the commit gate has always exempt. Root cause: the auditor didn't share the gate's exemption list, so two versions of one policy drifted apart. Fix is a one-line filter reusing the gate's constant, proven red-first by a selftest.
#git#bash#testing - 03:53security
The Read-Only Audit: The Missing Half of a Commit Gate
The commit gate refuses a trailer-less message in seconds, but the configuration behind it drifts silently. A read-only sweep closes that gap.
TL;DR: The commit gate enforces a Security-review trailer but can silently vanish through a lost executable bit or a moved hooksPath. A read-only audit subcommand in review_gate.sh sweeps commits, warnings, slice-gate results, and registration, always exiting 0. The gate prevents, the audit detects; together they keep the invariant honest.
#git#bash#security - 00:55tooling
The index that was ordered to stay in sync
The board says Done, the commit index lacks the hash, and nothing protests. The fix removes the hand-copying.
TL;DR: The index was hand-maintained and drifted silently from reality, so Done cards referenced hashes it lacked. Fix: regenerate it mechanically from git log, lint that every Done card's hash exists in the index, and fail loudly on mismatches. Done is now a verified state rather than a trusted claim.
#git#linting#documentation - 14:52tooling
Two-Tier Law in a Commit Hook at KotaPortal
A commit-hook script keeps two tiers of law: broken test-marker claims block the commit, while risky surfaces like auth paths or destructive migrations only earn a logged warning.
TL;DR: The commit script has two tiers: a test marker like "characterization" hard-blocks the commit unless an exact comment line is present, while risky surfaces such as auth code, destructive migrations, or dangerouslySetInnerHTML only log a warning. Hard-blocking everything would kill velocity, and hooks can be bypassed with --no-verify. The goal is raising the cost of carelessness, not building a wall.
#git#git-hooks#security