bostrat-node 1.16.5 → 1.16.7
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/bin/bostrat-audit +6 -4
- package/bin/bostrat-estimate +4 -3
- package/bin/bostrat-secret +6 -0
- package/dist/cli.js +104 -92
- package/dist/index.js +355 -302
- package/node-entrypoint.sh +39 -0
- package/package.json +1 -1
package/node-entrypoint.sh
CHANGED
|
@@ -7,6 +7,45 @@ mkdir -p "$HOME/repos"
|
|
|
7
7
|
# operator can overwrite it (it persists in $HOME/.gitconfig on the volume).
|
|
8
8
|
git config --global user.name >/dev/null 2>&1 || git config --global user.name "bostrat node"
|
|
9
9
|
git config --global user.email >/dev/null 2>&1 || git config --global user.email "node@bostrat.ai"
|
|
10
|
+
# Box containment (BP-AU-I10, src/box-user.js) — only when the operator opted
|
|
11
|
+
# in with BOSTRAT_BOX_USER. Boxes then run as that uid, not root: its home sits
|
|
12
|
+
# on the volume (its CLI logins survive machine replacement), ~/.claude there is
|
|
13
|
+
# root-owned + sticky (the hook settings the node writes stay read-only to the
|
|
14
|
+
# box), root's own logins are closed to it, and the CLIs installed under /root
|
|
15
|
+
# and $HOME/.local stay reachable. auditd is best-effort: a guest kernel
|
|
16
|
+
# without audit support leaves doctor's "box containment" row saying so.
|
|
17
|
+
if [ -n "${BOSTRAT_BOX_USER:-}" ] && id "$BOSTRAT_BOX_USER" >/dev/null 2>&1; then
|
|
18
|
+
BOX_HOME=$(getent passwd "$BOSTRAT_BOX_USER" | cut -d: -f6)
|
|
19
|
+
BOX_UID=$(id -u "$BOSTRAT_BOX_USER")
|
|
20
|
+
BOX_GID=$(id -g "$BOSTRAT_BOX_USER")
|
|
21
|
+
mkdir -p "$BOX_HOME/.claude"
|
|
22
|
+
chown "$BOX_UID:$BOX_GID" "$BOX_HOME" && chmod 750 "$BOX_HOME"
|
|
23
|
+
chown "0:$BOX_GID" "$BOX_HOME/.claude" && chmod 3775 "$BOX_HOME/.claude"
|
|
24
|
+
setfacl -d -m "u:$BOX_UID:rwX,g:$BOX_GID:rwX" "$BOX_HOME/.claude" || true
|
|
25
|
+
[ -e "$BOX_HOME/.claude/settings.json" ] && chown "0:$BOX_GID" "$BOX_HOME/.claude/settings.json" && chmod 644 "$BOX_HOME/.claude/settings.json"
|
|
26
|
+
for p in .claude .claude.json .codex .cursor .config/gh .ssh .gitconfig .bostrat/node.env .bostrat/api-token .bostrat/plane-link .bostrat/secure-inputs; do
|
|
27
|
+
[ -e "$HOME/$p" ] && chmod -R go-rwx "$HOME/$p" || true
|
|
28
|
+
done
|
|
29
|
+
setfacl -m "u:$BOX_UID:x" /root "$HOME" "$HOME/.bostrat" 2>/dev/null || true
|
|
30
|
+
for d in /root/.local /root/.local/share "$HOME/.local" "$HOME/.local/share"; do [ -d "$d" ] && setfacl -m "u:$BOX_UID:x" "$d" || true; done
|
|
31
|
+
for d in /root/.local/share/cursor-agent "$HOME/.local/bin" "$HOME/.local/share/claude" "$HOME/.bostrat/git-hooks"; do
|
|
32
|
+
[ -d "$d" ] && setfacl -R -m "u:$BOX_UID:rX" "$d" || true
|
|
33
|
+
done
|
|
34
|
+
[ -d "$HOME/.bostrat/deps" ] && setfacl -R -P -m "u:$BOX_UID:rX,d:u:$BOX_UID:rX" "$HOME/.bostrat/deps" || true
|
|
35
|
+
git config --global --get user.name >/dev/null 2>&1 && HOME="$BOX_HOME" git config --global user.name "$(git config --global user.name)" || true
|
|
36
|
+
git config --global --get user.email >/dev/null 2>&1 && HOME="$BOX_HOME" git config --global user.email "$(git config --global user.email)" || true
|
|
37
|
+
[ -e "$BOX_HOME/.gitconfig" ] && chown "$BOX_UID:$BOX_GID" "$BOX_HOME/.gitconfig" || true
|
|
38
|
+
mkdir -p /etc/audit/rules.d
|
|
39
|
+
printf -- '-a always,exit -F arch=b64 -S execve,execveat -F uid=%s -k bostrat-box\n' "$BOX_UID" > /etc/audit/rules.d/bostrat-box.rules
|
|
40
|
+
if command -v auditd >/dev/null 2>&1 && ! pgrep -x auditd >/dev/null 2>&1; then
|
|
41
|
+
if auditd && auditctl -R /etc/audit/rules.d/bostrat-box.rules >/dev/null 2>&1; then
|
|
42
|
+
echo "[entrypoint] box containment: auditd logging ${BOSTRAT_BOX_USER}'s execs"
|
|
43
|
+
else
|
|
44
|
+
echo "[entrypoint] box containment: auditd unavailable on this kernel — execs are not logged"
|
|
45
|
+
fi
|
|
46
|
+
fi
|
|
47
|
+
echo "[entrypoint] box containment: boxes run as $BOSTRAT_BOX_USER (uid $BOX_UID), home $BOX_HOME"
|
|
48
|
+
fi
|
|
10
49
|
# The agent drives boxes on a host tmux server (the Pi's globo-tmux.service
|
|
11
50
|
# equivalent): keep one alive with a detached keeper session.
|
|
12
51
|
SOCKET="${BOSTRAT_TMUX_SOCKET:-/tmp/tmux-0/default}"
|
package/package.json
CHANGED