Commit Graph
325 Commits
Author SHA1 Message Date
Jeffrey Montoya 2ec52af6d0 perf(gateguard): profile a change only when used and check its window first 2026-09-30 12:13:18 -04:00
Jeffrey Montoya b7f80ff012 perf(gateguard): load modules and parse searches only when a call needs them 2026-09-30 11:35:49 -04:00
Jeffrey Montoya b15c0538f6 refactor(gateguard): split change profile and search filters into focused modules 2026-09-30 00:23:08 -04:00
Jeffrey Montoya 10639a0c9e fix(gateguard): gate NotebookEdit and hard-linked targets
NotebookEdit is gated as a first-touch edit of notebook_path.
A file with more than one hard link gets no credit, trivial, sibling or cap allowance.
2026-09-29 21:50:26 -04:00
Jeffrey Montoya 20eb2395e9 fix(gateguard): gate MultiEdit by its file_path and widen surface checks
Also refuses rg -z as read-only and never writes metrics through a symlink.
2026-09-29 21:50:26 -04:00
Jeffrey Montoya 6e677b008c fix(gateguard): judge comment-only edits against the file they change 2026-09-29 21:50:25 -04:00
Jeffrey Montoya 4c035dd834 feat(gateguard): record opt-in decision metrics 2026-09-29 21:50:20 -04:00
Jeffrey Montoya 15d4f169d3 feat(gateguard): gate sensitive targets in subagents
A subagent's pass does not unlock the path for the parent.
2026-09-29 21:50:19 -04:00
Jeffrey Montoya 6f0fbb6bc9 feat(gateguard): keep session-keyed state for 8 idle hours
The project-directory fallback keeps the 30-minute window.
2026-09-29 21:50:18 -04:00
Jeffrey Montoya 77ddf9a792 feat(gateguard): pass read-only shell commands before the routine gate
The first command that can change something is still gated.
2026-09-29 21:50:17 -04:00
Jeffrey Montoya c3b2a7e627 feat(gateguard): name the closest search that did not count
One sanitized line in the denial with a reason code, from the cached turn scan.
2026-09-29 21:50:15 -04:00
Jeffrey Montoya ad0d9183ff feat(gateguard): pass comment and whitespace-only edits
The file stays unchecked, so the next code change is still gated; counted in trivial_allows.
2026-09-29 21:50:14 -04:00
Jeffrey Montoya 10f67715b1 feat(gateguard): ask code questions that fit the change
Stable question ids; local call sites instead of importers when no public
declaration is touched; data question only when the change handles data.
2026-09-29 21:50:13 -04:00
Jeffrey Montoya 979d5be822 docs(gateguard): move code rationale to design notes 2026-09-29 21:50:12 -04:00
Jeffrey Montoya ea86d156fe refactor(gateguard): move search evidence and state helpers to lib 2026-09-29 21:50:12 -04:00
Jeffrey Montoya bd12ff4cfa fix(gateguard): recognise all PowerShell -Exclude spellings
Filter parameters resolve by unambiguous prefix, colon form and comma lists.
Unresolvable parameters and their values are never a stem source.
2026-09-29 21:50:11 -04:00
Jeffrey Montoya e5b95ce921 fix(gateguard): match glob bracket classes exactly
Include and exclusion globs now honour class members, ranges and negation.
A malformed class admits nothing as an include and covers the target as an exclusion.
2026-09-29 21:50:11 -04:00
Jeffrey MontoyaandSulimanAbdulrazzaq e98a9da288 feat(gateguard): improve first-touch signal quality and session efficiency
- Ask class-specific first-touch questions (instruction, test, prose,
  config, code); code questions are unchanged.
- Credit a completed Glob/Grep/LS or shell search from the current human
  turn that covered the target; Read and exclusion globs never count.
