Commit Graph
358 Commits
Author SHA1 Message Date
haelyra a3e9ddfde7 feat(gateguard): integrate evidence-aware first-touch questions 2026-10-10 17:46:23 -04:00
haelyra 58fc8f25a5 feat(qoder): integrate native plugin and SessionStart projection 2026-10-10 17:40:46 -04:00
chenhz01 3af000e143 hooks: first operand after -- is still the sed script when no script option was given
Greptile P1: sedScriptParts stopped at -- and discarded the remaining
operands, so 'sed -- <script>' skipped script collection entirely. GNU sed
4.9 (verified): with no -e/--expression anywhere, the first operand after --
is the script and an s///e in it still executes.

The operands after -- are now collected as positionals, so the existing
first-positional-becomes-script rule applies. Operands after the script stay
file names (data). 2 regression tests pin both sides. Suite: 812/812.
2026-10-11 03:55:27 +08:00
chenhz01 95964ee623 hooks: block escaped sed exec fragments conservatively; decompose sed readers
Greptile P1 findings (both verified by running GNU sed against the hook):

1. Escaped replacements evade the check: GNU sed decodes \xHH, \oOOO, \dNNN,
   case operations and unknown escapes like \g before executing an s///e
   replacement or e operand. Scanning the raw text let \x67it decode to git.
   Decoding that surface faithfully is out of scope, so any backslash in an
   exec-bearing fragment now throws UnsupportedSedEscape and the hook blocks
   with an explicit reason — mirroring the existing env -S escape precedent
   instead of pretending to interpret sed. Escaped-newline continuations of an
   e operand are refused by the same check.

2. Continued commands went unchecked: the e operand reader stopped at every
   newline, but GNU sed joins escaped newlines into one operand. Now covered
   by the same conservative refusal.

Also decomposes the sed readers into sub-50-line helpers per the repository
function-size rule (AGENTS.md): readSedDelimited, readSedCommand,
readSedExecute, readSedLineOperand, assertSedLiteral.

5 regression tests pin the escape paths and the benign boundary (a backslash
in a non-executing script stays data). Suite: 810/810.
2026-10-11 03:52:06 +08:00
chenhz01 34a7f41539 hooks: parse sed options through the whole argv — later -e scripts still execute
CodeRabbit security review (Major, CWE-693) correctly identified that GNU sed
collects -e/--expression scripts from any argv position: a script option after
positional operands is still executed, so stopping the option walk at the first
positional let an e-flagged script hide behind it.

Verified against GNU sed 4.9 before fixing:
- 'sed -e s/x/y/ - -e s/y/X/e' runs X (the later -e executes)
- with any script option present, every positional is a file operand

sedScriptParts now walks the full argv, collects scripts from all -e/
--expression positions, and only promotes the first positional to the script
when no script option was given. Unknown options after positionals still fall
back to the opaque default.

4 regression tests pin the reported bypass paths (suite: 805/805).
2026-10-11 03:38:02 +08:00
chenhz01 ffe0e36d46 hooks: model GNU sed execution — script and file operands are data, e/s///e are shell receivers
Ported from the #3051 discussion (test intent, not the old scanner):

- A confidently-parsed sed invocation whose script contains no execution
  construct is a pure text transformation: the script operand and every file
  operand are data. This removes the specific false positives where file names
  or non-executing scripts merely containing 'git ...' were blocked.
- The GNU sed `e` command (bare or with operand) and the `s` command with the
  `e` flag run text through the shell. Their literal fragments (the s
  replacement, the e operand) and any piped/redirected source are scanned as
  real shell source, closing the `printf x | sed 's/x/git commit --no-verify/e'`
  gap reported on 2026-10-09.
- Anything the literal parser cannot confidently read (addresses it cannot
  consume, -f script files, -i suffix ambiguity, unknown options, expansion
  residue) falls back to today's opaque default. No behavior changes for
  unmodeled launchers.
- shell-scan.js is untouched and remains the canonical scanner.

