@bookedsolid/rea 0.49.1 → 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
package/hooks/_lib/shim-cache.sh
CHANGED
|
@@ -32,7 +32,13 @@
|
|
|
32
32
|
#
|
|
33
33
|
# # Cache key fields (NUL-joined, sha256-hashed, first 32 hex chars)
|
|
34
34
|
#
|
|
35
|
-
# schema_version — "v1"
|
|
35
|
+
# schema_version — "v2" (0.49.0 Phase 1b: bumped from "v1" for the
|
|
36
|
+
# global-CLI resolver tier. v1 entries on disk are
|
|
37
|
+
# a clean miss — the read-side validator in
|
|
38
|
+
# shim-runtime.sh requires schema_version === "v2".
|
|
39
|
+
# Hard cutover, no migration: the per-session cache
|
|
40
|
+
# is tmpfs + 3600s TTL, so a schema bump is a free
|
|
41
|
+
# drop-and-rebuild.)
|
|
36
42
|
# session_token — see shim_cache_session_token
|
|
37
43
|
# project_root_realpath — realpath(CLAUDE_PROJECT_DIR)
|
|
38
44
|
# cli_realpath — realpath(resolved CLI)
|
|
@@ -66,6 +72,21 @@
|
|
|
66
72
|
# a swap that re-resolves to the SAME realpath
|
|
67
73
|
# but with a different binary, e.g. an in-place
|
|
68
74
|
# rebuild of node itself; rare but cheap)
|
|
75
|
+
# trust_tier — "project" | "global" (0.49.0 Phase 1b). The
|
|
76
|
+
# resolved tier. Makes the key tier-scoped so a
|
|
77
|
+
# symlink that makes project-tier and global-tier
|
|
78
|
+
# `cli_realpath` identical still yields DISTINCT
|
|
79
|
+
# keys — project-tier can never read a global
|
|
80
|
+
# entry's sandbox_ok:true and skip its own
|
|
81
|
+
# containment check (design §8 case (a)).
|
|
82
|
+
# registry_mtime — ns-mtime of <pw_dir>/.rea/trusted-projects on
|
|
83
|
+
# the GLOBAL tier; "" on the project tier (design
|
|
84
|
+
# §8 case (b): atomic-rename on trust/untrust
|
|
85
|
+
# changes the mtime, defeating a warm global hit
|
|
86
|
+
# after the project is untrusted mid-session).
|
|
87
|
+
# registry_size — size-bytes of the registry on the GLOBAL tier;
|
|
88
|
+
# "" on the project tier (a removed line shrinks
|
|
89
|
+
# the file — two invalidators defeat `touch -r`).
|
|
69
90
|
#
|
|
70
91
|
# # Storage
|
|
71
92
|
#
|
|
@@ -121,14 +142,19 @@
|
|
|
121
142
|
# shim_cache_session_token — prints session token to stdout
|
|
122
143
|
# (empty + exit 1 means "cache
|
|
123
144
|
# disabled, no token derivable")
|
|
124
|
-
# shim_cache_key — args:
|
|
145
|
+
# shim_cache_key — args (17, in order):
|
|
125
146
|
# schema_version session_token
|
|
126
147
|
# project_realpath cli_realpath
|
|
127
148
|
# cli_mtime cli_size euid
|
|
128
149
|
# enforce_cli_shape shim_name
|
|
129
|
-
#
|
|
130
|
-
#
|
|
131
|
-
#
|
|
150
|
+
# pkg_mtime pkg_size dist_mtime
|
|
151
|
+
# node_realpath node_mtime
|
|
152
|
+
# trust_tier registry_mtime
|
|
153
|
+
# registry_size
|
|
154
|
+
# (the helper accepts variadic but
|
|
155
|
+
# rejects fewer than 17 args; the
|
|
156
|
+
# caller in shim-runtime always
|
|
157
|
+
# passes 17 — 0.49.0 Phase 1b)
|
|
132
158
|
# prints the 32-char hex key
|
|
133
159
|
# (exit 1 on hash failure → caller
|
|
134
160
|
# treats as clean miss)
|
|
@@ -580,10 +606,11 @@ shim_cache_session_token() {
|
|
|
580
606
|
# shim_cache_key SCHEMA SESSION_TOKEN PROJECT_REALPATH CLI_REALPATH \
|
|
581
607
|
# CLI_MTIME CLI_SIZE EUID ENFORCE_SHAPE SHIM_NAME \
|
|
582
608
|
# PKG_MTIME PKG_SIZE DIST_DIR_MTIME \
|
|
583
|
-
# NODE_REALPATH NODE_MTIME
|
|
609
|
+
# NODE_REALPATH NODE_MTIME \
|
|
610
|
+
# TRUST_TIER REGISTRY_MTIME REGISTRY_SIZE
|
|
584
611
|
#
|
|
585
612
|
# Echoes the 32-char hex key on success; empty + exit 1 on hash
|
|
586
|
-
# failure.
|
|
613
|
+
# failure. Evolution:
|
|
587
614
|
# - codex round-1 P1: SHIM_NAME added so the cache is hook-scoped
|
|
588
615
|
# (the skipped probe `rea hook \$SHIM_NAME --help` is hook-specific)
|
|
589
616
|
# - codex round-3 P1+P2: PKG_MTIME / PKG_SIZE / DIST_DIR_MTIME added
|
|
@@ -595,9 +622,16 @@ shim_cache_session_token() {
|
|
|
595
622
|
# invalidates the entry (the warm hit would otherwise skip both
|
|
596
623
|
# node-availability AND the version probe, forwarding through a
|
|
597
624
|
# different interpreter).
|
|
625
|
+
# - 0.49.0 Phase 1b: TRUST_TIER + REGISTRY_MTIME + REGISTRY_SIZE added
|
|
626
|
+
# (positions 15-17) for the opt-in global-CLI resolver tier. The
|
|
627
|
+
# guard is raised from 14 to 17 args; the SCHEMA is bumped to "v2".
|
|
628
|
+
# ENFORCE_SHAPE (position 8) carries the EFFECTIVE value — "1" when
|
|
629
|
+
# the global tier is in effect (A4 shape is always-on there) OR
|
|
630
|
+
# SHIM_ENFORCE_CLI_SHAPE==1. REGISTRY_MTIME/SIZE are "" on the
|
|
631
|
+
# project tier.
|
|
598
632
|
# -----------------------------------------------------------------------------
|
|
599
633
|
shim_cache_key() {
|
|
600
|
-
if [ "$#" -lt
|
|
634
|
+
if [ "$#" -lt 17 ]; then
|
|
601
635
|
return 1
|
|
602
636
|
fi
|
|
603
637
|
_shim_cache_sha256_hex "$@"
|