Skip to content

fix(trust): bound where configuration and suppression may come from - #86

Draft
pixincreate wants to merge 3 commits into
fix/detector-accuracyfrom
fix/trust-boundaries
Draft

fix(trust): bound where configuration and suppression may come from#86
pixincreate wants to merge 3 commits into
fix/detector-accuracyfrom
fix/trust-boundaries

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Stacked on #85.

Summary

Three inputs decided what gets detected without being treated as untrusted.

Changes

  • Config discovery walked to / when the scan target wasn't inside a repository, so a .keywatch.toml in a world-writable directory (/tmp on a shared host or CI runner) could disable detectors for every scan beneath it. Config found in a world-writable directory is now ignored.
  • KEYWATCH_CONFIG_PATH was read before the trusted-mode check, so a repository could redirect the whole detector set through .envrc/direnv or a devcontainer even under --no-config-discovery. It stays an operator channel, but in trusted mode a value pointing back into the scanned tree is ignored.
  • Baseline suppression was silent. A committed .keywatch-baseline.json is repo-controlled data that removes findings; scans now print how many findings it hid and which file did it, so a suppression list can't work invisibly. The count is in the JSON report as suppressed_by_baseline.

Also: the ~ home-directory abbreviation now applies to scan output, not just hook messages.

Tests

183 pass. New: world-writable config is refused; the suppressed count is printed.

Three inputs decided what gets detected without being treated as
untrusted.

Config discovery walked to the filesystem root when the scan target was
not inside a repository, so a .keywatch.toml in a world-writable
directory such as /tmp could disable detectors for every scan beneath
it. Config found in a world-writable directory is now ignored.

KEYWATCH_CONFIG_PATH was read before the trusted-mode check, so a
repository could redirect the detector set through .envrc or a
devcontainer even for --no-config-discovery. It is an operator channel,
so it is still honoured — unless, in trusted mode, it points back into
the tree being scanned.

A discovered baseline removed findings silently. Scans now report the
number suppressed and the file responsible, so a committed suppression
list cannot hide what it is doing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant