@bookedsolid/rea 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATING.md +105 -0
- package/README.md +62 -0
- package/THREAT_MODEL.md +65 -0
- package/dist/cli/doctor.d.ts +50 -0
- package/dist/cli/doctor.js +379 -0
- package/dist/cli/global-cli.d.ts +274 -0
- package/dist/cli/global-cli.js +709 -0
- package/dist/cli/hook.js +26 -0
- package/dist/cli/index.js +10 -0
- package/dist/cli/install/global.d.ts +93 -0
- package/dist/cli/install/global.js +397 -0
- package/dist/cli/trust.d.ts +70 -0
- package/dist/cli/trust.js +222 -0
- package/dist/hooks/bash-scanner/protected-scan.d.ts +24 -0
- package/dist/hooks/bash-scanner/protected-scan.js +152 -7
- package/dist/hooks/protected-paths-bash-gate/index.js +24 -1
- package/dist/policy/loader.d.ts +13 -0
- package/dist/policy/loader.js +52 -0
- package/dist/policy/types.d.ts +40 -0
- package/hooks/_lib/shim-cache.sh +42 -8
- package/hooks/_lib/shim-runtime.sh +494 -29
- package/hooks/local-review-gate.sh +51 -5
- package/package.json +1 -1
|
@@ -63,19 +63,65 @@ fi
|
|
|
63
63
|
|
|
64
64
|
# 3. Resolve CLI early (used by policy reader Tier 1 + final forward).
|
|
65
65
|
shim_resolve_cli
|
|
66
|
+
TRUST_TIER="project"
|
|
67
|
+
|
|
68
|
+
# 0.50.0 Phase 2b: when BOTH in-project tiers miss, consult the opt-in
|
|
69
|
+
# global tier. shim_resolve_cli_global runs the registry opt-in gate + the
|
|
70
|
+
# A1–A4 sandbox itself and, on success, sets REA_ARGV / RESOLVED_CLI_PATH /
|
|
71
|
+
# TRUST_TIER=global (and _SHIM_GLOBAL_BAD_REASON on a blessed-but-hostile
|
|
72
|
+
# tree). Without this, a BLESSED global-only repo (no in-project
|
|
73
|
+
# @bookedsolid/rea) leaves REA_ARGV empty → section 7 refuses the push as
|
|
74
|
+
# `cli-missing`, defeating the feature for the push/commit gate. An
|
|
75
|
+
# un-blessed repo leaves REA_ARGV empty + emits nothing, so section 7 stays
|
|
76
|
+
# byte-identical to feature-absent. A blessed-but-hostile global tree
|
|
77
|
+
# (_SHIM_GLOBAL_BAD_REASON set) also leaves REA_ARGV empty → section 7
|
|
78
|
+
# refuses (blocking gate: refusing is the correct fail-closed posture).
|
|
79
|
+
if [ "${#REA_ARGV[@]}" -eq 0 ]; then
|
|
80
|
+
shim_resolve_cli_global
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# 0.50.0 Phase 2b: honor the in-project runtime.allow_global_cli veto for the
|
|
84
|
+
# push/commit gate too — parity with shim_run's 14 shims via the SHARED
|
|
85
|
+
# shim_global_tier_vetoed helper (single source of truth). Runs ONLY when the
|
|
86
|
+
# global tier resolved (TRUST_TIER=global ⇒ REA_ARGV is the sandbox-validated
|
|
87
|
+
# global CLI). On veto, clear REA_ARGV + revert TRUST_TIER so the gate falls
|
|
88
|
+
# back to no-CLI → section 7 refuses the push cli-missing (correct fail-closed
|
|
89
|
+
# posture for a blocking gate). Without this the gate would forward through
|
|
90
|
+
# the global CLI regardless, leaving the repo-level veto ineffective for
|
|
91
|
+
# push/commit enforcement while the shims honor it.
|
|
92
|
+
if [ "${TRUST_TIER:-project}" = "global" ] && shim_global_tier_vetoed; then
|
|
93
|
+
REA_ARGV=()
|
|
94
|
+
TRUST_TIER="project"
|
|
95
|
+
fi
|
|
66
96
|
|
|
67
97
|
# Round-5 P1 fix: sandbox-check the CLI BEFORE any policy-get
|
|
68
98
|
# invocation. Pre-fix `_lrg_read_policy()` could spawn the resolved CLI
|
|
69
99
|
# for mode-off / refuse_at reads BEFORE the sandbox guard fired — a
|
|
70
100
|
# symlinked or swapped dist/cli/index.js would execute during policy
|
|
71
101
|
# lookup, defeating the realpath / package.json trust boundary.
|
|
102
|
+
#
|
|
103
|
+
# 0.50.0 Phase 2b: gate this IN-PROJECT sandbox on TRUST_TIER=project,
|
|
104
|
+
# mirroring shim_run step 4a. The global tier already ran its own A1–A4
|
|
105
|
+
# sandbox inside shim_resolve_cli_global (and REA_ARGV points at the
|
|
106
|
+
# validated realpath, which legitimately lives OUTSIDE CLAUDE_PROJECT_DIR).
|
|
107
|
+
# Re-running the in-project shim_sandbox_check on a global CLI would reject
|
|
108
|
+
# it with bad:cli-escapes-project and wrongly refuse the push.
|
|
72
109
|
SANDBOX_EARLY_FAILURE=""
|
|
73
|
-
if [ "${#REA_ARGV[@]}" -gt 0 ] && command -v node >/dev/null 2>&1; then
|
|
110
|
+
if [ "${#REA_ARGV[@]}" -gt 0 ] && [ "${TRUST_TIER:-project}" = "project" ] && command -v node >/dev/null 2>&1; then
|
|
74
111
|
sandbox_check_early=$(shim_sandbox_check "$RESOLVED_CLI_PATH" "$proj" "$SHIM_ENFORCE_CLI_SHAPE")
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
112
|
+
# TOCTOU precursor: shim_sandbox_check now echoes `ok:<realpath>` on
|
|
113
|
+
# success (was bare `ok`). Branch on the `ok:` prefix. This hook is
|
|
114
|
+
# the documented shim_run exception, so it keeps executing the literal
|
|
115
|
+
# RESOLVED_CLI_PATH for its forward (realpath-exec is scoped to
|
|
116
|
+
# shim_run in this phase); only the success detection adapts to the
|
|
117
|
+
# new return shape. bash 3.2: `case` glob match, no `[[ =~ ]]`.
|
|
118
|
+
case "$sandbox_check_early" in
|
|
119
|
+
ok:*) ;;
|
|
120
|
+
*)
|
|
121
|
+
SANDBOX_EARLY_FAILURE="$sandbox_check_early"
|
|
122
|
+
REA_ARGV=()
|
|
123
|
+
;;
|
|
124
|
+
esac
|
|
79
125
|
fi
|
|
80
126
|
|
|
81
127
|
# 0.37.0: route policy reads through the unified policy-reader. The
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bookedsolid/rea",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "Agentic governance layer for Claude Code — policy enforcement, hook-based safety gates, audit logging, and Codex-integrated adversarial review for AI-assisted projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Booked Solid Technology <oss@bookedsolid.tech> (https://bookedsolid.tech)",
|