diff --git a/plugins/guardrails/.claude-plugin/plugin.json b/plugins/guardrails/.claude-plugin/plugin.json index 1e62a2fec..4cea2f0f1 100644 --- a/plugins/guardrails/.claude-plugin/plugin.json +++ b/plugins/guardrails/.claude-plugin/plugin.json @@ -147,5 +147,5 @@ "min": 1 } }, - "version": "0.29.21" + "version": "0.29.22" } diff --git a/plugins/guardrails/CHANGELOG.md b/plugins/guardrails/CHANGELOG.md index f4cd591c8..774d281b0 100644 --- a/plugins/guardrails/CHANGELOG.md +++ b/plugins/guardrails/CHANGELOG.md @@ -3,6 +3,41 @@ All notable changes to the `guardrails` plugin are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning. +## [0.29.22] + +### Fixed + +- **A UNC file path no longer reaches telemetry whole.** `secret-pattern-detection.sh` + kept its own copy of the repo-relative computation, and that copy's redaction + tested only two of the three absolute spellings: POSIX-absolute and + drive-lettered, never UNC. This guard deliberately scans on when no project + dir is set, and on that path the copy did no separator folding either, so a + `file_path` of the `\\server\share\file` shape matched neither redaction arm + and the whole share path, server name included, landed in the envelope's + `data.file`. It now calls `hook::repo_relative_path`, which carries the UNC + arm, and pairs it with `hook::repo_root` so a file with no project dir is + still reported relative to its own checkout instead of collapsing to a bare + basename. +- **A trailing slash on the project dir no longer collapses every path.** The + helper strips `"$root/"`, so a root already ending in a separator forms the + prefix `/repo//` and matches nothing, degrading every in-project file to its + basename. The hand-rolled copies trimmed the separator first and the move to + the helper dropped that trim; both call sites now trim it back. A trailing + slash is a supported spelling of `CLAUDE_PROJECT_DIR`, which this plugin's + own scope tests already exercise. `hook::repo_root` never returns one, so the + other call sites of the helper were never exposed. + +### Changed + +- **The last two hand-rolled path redactions collapse into the shared helper.** + `hardcoded-path-check.sh` carried the same duplicated block. Its scope guard + exits before the computation whenever the project dir is unset, so the leaking + shape was never reachable there and its emitted `data.file` is unchanged; the + copy is removed so a third divergent one cannot reappear. In both hooks + `file_rel` reaches only the telemetry payload, never a tool argument, and both + now resolve it inside `emit_tel`, so a run with no telemetry sink wired does + not pay for it at all. + ## [0.29.21] ### Changed diff --git a/plugins/guardrails/hooks/guardrails-test-helpers.sh b/plugins/guardrails/hooks/guardrails-test-helpers.sh index b5bfa6361..e98a234b2 100644 --- a/plugins/guardrails/hooks/guardrails-test-helpers.sh +++ b/plugins/guardrails/hooks/guardrails-test-helpers.sh @@ -29,6 +29,13 @@ bad() { FAIL=$((FAIL + 1)) } +# assert_eq