mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-20 23:23:26 +01:00
feat(redact-prepush): committed exact-span allowlist at .gstack-redact-allowlist
The pre-push hook never fed the engine's allowlist option, so a reviewed, known-benign value (a public dev-compose URL, a documented sample key) warned or blocked every push, and the only ways out were a bypass or reshaping code until the detector stopped matching. The hook now reads the repo-root .gstack-redact-allowlist from each pushed commit (never the working tree), one exact matched span per line with # comments. Only a finding whose matched text equals an entry is suppressed: a password alone, a substring, or a different key still reports and still blocks, and engine.* unscanned findings are untouched. Every push that carries entries prints the entry count and each suppressed finding's rule and file line. Oversized files (over 64 KiB) are ignored. gstack.redact.allowEmail keeps working as before. Co-authored-by: Boyard Engels <boyard.engels@gmail.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
0668443f36
commit
33ceff32bb
4 files changed
+181
-8
No files matched your search
@@ -134,6 +134,9 @@ determined leaker (a CHANGELOG line that does would fail a hostile screenshotter
|
||||
- **Config keys:** `redact_repo_visibility` (public|private|unknown, local-only
|
||||
override for repos gh/glab can't read), `redact_prepush_hook` (true|false).
|
||||
There is intentionally NO key to disable HIGH blocking.
|
||||
- **Committed allowlist:** `.gstack-redact-allowlist` at the root of the pushed commit lists
|
||||
exact matched spans reviewed as benign; the pre-push hook suppresses only a
|
||||
finding whose span equals an entry and lists every suppression on each push.
|
||||
- **Audit:** the /spec semantic pass appends a content-free record (categories +
|
||||
body sha256, no spec text) to `~/.gstack/security/semantic-reviews.jsonl` (0600).
|
||||
|
||||
|
||||
@@ -1120,6 +1120,24 @@ up deployed, so it still blocks.
|
||||
**Fix.** Use `postgres://postgres:postgres@localhost:5432/...` in local and CI
|
||||
config, or read the URL from an env var. If the credential is real, rotate it.
|
||||
Bypass once: `GSTACK_REDACT_PREPUSH=skip git push`.
|
||||
If the URL is a reviewed, public dev-only value, list it in
|
||||
[`.gstack-redact-allowlist`](#redact-allowlist).
|
||||
|
||||
<a id="redact-allowlist"></a>
|
||||
### `.gstack-redact-allowlist (<n> entries) suppressed <m> finding(s) in this push`
|
||||
|
||||
**Meaning.** The pushed commit carries `.gstack-redact-allowlist` at the repo
|
||||
root. Each line (after trimming; `#` starts a comment) is one exact matched
|
||||
span: the whole `postgres://USER:PASSWORD@host:port` URL for
|
||||
`db.url_with_password`, the key for a key pattern, the address for `pii.email`. A finding is suppressed only when its
|
||||
matched text equals an entry, so a password alone, a substring, or a different
|
||||
key still reports and still blocks. The hook reads the file from each pushed
|
||||
commit, never the working tree, and ignores a file over 64 KiB. Every push that
|
||||
carries entries prints this line and each suppressed finding's file and line.
|
||||
It works alongside `gstack.redact.allowEmail`, which stays a local setting.
|
||||
|
||||
**Fix.** Nothing, if every listed suppression is the reviewed value. Remove an
|
||||
entry that no longer applies; rotate a credential that is real.
|
||||
|
||||
<a id="redact-version-as-ip"></a>
|
||||
### `pii.ip_public` MEDIUM on a four-part version number
|
||||
|
||||
Reference in new issue
Block a user