- Collapse same-class new-file creations in one directory within a turn.
- Add opt-in GATEGUARD_FACT_FORCE_MAX_DENIALS session cap (from #2755).
- Always gate sensitive targets, judged on lexical and real paths.
- Canonicalize checked-path keys.

Closes #2608

Co-authored-by: SulimanAbdulrazzaq <suliman9000a@gmail.com>
2026-09-29 21:49:46 -04:00
affaan-m 93fca4a604 Merge reviewed Biome-filename correction from PR2835
Source-PR: https://github.com/affaan-m/ECC/pull/2835
Source-Head: 7ffea7091a
2026-09-28 07:07:45 -04:00
affaan-m e10bbaa492 Merge reviewed append-assignment correction from PR2965
Source-PR: https://github.com/affaan-m/ECC/pull/2965
Source-Head: eca846248d
2026-09-28 07:07:45 -04:00
affaan-m 7ffea7091a fix(hooks): distinguish Biome configs from results files
Preserve the original contributor histories and apply the exact independently reviewed repair.

Source-Parent: 74023e5689
Review-Manifest-SHA256: 208a6350119857df7c1e5b83a46cdba0b7f7399f58ed60167397920c7a21b454
2026-09-28 07:07:07 -04:00
affaan-m eca846248d fix(hooks): track append assignments in Git override checks
Preserve the original contributor histories and apply the exact independently reviewed repair.

Source-Parent: dee884656e
Review-Manifest-SHA256: 0c7eeef7c2722a605d049daf2dc3c2473c10dd616005afcba21049fc036d8ce9
2026-09-28 07:05:14 -04:00
affaan-m 807f07a687 Merge reviewed Git environment scope correction for PR2965
Source-PR: https://github.com/affaan-m/ECC/pull/2965
Source-Head: dee884656e
2026-09-28 05:39:46 -04:00
affaan-m dee884656e fix(hooks): preserve Git configuration across shell command scopes
Preserve contributor history while applying the exact reviewed current-main repair.

Source-PR: https://github.com/affaan-m/ECC/pull/2965
Source-Parent: ec0753bc7f
Review-Manifest-SHA256: 0172e3e695e672305f9bc41b0d385d2a299d8ec520c763dd9d7f6da743f76971
2026-09-28 05:38:05 -04:00
affaan-m da2edcb740 Merge reviewed PR2835 qualified configuration protections
Preserve exact-file protections, all shared assertions and private cleanup.

Source-PR: https://github.com/affaan-m/ECC/pull/2835
2026-09-28 05:01:22 -04:00
affaan-m 78dee5c829 Merge reviewed PR2845 configuration filename protections
Source-PR: https://github.com/affaan-m/ECC/pull/2845
2026-09-28 04:58:30 -04:00
affaan-m 74023e5689 fix(config-protection): protect qualified shared linter configurations
Preserve contributor history while applying the exact reviewed current-main repair.

Source-PR: https://github.com/affaan-m/ECC/pull/2835
Source-Parent: e58bb26647
Integration-Main: d3b8a3e908
Review-Manifest-SHA256: 2b591ee5fc545e0d552a58dd6f473f196ca773a194c33b87359f5c0447187e26
2026-09-28 04:50:09 -04:00
affaan-m 339db5b0be fix(config-protection): guard current config and ignore filenames
Preserve contributor history while applying the exact reviewed current-main repair.

Source-PR: https://github.com/affaan-m/ECC/pull/2845
Source-Parent: e19e74a7fc
Integration-Main: d3b8a3e908
Review-Manifest-SHA256: 02ef909e8553e93554ec8fb615b9299fd3ee6a0d7dc250ee2375ce80ce538060
2026-09-28 04:49:31 -04:00
affaan-m 442179e7d6 Merge exact reviewed PR2829 follow-up
Source-PR: https://github.com/affaan-m/ECC/pull/2829
Source-Head: 2b9164c042
Review-Manifest-SHA256: 16b9e4c854b6cfc38efc99d0913fe7f3018a68b9b1c194b50f4a1e06511975cd
2026-09-28 04:07:07 -04:00
affaan-m f4528c48a7 Merge exact reviewed PR2965 follow-up
Source-PR: https://github.com/affaan-m/ECC/pull/2965
Source-Head: ec0753bc7f
Review-Manifest-SHA256: 53ead3eb859a4c6c13d6751b1fe4f9a94f1a5d35a37430f6b8524c50e903490b
2026-09-28 04:07:07 -04:00
affaan-m 2b9164c042 fix(gateguard): inspect SQL clients behind supported launchers
Preserve contributor history while applying the exact reviewed current-main repair.

Source-PR: https://github.com/affaan-m/ECC/pull/2829
Source-Parent: c4b18b452d
Review-Manifest-SHA256: 16b9e4c854b6cfc38efc99d0913fe7f3018a68b9b1c194b50f4a1e06511975cd
2026-09-28 03:56:57 -04:00
affaan-m ec0753bc7f fix(hooks): preserve shell boundaries and detect literal hook bypasses
Preserve contributor history while applying the exact reviewed current-main repair.

Source-PR: https://github.com/affaan-m/ECC/pull/2965
Source-Parent: de480c65fd
Review-Manifest-SHA256: 53ead3eb859a4c6c13d6751b1fe4f9a94f1a5d35a37430f6b8524c50e903490b
2026-09-28 03:56:48 -04:00
affaan-m 609427cacc Merge commit 'de480c65fdbbdf8b0b6ffce0f16c0968791c5fbd' into affaan/integrate-reviewed-followups-20260928 2026-09-28 02:27:57 -04:00
affaan-m de480c65fd fix(hooks): distinguish literal data from executable shell contexts
Preserve original contributor history and all current-main assertions while bounding quote, heredoc, shell-option and deferred-scan handling.

Source-PR: https://github.com/affaan-m/ECC/pull/2965
Source-Parent: 5a878131de
Main-Parent: d3b8a3e908
Review-Manifest-SHA256: 5d23f47e60516b66733805aec0ebcd47f19265c964529fa0b1220c8aa6903add
2026-09-28 02:27:11 -04:00
affaan-m c4b18b452d fix(gateguard): classify standard launcher and GNU time options
Preserve contributor history and current-main behavior while resolving the exact reviewed follow-up.

Source-PR: https://github.com/affaan-m/ECC/pull/2829
Source-Parent: d811349224
Review-Manifest-SHA256: a7209685b2a5726777f7450a5983c28add8759654969b09ba3e4b803fcfaf8bd
2026-09-28 01:06:31 -04:00
affaan-m d811349224 fix(gateguard): detect stdin dd writes and launcher-wrapped shells 2026-09-27 22:25:29 -04:00
affaan-m a74c743370 fix(gateguard): classify literal dd execution without matching passive text
Preserve the contributor repair and current main protections. Handle operand ordering, bounded literal command wrappers, executable containers and find actions while keeping quoted prose and option values passive.

Source-PR: https://github.com/affaan-m/ECC/pull/2829
Source-Head: c88b3f879a
Integration-Main: d3b8a3e908
2026-09-27 21:50:09 -04:00
xsfandGitHub bf70150eb2 fix(gateguard): sanitize dangerous invisible unicode in denial paths (#3103)
* fix(gateguard): sanitize dangerous invisible unicode in denial paths

sanitizePath only stripped control characters and bidi overrides, so
the 394 codepoints that the repo-wide unicode safety policy classifies
as dangerous-invisible (zero-width U+200B-200D, U+2060, U+2061-2064,
variation selectors U+FE00-FE0F, tag block U+E0000-E007F, Hangul
fillers, U+FEFF, U+180E, U+3164) plus the U+2028/U+2029 line and
paragraph separators passed verbatim into Edit/Write denial messages.
Invisible characters in a quoted file path let a malicious path look
clean to a human reviewer.

Align sanitizePath with the CI policy list and cover it with a
hook-output regression test that asserts no dangerous invisible
character survives into the denial reason while visible path text
stays intact.

* refactor(gateguard): name the sanitizePath unicode policy constants

Address review feedback: move the code points and ranges out of
sanitizePath into descriptive constants mirroring
scripts/ci/check-unicode-safety.js, so the policy is auditable in one
place. Also seed the regression test input with U+2029 so the
paragraph-separator assertion is exercised rather than vacuous.

* fix(gateguard): sanitize C1 control characters in denial paths

Follow-up on the sanitizePath policy alignment: the Unicode C1 control
block (U+0080..U+009F) is invisible in every renderer like the ASCII
controls below 0x20, but the strip only covered the ASCII range. Add
C1_CONTROLS to the policy constants and seed U+0091 into the
regression test input.
2026-09-21 14:40:16 -04:00
Varun GoreandGitHub 7b7dfc6412 fix(gateguard): detect destructive SQL passed quoted to SQL clients (#3107)
* fix(gateguard): detect destructive SQL passed quoted to SQL clients

Quoted SQL like psql -c "drop table users" was stripped before the DESTRUCTIVE_SQL_DD regex ran, making it unreachable. Check dequoted tokens for known SQL clients (psql, mysql, sqlite3, ...) so real invocations are gated while git commit -m / echo mentions stay allowed. Fixes affaan-m/ECC#3024.

* fix(gateguard): unwrap sudo/env flags and ignore SQL string literals

Address review: sudo -u/env VAR= wrappers now resolve to the real SQL client; SQL single/double/dollar-quoted literals are stripped before the destructive regex so SELECT 'drop table' stays allowed. Adds deny/allow regression tests for quoted SQL, wrappers, literals, and non-SQL clients.

* test(gateguard): cover env PGPASSWORD wrapper variant

* fix(gateguard): close wrapper sh-c, env dir, tagged literal gaps

Review 5189686662: recurse sh -c from unwrapped wrapper index (sudo/doas/env + sh -c now denied); consume env -C/--chdir separate values; strip tagged dollar-quoted literals ($tag$...\baseline). Tests: 200 passed.
2026-09-21 14:39:17 -04:00
Sedat DağandGitHub c056ae7df2 fix(hooks): support python style comments in pre-commit quality checks (#3194)
* fix(hooks): support python style comments in pre-commit quality checks

fix(hooks): support python style comments in pre-commit quality checks

* fix: reject whitespace-only TODO messages

* fix: reject whitespace-only TODO messages

* test: add cases for hash-prefixed comments and string limitations
2026-09-21 14:33:19 -04:00
Affaan MustafaandGitHub fc9273e5e0 Merge pull request #3126 from VarunGore36/fix/reviewer-followups
fix(security): security follow-ups for worker, installer, claw, hooks
2026-09-19 19:58:43 -04:00
Affaan MustafaandGitHub 0a5207b6f2 Merge pull request #3102 from wellkilo/perf/metrics-tail-read
perf(metrics): cache cumulative session costs
2026-09-19 17:00:05 -04:00
Affaan MustafaandGitHub 07756cee15 fix(gateguard): gate ref- and history-destroying git commands (#3154, #3151) (#3170)
branch -D, stash drop/clear, reflog expire/delete, update-ref -d, restore (except --staged alone), and force-with-lease pushes to shared branches now hit the destructive gate. 238 hook tests pass; 49 CI checks green.
2026-09-19 02:58:33 -04:00
Affaan MustafaandGitHub f6eb800474 fix(session-start): scope summary lookup to repository identity (#3160) (#3168)
Windows: compare repo identity via normalizeRepoPath/sameRepoIdentity (8.3 short names, case, separators; inode fallback). All nine windows-latest jobs green on 52587005.
2026-09-19 02:08:50 -04:00
Affaan MustafaandGitHub 4007e25b58 Merge pull request #3157 from Frank-zhu0404/fix/issue-2886-heredoc-gateguard
fix(gateguard): ignore heredoc prose for tee and path-qualified sinks
2026-09-18 21:10:25 -04:00
Affaan MustafaandGitHub 09ae8be2bd Merge branch 'main' into fix/issue-2886-heredoc-gateguard 2026-09-18 21:03:40 -04:00
Affaan MustafaandGitHub 66462a5bf1 Merge branch 'main' into fix/3136-gateguard-batch-consistency 2026-09-18 21:03:31 -04:00
He DongandGitHub 8bf16ccfec fix(hooks): keep silent hook paths silent (#2987)
* fix(hooks): keep silent hook paths silent

* fix(hooks): harden stream failure handling

* fix(hooks): settle interrupted input streams

* test(hooks): name stream input limits

* test(hooks): isolate PostToolUse dispatcher fixtures
2026-09-18 18:42:20 -04:00
Affaan Mustafa db61d1c76a fix(gateguard): warn that parallel-batch siblings may already be applied (#3136)
A first-touch Edit/Write denial marks the file checked so the retry
passes. Sibling edits to the same file in the same parallel batch are
therefore judged against post-denial state and silently apply, leaving
the file in a state neither version intended.

Hooks see tool calls one at a time, so a batch-wide lock is not
possible. Instead make the partial application explicit: the Edit,
Write, MultiEdit, and condensed denials now name the file and warn
that other edits from the same batch may already have been applied,
and SKILL.md tells agents to send dependent edits sequentially and
re-read the file after a gated batch.
2026-09-18 18:37:01 -04:00
Frank_zhu 7cfc9b3608 fix(gateguard): ignore heredoc prose for tee and path-qualified sinks (#2886)
Expand proven-passive heredoc recognition beyond bare `cat` so documentation
writes via `tee`, `/bin/cat`, and `command cat` no longer trip the destructive
command detector on body text, while still failing closed for shells and pipes.
2026-09-17 17:29:26 +00:00