Repository navigation
v3.12.4
Added
-
Policy enforcement acknowledged to Hive (D4). The bus hello now names the features
policy_advancedandpolicy_applied, so Hive delivers itspolicy.advancednudge (it
sends that nudge only to Instances that name the feature). Once per version and digest of a
verified policy that is in force and that Hive acknowledged, the Instance sends one
policy.appliedframe:version,digest,key_id,applied_atandsessions(the live
app sessions enforcing it). It sends the frame only when Hive'shello.ack.featuresnames
policy_applied. An expired, outdated or unverified policy is never reported. Local Read
policy.sessionsaddsinstalled.enforcement(applied_version,acknowledged_at,
sessions,reported_at), additively. -
ECCP L/I/G change classifier (task 156).
scripts/change-class <base> <head>
printsL(no public Rust item changed),I(public items only added) orG
(public item changed or removed, Cargo features or dependency tables,
Cargo.lock,build.rs, Cargo config, toolchain pin, CI configuration or a
generated registry) from the git objects alone, without a build or network,
and serves as$ECCP_CLASSIFIERforscripts/eccp-envelope. -
ECCP change envelope in git notes (task 157).
scripts/eccp-envelopewrites,
shows and verifies aleanctx.change-envelope/v1JSON note under
refs/notes/eccpon a merge request head: intent, base, class, read set,
derivations and check evidence (docs/contracts/change-envelope-v1.md). -
Audit entries v2 bind each tool call to its session (ent3-1). Every new
audit-trail entry carriesv: 2and a chainedv2_hashover its timestamp
and, for a call of an MCP session, thesession_id, a per-sessionseq,
the decision and an output digest, so an edited timestamp, seq or fact fails
verify_chainandverify_chain_fullat that entry. Input and output digests
are HMAC-SHA256 under the engine-local key (hive/receipts.hmac-key, never
uploaded). The v1entry_hashis unchanged: older engines and
leanctx-verifystill verify a mixed trail, and an entry of a newer version
counts as forward-compatible, not as tampering. -
Managed configuration for MDM-provisioned machines (task 169). An organisation can
preconfigure an Instance through a macOS configuration profile, the Windows policy key
HKLM\SOFTWARE\Policies\LeanCTX\Managedor/etc/lean-ctx/managed.toml
(leanctx.managed-config/v1,docs/contracts/managed-config-v1.md). Managed
hive.urlandhive.root_keywin over[hive]andconfig seton them is refused;
hive.orgrefuses an enrollment for another org;hive.requiremakes tools refuse
until the machine is signed in and has a policy floor. A carrier that is malformed,
a symlink, or not root-owned (it or its directory) fails closed; it is checked and
read through one open handle.hive statusand the cockpithive status --json
(managed, since 1.7) show the carrier and each member. -
Unit claims warn before two agents edit the same code. A
ctx_patchorctx_edit
write claims the functions, types and Markdown sections it touches for the editing agent
(10-minute lease, renewed on each edit). When another agent holds a claim on a touched
unit, the write goes ahead and the result names the holder (LEAN_CTX_CLAIM_MODE=warn,
the default).strictrefuses the write before anything is written, andoffturns the
check off.ctx_agent action=claimslists the live claims.action=plan_claimsplans a
task against them, through an optional local planner (LEAN_CTX_CLAIM_PLANNER) or a
built-in fallback without network, and claims the free units. Claims are released when
the agent reportsstatus=finishedand when the server shuts down.
Security
The first five fixes below were reported by @dkiaulakis.
-
A redirection written another way cannot write past the gate (GHSA-4gm5-2mgw-9r9r). A
redirection with a file-descriptor prefix, an&>/>|/<>operator, a quoted or escaped
target, or no space before its target was missed, so an agent shell could write lean-ctx's
own state or an unlisted file. The gate now reads every redirection in its canonical form
before any other check. -
A command inside
( … )or{ …; }is checked like any other (GHSA-9jrf-q94p-frhr). A
subshell or group was one segment to the gate, whose first word ((eval,(rm) matched no
rule, and a redirection after the group was dropped. Every group is now opened into its
commands for the checks, and a redirection after it is checked too; a command in acase
arm or afterthen,do,elseorcoprocis judged as its own command. The line that
runs is unchanged. -
The state guard follows the working directory and the values a line builds
(GHSA-cfmv-qg29-3rvp). Repeated or conditionalcd .., acdin a loop, function or trap,
CDPATH/HOME/OLDPWDassignments, variables assigned or read at run time (also
${d:=…}andset --arguments, also inside a longer word), the shell's own
$PWD/$OLDPWD/$_and~+/~-/~N, brace and parameter expansions, function
arguments,aliasbodies,GIT_DIR-style variables, versioned interpreter names
(python3.12,node@20),deno eval/bun -e, awksystem()/pipes/output redirection
(also in-e/--sourceprograms; a program read from stdin with-f -or-f /dev/stdin
is refused) and in-place writers (sed,perl -i,sort -o,gzip,
patch,split,tar/unzipextraction) could reach lean-ctx's own state unseen. A write
whose target cannot be placed is now refused (fail closed); read-only commands are unchanged. -
A read-only git subcommand cannot write lean-ctx's state or run a program
(GHSA-fv44-pm58-9c8p). When git runs at or above lean-ctx's state,log/diff/show/grep
and the other read subcommands were allowed whatever their options, so--output=…,
--ext-diffwith-c diff.external=…, a-c/--config-envpager, fsmonitor or alias,
--paginate,--textconvorgrep -Ocould write a file or run a program. Those options are
now refused there; plain reads such aslog --onelineanddiff --statstill pass. -
Context admission never delivers a value the secret detector flagged
(GHSA-xmx8-69qv-7f86). The detector and the redactor read different spans of one
comparison or key/value expression: the operand with or without the rest of its operator
(==,:=), with or without a trailing)or:. The redactor could judge a flagged value
benign and leave it unchanged, and admission then delivered it asAllowRedacted, because it
only re-checked text it had rewritten. Both layers now judge the same operand, so a
comparison operand is masked exactly when itskey=<value>form is. Unchanged text is
re-checked after a reported value too and is withheld (redaction.incomplete) when the value
is still there. A benign comparison such asif (token==unit_reference):is no longer withheld. -
Memory compaction, context bundles and rule exports do not write through a symlink
(GHSA-mq5c-rjv9-2fc3). Reported by @kasparovabi.ctx_compress_memorywrote its backup
(<name>.original.md) and the compacted file, andctx_pack/lean-ctx packwrote the
bundle file, with a plain write after the path jail check. The jail leaves a dangling link
unresolved, so a symlink a cloned repository shipped could redirect the write to a file
outside the project. These writes now go through the confined write, which refuses a
symlinked component below the project root, and a memory file that is itself a symlink is
refused before it is read. The compacted file and its backup keep the original's permissions.
The same applies tolean-ctx export-rules(AGENTS.md,CLAUDE.md,CODEBUDDY.md,
.cursor/rules/…) and to the artifact registry thatctx_artifacts action=removerewrites.
A rule file that links to another file, such asCLAUDE.md→AGENTS.md, is now refused
with an error instead of written through, and a new bundle file is readable only by its
owner (0600).
Changed
- Library crates carry new versions.
lean-ctx-protocol0.7.0 adds the Hive model catalog,
three routing members of the security policy and themodels.subscriptionright, which
changes its public types;lean-ctx-ocla7.0.0,lean-ctx-workgraph0.3.0 and
lean-ctx-tasks0.2.0 expose those types and move with it.
Fixed
- A PowerShell-shaped command with a non-ASCII character no longer panics the shell gate.
The verb-prefix check sliced the command name at a byte that could fall inside a
multi-byte character (A-bᲳ); it now compares bytes, so such a name is no match. - The cockpit's proof no longer pins a core per session on a large audit trail (#2240).
lean-ctx value --sessionread the whole segmented trail into memory and the savings
ledger twice; it now streams both once, skips segments sealed before the session began
and lines that cannot name the session. The cockpit proves only in a session whose
sidebar was drawn (background spare sessions never draw one), backs off up to an hour
after a failed or timed-out proof, and/cockpitstill proves at once. Thanks
@jenseinar for the report.
Upgrade
lean-ctx update # recommended (auto-downloads + refreshes shell hooks)
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxNote: After upgrading via cargo/npm/brew, run
lean-ctx setupto refresh shell aliases.lean-ctx updatedoes this automatically.
Full Changelog: v3.12.3...v3.12.4