CI builds every v3 package before verifying and gates on the history diff, so
the manifest must be regenerated from a full build, not a source checkout or a
partial build.
Co-Authored-By: RuFlo <ruv@ruv.net>
The earlier built-tree regen marked 101 verified; CI checks out source only, so those
markers regressed. Carry forward the same unattested dist entries as 3.56.3.
Co-Authored-By: RuFlo <ruv@ruv.net>
An unanswered confirm card never expired: the Room showed "155s of 30s",
every later Claude console action was refused as "already waiting", Claude
could not withdraw its own ask, and a late Yes was refused anyway ("the
confirm came more than 30 s after the ask").
- A card is cleared at PENDING_TTL_MS (30 s) by a timer registered in
state.timers (torn down with the controller) or at the next ask/call; one
Events entry, lastResult "expired: ask again", the Room says expired. The
window and gates are unchanged; expiry runs nothing; a later Yes is still
refused.
- ask-withdraw clears only a write-class card Claude raised in its own
direct console_run (origin id recorded at raise); never the person's,
deferred, follow-up, spend, install, network or delete cards; at most
3 withdraws a minute and a 10 s same-label re-ask cooldown.
- A typed /ruflo yes is refused within 3 s of a Claude-raised card or 10 s
of an expiry/withdraw (press the card itself).
- ADR and skills palette hints say which page to open and how many numbers
an entry needs.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
- Text answers (console_state, ask-Claude) no longer carry other projects'
cwd or git branch from session transcripts; group labels use the
placeholder titles already use. A branch name could carry
instruction-shaped text into Claude's context.
- "failed" follows ADR-486 §2.3: raised only after the quiet period; a
permission refusal (Claude Code's exact refusal results) and a Codex
interrupt are not failures; a seen failure is keyed on the error record's
own time, so metadata appends do not re-raise it.
- Timestamps are clamped (<= file mtime, <= now + 5 min); stores with future
stamps or baselines are repaired once on load.
- The 12 MB read budget is one per pass, shared and taken in turns by all
adapters, reserved before each read and charged the bytes read; never-read
files are read first-come first-served, then least recently read, so no
session starves.
- attention.json is rewritten at least every 5 min while the workspace runs,
failed writes back off (30 s to 5 min), and /ruflo-mods marks an old
summary stale.
- "Who is here" lists the main session and active or busy agents first, not
the whole agent store.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
fix(cli,plugins): resolve executed optional modules from the tool's own install (replaces #3954; security review in PR body)
Co-Authored-By: RuFlo <ruv@ruv.net>
Adversarial review of the first commit (a Claude devil's-advocate agent and three
Codex rounds) found inputs main reports that it dropped, a ReDoS, and quadratic paths.
- Command injection is main's rule again (child_process ... exec), tested after
comment stripping, so execSync is reported and no execFile shape is exempt: env,
node -e, python -c, bash.exe, options variables and exec passed as a value were all
bypasses. The execFile callback regex that backtracked catastrophically is gone.
- Carried block comments continue only through comment-looking lines; regex literals
are read as code (bounded to 200 chars); '://' is never a comment. Lines are built
from parts with a 12-char tail, so the stripper is linear.
- SQL placeholders: only param/placeholder names, params/values/args.length, numbers
and loop letters, in value position, outside single- or double-quoted SQL text, in
one left-to-right pass that skips escapes. pageNum, userIdx, req.body.length and
quoted placeholders are reported.
- Spec: 26 tests, including every reviewer input and linear-time checks; each of ten
source mutations fails at least one test.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
`ruflo security scan --depth deep` on a 10-repo checkout reported 10 high findings,
all false: `child_process.execFile` named in comments, numbered pg placeholders
(`$${paramCount}`) as SQL injection, and a Playwright report bundle. Mediums
included "retrieval (" read as eval and istanbul/Playwright assets.
- eval needs a word start; window.eval still matches.
- Command injection is any exec/execSync/execFile use (call, ?.(), .call/.apply/
.bind, ['exec'], passed as a value), except execFile of a literal non-shell
program with a literal argv and no shell or options variable. execSync, which
`exec[^S]` skipped, is now reported.
- A counter-shaped pg placeholder where SQL takes a value, outside SQL quotes, is
not interpolation; quoted or value-shaped `$${...}` still is. The SQL test runs in
linear time.
- Comment text is stripped before matching (strings respected); a block comment
carries only from a line-start opener that closes later.
- istanbul prettify/sorter/block-navigation/lcov-report next to a coverage marker,
and Playwright trace/data next to index.html, are skipped. Folder names are looked
up in a Map.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
Leftovers of #3817/#3822 and #3818/#3823.
Numbers from CLI JSON (#3822). JSON.parse('1e999') is Infinity; a count can
also be negative, fractional or absurd. Bounded where read with data/safe.ts
countOf / ratioOf and a new measureOf (finite, within +-1e12):
- secure.ts scanReader: every severity count and the total are at least
the listed findings, so a summary never reads CLEAN beside a listed
finding. A count or total the tool printed but no reader can trust stays
UNKNOWN (SecFindings.unreadable / isTotalUnknown), with the listed
findings only as its lower bound: "critical ?" / "high ≥2 ?",
"? findings (total unreadable)", COUNTS UNREADABLE. securityBand() is the
one rule for the band (views/bar.ts) and the menu badge (menu-style.ts):
it warns on high/critical ("N+" when anything is unknown) and on any
unknown count or total. Threat confidence via ratioOf, composition score via measureOf.
The verdict-exit judgement (#3934, SCAN_FOUND/countsWith) is unchanged.
- Same class swept in perf.ts, mh-lab.ts (labLines cells, gepa chars,
genome ids, receipts), neural.ts, memory-lines.ts,
data/evolve.ts, data/research.ts and data/cli.ts.
Mission resume (#3823). setPaused takes who resumed. The mission-resume
palette entry built inside Claude's console_run (state.control.viaModel)
resumes as 'model': hand-out counts are kept and an advisor stop-the-line
is not re-opened, so an exhausted task gets no new billed hand-out. The
person's resume (page buttons, palette, a typed /ruflo run) still gives
every task its hand-outs back.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
The statusline now builds shell command lines from HELPER_ROOT (the checkout's
directory, chosen by whoever made it). A directory named p$(...) was expanded
inside the double-quoted command; shell-active paths are now skipped.
The statusline-generator delegation smoke ran the generated helper from tmpdir,
so with CLI resolution moved to the helper root it fell through to the registry's
published CLI (intelligencePct null). It now writes the helper into a throwaway
helper root whose v3/@claude-flow/cli is the repo's built CLI.
Co-Authored-By: RuFlo <ruv@ruv.net>
A home-level helper or a user-level plugin hook serves every opened project.
hook-handler.cjs and statusline.cjs executed a CLI found under the project
(<cwd>/node_modules/{@claude-flow/cli,ruflo}, <cwd>/v3/...), and every npx
fallback ran with the project as cwd, where npx prefers the project's own
install. The plugin shims also resolved `ruflo` through relative PATH
entries, which resolve against the cwd.
- hook-handler.cjs / statusline.cjs (package and repo copies): candidates
are built from the helper's install root; for a project-local helper that
is the project, so its behaviour is unchanged.
- npx fallbacks pass `--prefix <helper root>` (generated hook-handler and
ruflo-hook.cjs too) or, in the plugin shims, `--prefix <plugin data dir or
home>`. The spawned CLI still runs with the project as its cwd.
- ruflo-hook.cjs (all four copies): relative/empty PATH entries are skipped.
Test: helper-cli-resolution-trust.test.ts (11 cases, 10 fail on main);
hook-handler-artifact-parity follows the npx args into cliSpawnArgs().
The signed helpers changed, so the helpers manifest needs re-signing.
start() created SESSION_DIR (mkdirSync / ensureDir) before checking that it
resolves inside the project, so a symlinked .claude-flow still got an empty
sessions/ directory created at the symlink target. assertSessionDirContained()
now resolves the deepest existing part of the path (lstat, so a symlink
counts) and start() calls it before creating anything. Applied to all five
session helper variants.
Test: session-helper-trust.test.ts gains a symlinked-.claude-flow case per
variant (5 cases, all fail without this change).
pinToUserHelpers() only recognised the #1943 probes, the exact git-root
statusline and the git-root ESM import without argv.splice, so
`init --upgrade --settings` on the home directory left older shipped forms
that always run the opened project's helper:
- pre-#1943 `sh -c 'exec node "${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/<x>" <sub>'`
and the Windows `cmd /c node %CLAUDE_PROJECT_DIR%/.claude/helpers/<x> <sub>`;
- ADR-059 git-root node -e forms (CJS and ESM, with argv.splice);
- relative `node .claude/helpers/<x> [sub]` hooks and statusline.
It now re-pins any command whose target is a known ruflo helper under
.claude/helpers reached through CLAUDE_PROJECT_DIR, %CLAUDE_PROJECT_DIR%,
`git rev-parse --show-toplevel` or a relative path, keeping the subcommand.
Commands with redirects/chaining, other scripts, or already pinned to HOME
are left alone.
executeUpgrade() created a missing settings.json with
generateSettings(DEFAULT_INIT_OPTIONS), whose targetDir is the module-load
cwd; it now passes the upgrade's targetDir.
Tests: one case per legacy form, a user-authored/already-pinned case, an
upgrade-merge case, and an executeUpgrade missing-settings case.
v3/@claude-flow/mcp/.claude/helpers/session.js is a repository-local copy
(the package publishes only dist) with the same `${session.id}.json`
archive path. Apply the same hardening as the shipped session helpers and
cover it in session-helper-trust.test.ts (3 of 4 cases fail without it).
Settings written to ~/.claude/settings.json apply to every project the user
opens. The #1943 probe ran `$CLAUDE_PROJECT_DIR/.claude/helpers/<script>`
whenever that file existed, so in user-level settings the opened project
decided which helper code ran.
helper-commands.ts now owns the hook/statusline command forms:
- project-level settings keep the #1943 project-first probe, unchanged;
- user-level settings (init target is the home directory) get commands
pinned to $HOME/.claude/helpers with no project lookup;
- `init --upgrade --settings` on the home directory re-pins the probe and
git-root forms ruflo generated earlier and leaves user-authored commands.
The #1943/#1948 fix invariants now point at helper-commands.ts.
Test: settings-user-level-helpers.test.ts (8 cases).
A home-level helper can serve whatever project Claude Code opens, so
everything that project controls is untrusted input to the helper.
auto-memory-hook.mjs / learning-service.mjs: since the #3286 change every
module-resolution strategy (memory-package.json sidecar, local v3 dist,
createRequire, node_modules walk-up, agentic-flow embedder) was rooted at
CLAUDE_PROJECT_DIR, so a project could choose which JavaScript a home-level
helper imports. Add MODULE_ROOT (the helper's install root) for module
resolution; PROJECT_ROOT stays data-only, so #3286 still holds.
session.cjs: end() archived to `${session.id}.json` with the id taken from
the project's current.json, so a crafted id could write outside the session
directory, and writes followed symlinks. The archive name must now match
session-<digits>; current.json counts only as a regular file (lstat); writes
use an exclusive temp file + rename; and the project session directory must
resolve inside the project. Applied to the packaged helper, both generators
(generateSessionManager / generateCrossPlatformSessionManager) and the
repository copy.
Tests: helper-module-root-trust and session-helper-trust (16 of 21 cases
fail on main, all pass now); the #3286 test now places the mock memory
package at the helper root.
The helpers manifest is not re-signed here: auto-memory-hook.mjs changed, so
it needs `scripts/sign-helpers.mjs` with the release key.
- smoke-plugin-registry-signature.mjs: follow the verifier rename to
registrySignatureFailure and require the fail-closed call site
`if (failure) return this.fallbackToBuiltIn(`, keeping full #1922 coverage.
- verifyEd25519Signature verifies in RFC 8032 strict mode, and
isPlaceholderSigningKey rejects every small-order or off-curve key, not
only the all-zero one.
- An unverified registry claims no official plugins and no verified
authors; MCP transfer_plugin-* results carry the registry status.
- Tests no longer assume the shipped trust anchor stays a placeholder.
- Document the strict-mode asymmetry for unlisted packages in --help.
The live plugin registry CID is unsigned, so discovery always fell back to
the built-in plugin list, whose entries all claim trustLevel "official".
`plugins install` passed that claim on as registry trust, which runs npm
lifecycle scripts and skips the permission gate (#3557) for any listed
plugin, with nothing actually verified.
- Discovery reports `verified` + `unverifiedReason`; only a registry whose
signature verifies against the pinned key keeps its trust labels. The
built-in fallback and a registry fetched with requireVerification off are
reported with every entry as 'unverified'.
- A placeholder pinned key (missing, malformed, all-zero) is never used to
verify: the all-zero key is small-order and accepts a forged signature.
- CLAUDE_FLOW_STRICT_PLUGINS=true (ADR-145): no fallback to the built-in
list, and `plugins install` refuses unless --allow-unverified is passed.
- `plugins install` passes registry trust, permissions and checksum only
for a verified registry entry; `plugins list`/`info` show registry status.
- PluginIntegrityVerifier (@claude-flow/security) skips placeholder anchors,
such as the all-zero one in trust-anchors.json, and verifies in RFC 8032
strict mode, which rejects small-order keys.
A project-local install lives at <project>/node_modules/@claude-flow/cli, so the
8-level walk-up from import.meta.url used by the testgen/metaharness locators and
doctor crossed node_modules and reached <project>/plugins/ruflo-*, i.e. code the
opened repository supplies. ownInstallAncestors()/ownPluginDirs() now stop at the
first node_modules directory. Source-checkout dev layouts are unaffected.
The @claude-flow/embeddings hunk is dropped from this change: that package cannot
ship from main until its alpha branch is reconciled, so it needs its own change.
Co-Authored-By: RuFlo <ruv@ruv.net>
The CLI, two MCP tools and two plugin scripts imported or ran code found
relative to the cwd, which is the opened project:
- doctor (metaharness check), `metaharness` command and metaharness MCP
tools: plugins/ruflo-metaharness/scripts under the cwd;
- testgen MCP tools: plugins/ruflo-testgen/scripts under the cwd, reached
on every published install because that plugin is not bundled;
- init: <cwd>/node_modules/@claude-flow/codex;
- embeddings: <cwd>/node_modules, <cwd>/../node_modules and a fixed
/workspaces/claude-flow path for agentic-flow;
- ruflo-ruos ledger: the CLI's mcp-client resolved from the cwd;
- cost-tracker compact.mjs: @claude-flow/integration resolved from the cwd.
Each now resolves from the tool's own install (module location /
createRequire(import.meta.url)), plus the user's marketplace checkout for
the plugin scripts. The project remains the data/scoring target.
Test: optional-module-resolution-trust.test.ts (10 cases, all fail on main).