Tests: 14 focused cases ported from the #3051 litmus set; full hook suite
801/801.
2026-10-11 03:15:36 +08:00
calm 2d9e6977dc feat: add native Qoder plugin support 2026-10-10 20:11:00 +08:00
34a97fa898 fix: reject unsupported env split-string escapes
Validate env -S and --split-string escape syntax before shell scanning or
opaque fallback. Preserve literal single-quoted data and charge each
validation character against the shared input-proportional work budget.

Verified 787 focused cases and 290 real Git/config, harmless native env
and registered-routing controls. Keeps the prior paid-copy protection.

Co-authored-by: Nguyen Thanh Dat <ntdat812.dev@gmail.com>
Co-authored-by: Davemaina1 <dmain7015@gmail.com>
2026-10-09 21:04:20 -04:00
993b5f230f fix: guard literal Git hook redirects and env split arguments
Carry forward bounded literal include/includeIf configuration capabilities
and env -S/--split-string words from PRs #2858 and #2897. Charge array
copy and expansion work before allocation to preserve the shared quota.

Verified 731 hook cases and 60 real Git/config and registered-route
controls. Dynamic remainder and original full source PRs remain held.

Co-authored-by: Nguyen Thanh Dat <ntdat812.dev@gmail.com>
Co-authored-by: Davemaina1 <dmain7015@gmail.com>
2026-10-09 20:41:09 -04:00
montjeffrey 92947a68df Merge upstream/main into feat/gateguard-fewer-round-trips
Resolve six conflicts:
- hooks/hooks.metadata.json: keep this branch's gateguard description and
  fingerprint, add upstream's hookify-runtime entries.
- package.json: keep both gateguard-report.js and github-coordination.js.
- scripts/hooks/gateguard-fact-force.js, tests/hooks/gateguard-fact-force.test.js,
  skills/gateguard/SKILL.md: upstream added a simpler session denial cap; this
  branch already has the fuller one (cap threaded through
  markCheckedAndCountDenial, malformed-value warning, miss and target notes),
  so keep it. Upstream's taskset and su wrapper handling, fail-closed
  recursion limit and soft-hyphen sanitising merged cleanly and their tests pass.
- manifests/context-packs/skill-triggers@1.json: take upstream's file and
  recompute registryDigest for the merged registry.
2026-10-09 20:38:25 -04:00
haelyra 984d4f0701 fix: preserve Hookify Windows missing-device identity
Match the Windows missing volume-serial exception while retaining strict reported-device, inode, ownership, permission, link and snapshot checks. Add loader warning/block and race regression controls with isolated platform metadata injection.
2026-10-09 19:10:06 -04:00
haelyra 0cb1476f9d fix: pin and bound Hookify rule reads
Open with supported no-follow and nonblocking flags before relying on file metadata. Validate descriptor, pathname and rule-directory consistency before and after reading at most64KiB plus one overflow byte. Reject observed replacement, mutation, premature EOF and non-regular files, and close descriptors on every outcome.

Add12 race and I/O regressions. Keep the Hermes uppercase protected-file fixture real on case-sensitive filesystems and verify that the installed guard still permits first-time creation.

Validation: full6688 reported tests across347 files,12 race tests, full80% coverage gates, scoped Hookify coverage, installed Hookify and Hermes workflows, packed artifact lifecycle, lint, signatures and IOC.
2026-10-09 17:54:01 -04:00
haelyra 7265b989c4 merge: preserve tested bounded Hookify carry-forward candidate 3055 2026-10-09 16:17:57 -04:00
haelyra 46ec7aca9b merge: preserve tested SQL wrapper guard source 3050 2026-10-09 16:16:43 -04:00
haelyra 83cd2ad91e merge: preserve tested commit-review source 2974 2026-10-09 16:10:04 -04:00
haelyra a6f6faed2a merge: preserve source 2983 with tested activity dashboard fixes 2026-10-09 16:09:59 -04:00
haelyra 3ab06e8c6c merge: preserve reviewed routing wrapper source 2755 2026-10-09 16:05:14 -04:00
haelyra c4f419bea0 merge: refresh reviewed stewardship source 3280 on current main 2026-10-09 16:02:58 -04:00
wellkiloandhaelyra a50ee13cac feat: execute bounded local Hookify rules in lifecycle hooks
Carry forward PR #3055 at 92f53c4c onto ef648e01, preserving contributor attribution and current main. Focused maintainer fixes reuse shared input ceilings, preserve late root context through outer bootstrap, bound frontmatter before immutable parsing, and assert real oversized input in the limits workflow.
2026-10-09 15:59:20 -04:00
L4XB f838085274 fix(gateguard): reach SQL clients behind shell flag clusters, su and taskset
main resolves SQL clients behind env -S and its launcher grammars, but a
destructive statement still passed under four forms:

