An existing 0664 log that was already at the cap was renamed to .1
before its mode was tightened, so the rotated copy stayed group/world
readable. Tighten the existing log first, and drop the post-open
fchmod that only reached the new active log.
Refs #3846
If the rename to <log>.1 fails (another session rotated first, or
Windows refuses the rename), append to the current log instead of
dropping the line.
Refs #3846
bash-commands.log and cost-tracker.log record every Bash command but
were created with the default umask (0664 in the report) and grew
without bound. appendLine now opens them with mode 0600, tightens an
existing group/world-readable log on the next write, and rotates the
log to <log>.1 once it would pass 10 MiB, keeping one rotated copy.
This mirrors the metrics.jsonl scheme in scripts/lib/gateguard-metrics.js,
inlined because hooks cannot require scripts/lib/.
Refs #3846
Repair the CodeQL findings introduced by this integration without
dismissing any alert:
- OpenSpec validators: express the empty-symbol check as an explicit
slice instead of an index-versus-length comparison (#2679).
- OpenSpec tests: create file and outside-target fixtures inside private
mkdtemp directories (#2679).
- Antigravity policy test: give the bridge a private TMPDIR/TEMP/TMP so
its edit accumulator never lands in the shared temp directory (#3221).
- Session recording test: write partial bytes through the staging
descriptor and read the saved file through one opened handle (#3952).
Behavior and assertions are unchanged; each focused suite passes.
Main kept evolving pre-bash-dev-server-block.js while this branch waited:
tmux pane-launch detection past tmux options and command sequences, bash
double-quote backslash rules, here-document segment scanning and an indexed
segment queue. Resolve by keeping this branch's thin hook and moving main's
current helpers into scripts/lib/dev-command.js, so both dev hooks still
share one classifier without losing main's tmux behavior.
The same resolution makes package-manager option arity manager-specific,
as requested in review: npm -d / pnpm -d are loglevel flags, pnpm -w is
--workspace-root, bun -d is --define <K:V>. A shared value table swallowed
the script after the boolean spellings, so `npm -d run dev` escaped tmux.
Maintainer carry-forward of the four edge cases reproduced on 5a565cf:
- Same-named project roots: bind the proposal to a SHA-256 owner key of
the full real project root plus the raw session ID, and put that key in
both the file name and the ownership marker.
- Sanitized session-ID aliasing: hash the raw session ID before filename
sanitization so IDs such as owner/a and owner?a no longer share a path.
- Linked or special destinations: probe with lstat, open read-only with
O_NOFOLLOW and O_NONBLOCK, require a regular single-link file whose
complete first-line marker matches, and decline linked handoff
directories. A FIFO at the destination previously hung the prompt.
- Literal resume arguments: emit the resume prompt as one single-quoted
POSIX (or PowerShell on Windows) argument.
Also merge the UserPromptSubmit registration into the existing event
array. The main merge left a duplicate UserPromptSubmit key in
hooks.json and hooks.metadata.json, and JSON.parse kept only the last,
which silently dropped prompt:hookify-runtime.
Adds tests/hooks/context-gate-ownership.test.js, which fires the hook
through the registered run-with-flags.js entry: 12/12 pass here, 1/12
pass on 5a565cf.
Main now resolves sudo/doas/env and the timeout/setsid/nice/stdbuf/ionice/
taskset/nohup/time launchers for top-level commands, but find -exec still
read its action argv literally. `find . -exec sudo rm {} \;`,
`find . -exec timeout 5 rm -rf {} +`, `find . -exec sh -c 'rm -rf {}' \;`
and `sudo find . -exec rm {} \;` were allowed although each runs rm.
Resolve the exec argv through unwrapLeadWrappers (external argv, so no shell
builtins), classify find behind a wrapper, and send the -c text of a shell
that find starts through the same bounded quote-aware recursion as a
top-level `sh -c`. Non-executing modes such as `sudo -l` and quoted data
such as `sh -c 'echo rm -rf {}'` stay allowed.
Co-authored-by: Nguyen Thanh Dat <ntdat812.dev@gmail.com>
Carry forward the still-missing part of this PR onto main's scanner:
git commit --trailer and the git push value options (-o, --push-option,
--receive-pack, --exec, --repo) now consume the following token, and an
abbreviation that names exactly one value-taking long option consumes it
too. A flag-looking value such as `git push -o --no-verify` is data that
Git sends verbatim while still running pre-push, so refusing it was a
false positive.
--force-with-lease stays out (optional inline-only value), inline =value
forms consume nothing, and prefixes ambiguous among the value options
resolve to none of them. A real-Git sweep over every prefix of every
commit/push long option followed by --no-verify (866 commands, Git
2.50.1) found no command the hook allows while Git skips a refusing hook.
Co-authored-by: Nguyen Thanh Dat <ntdat812.dev@gmail.com>
Refresh the Mistral Vibe skill target on current main. Keep main's
Copilot and Grok targets, agent/skill/locale selectors and install-config
cases alongside the mistral-vibe target, and take main's skill-triggers
manifest so the digest matches the current catalog.
An Antigravity home whose workflows directory resolves outside the
trusted config root made resolveTrustedRoots throw out of the doctor
loop, hiding results for every other installed target. Report it as an
unsafe-trusted-root error for that target instead, with a regression.
Also align the README support row with the pinned CLI 1.3.5 validation
and leave the shipped 2.2.0 release notes unchanged.
findJwtHeader capped full header decodes at 8 per segment, so a valid
whitespace-header JWT after 8 decoy candidates (eyAg-eyAg-...-<JWT>) was
logged unredacted. Once the budget is spent, treat the next candidate
that passes the constant-time prefilter as a header. The scan stays
linear and the extra redaction only applies to pathological segments.
Refs #3846
Resolve conflicts with grok target and repair source-root changes:
keep both antigravity-home and grok targets, combine main's repair
source root with the PR's trusted-root selection, and rebind the
skill-trigger registry digest to the merged install registry.
Main already carries the first three commits of this PR (merged in
22596737f) plus later maintainer hardening that moved the delivery
marker into the private observer directory (bfb4dbe7b, f5ff589cd).
Conflict resolution keeps main's evaluate-session.js and test file as
the base, then re-applies only the remaining change from f64a9b5d0:
deliverStopNudge returns whether it wrote the Stop JSON, writes it with
process.stdout.write, and exits from the flush callback. The
async-stdout regression test is ported with the marker path pointed at
main's private delivery-markers directory.
Verified: evaluate-session 27/27 (new test fails on main 26/27),
hooks 260/260, stop-hooks-stdout 48/48, integration hooks 27/27.
Restore mode 100755 on scripts/worktree-lifecycle.js so direct POSIX
launches such as ./scripts/worktree-lifecycle.js --help keep working,
and add a regression test that checks the mode and runs the CLI directly.