- a shell -c inside a short-option cluster (bash -lc, sh -ec), since only
  an exact -c was looked up;
- su, whose -c / --command / -lc value runs through the target user's
  shell, before or after --;
- taskset, whose mask or CPU list precedes the command, like timeout's
  duration;
- a command nested past the shell -c recursion limit, which was allowed
  instead of denied.

The first three are checked like sh -c; past the limit the check now
fails closed.
2026-10-05 15:56:53 +02:00
montjeffrey 56a516c2c5 Merge upstream/main into feat/gateguard-fewer-round-trips
Brings in the three commits main gained since the branch's merge base: the 2.2.3
release, retiring the Everything Claude Code name for ECC, and the ja-JP sponsor
update. 227 files arrive from main; two conflicted.

CHANGELOG.md: the branch had added an Unreleased section and main a released
2.2.3 section, both at the top. Both are kept verbatim with Unreleased above
2.2.3, since none of the branch's entries shipped in that release.

manifests/context-packs/skill-triggers@1.json: both sides had recomputed
registryDigest from the same earlier value to different results, and neither is
the digest of the merged tree. It is recomputed with loadContextRegistry over the
merged tree and only that field changes; triggers and triggersDigest are
untouched on both sides. validate-context-profiles passes.

All twelve CI validators pass. The full suite reports 44 failures in seven files;
43 of them fail by name and count identically on an unmodified upstream/main, and
the remaining one, plugin-hook-bootstrap, fails only inside run-all and passes in
isolation on both trees. The merge introduces no failing test that main does not
already have.
2026-10-04 20:47:30 -04:00
Suliman Abdulrazzaq 238309ce29 Merge branch 'main' into fix/gateguard-session-budget 2026-10-03 10:29:38 +03:00
Affaan MustafaandGitHub c05b2d6614 chore: retire the Everything Claude Code name, ECC only (#3330)
* chore: retire the Everything Claude Code name, ECC only

Replace the expanded product name and the everything-claude-code slug
with ECC across READMEs, translated docs, harness folders, skills,
commands, scripts and examples. Repo URLs now point at affaan-m/ECC.

Rename repo-internal artifacts to ecc forms (ecc-conventions skill,
ecc-guardrails, ecc-research-playbook, ecc-team-config, ecc-instincts
with ecc-* ids) and update .claude/ecc-tools.json.

Legacy install ids, plugin dirs, package names and MCP prefixes stay
where existing installs resolve against them. The codex global-state
check and harness-audit repo detection accept the new name first and
the legacy one as a fallback. The Discord bot prefers ~/GitHub/ECC and
falls back to the nested legacy checkout path.

Refresh the skill-triggers registryDigest for the changed skill text.

* fix(ecc-tools): drop managed paths to the removed Claude repo skill

.claude/skills/<repo-skill>/SKILL.md was deleted in #2770 but stayed listed in
ecc-tools.json and the team config. Remove those entries and point the Claude
Code adapter at the existing .agents/skills/ecc-conventions/SKILL.md.
2026-10-01 17:50:41 -05:00
haelyra 3c17f41a43 docs: resolve integration review findings 2026-09-30 18:58:26 -04:00
haelyra cc9d2c3b65 Merge remote-tracking branch 'refs/remotes/pr/3255' into maint/stewardship-batch-2026-09-30 2026-09-30 13:21:01 -04:00
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
haelyraandGitHub 83b66cac25 Merge branch 'main' into fix/gateguard-session-budget 2026-09-29 14:58:53 -04:00
haimingZZ 23939c637e fix(gateguard): strip SOFT HYPHEN (U+00AD) from sanitizePath 2026-09-29 01:17:25 +08: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