@clawos-dev/clawd 0.2.211 → 0.2.212-beta.423.64d21c1
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/dist/cli.cjs +8 -8
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -53174,7 +53174,7 @@ var CLAWD_SSH_JAIL_SCRIPT = String.raw`#!/usr/bin/env bash
|
|
|
53174
53174
|
set -euo pipefail
|
|
53175
53175
|
|
|
53176
53176
|
# 用户可读审计日志:追加到 ~/.clawd/contact-ssh.log(跟 daemon TS 侧 contact-ssh-log.ts 共写)
|
|
53177
|
-
CONTACT_SSH_LOG="
|
|
53177
|
+
CONTACT_SSH_LOG="${"${HOME}"}/.clawd/contact-ssh.log"
|
|
53178
53178
|
log_line() {
|
|
53179
53179
|
# 参数: level tag msg
|
|
53180
53180
|
local ts
|
|
@@ -53182,16 +53182,16 @@ log_line() {
|
|
|
53182
53182
|
printf '[%s] [%s] [%s] %s\n' "$ts" "$1" "$2" "$3" >> "$CONTACT_SSH_LOG" 2>/dev/null || true
|
|
53183
53183
|
}
|
|
53184
53184
|
|
|
53185
|
-
DEVICE_ID="
|
|
53185
|
+
DEVICE_ID="${"${1:-}"}"
|
|
53186
53186
|
if [ -z "$DEVICE_ID" ]; then
|
|
53187
53187
|
log_line ERROR jail.entered "clawd-ssh-jail 缺 deviceId 参数"
|
|
53188
53188
|
echo "clawd-ssh-jail: missing deviceId" >&2
|
|
53189
53189
|
exit 1
|
|
53190
53190
|
fi
|
|
53191
53191
|
|
|
53192
|
-
log_line INFO jail.entered "clawd-ssh-jail 起来 device
|
|
53192
|
+
log_line INFO jail.entered "clawd-ssh-jail 起来 device=${"${DEVICE_ID}"} cmd=${"${SSH_ORIGINAL_COMMAND:-<interactive-shell>}"}"
|
|
53193
53193
|
|
|
53194
|
-
CONTACTS="
|
|
53194
|
+
CONTACTS="${"${HOME}"}/.clawd/contacts.json"
|
|
53195
53195
|
if [ ! -f "$CONTACTS" ]; then
|
|
53196
53196
|
log_line ERROR jail.entered "contacts.json 不存在,无法查 exposedDirs"
|
|
53197
53197
|
echo "clawd-ssh-jail: contacts.json missing" >&2
|
|
@@ -53214,7 +53214,7 @@ sys.exit(3)
|
|
|
53214
53214
|
")
|
|
53215
53215
|
|
|
53216
53216
|
if [ -z "$EXPOSED_JSON" ]; then
|
|
53217
|
-
log_line ERROR jail.entered "contact
|
|
53217
|
+
log_line ERROR jail.entered "contact ${"${DEVICE_ID}"} 不在 store 或 exposedDirs 为空"
|
|
53218
53218
|
echo "clawd-ssh-jail: contact not found or no exposed dirs" >&2
|
|
53219
53219
|
exit 1
|
|
53220
53220
|
fi
|
|
@@ -53241,7 +53241,7 @@ while IFS= read -r line; do
|
|
|
53241
53241
|
esac
|
|
53242
53242
|
done <<< "$EXPOSED_JSON"
|
|
53243
53243
|
|
|
53244
|
-
CMD="
|
|
53244
|
+
CMD="${"${SSH_ORIGINAL_COMMAND:-}"}"
|
|
53245
53245
|
if [ -z "$CMD" ]; then
|
|
53246
53246
|
SHELL_CMD=(bash --login)
|
|
53247
53247
|
else
|
|
@@ -53269,7 +53269,7 @@ case "$(uname -s)" in
|
|
|
53269
53269
|
POLICY+="
|
|
53270
53270
|
(allow file-read* file-write* (subpath \"$d\"))"
|
|
53271
53271
|
done <<< "$EXPOSED_JSON"
|
|
53272
|
-
exec sandbox-exec -p "$POLICY" "
|
|
53272
|
+
exec sandbox-exec -p "$POLICY" "${"${SHELL_CMD[@]}"}"
|
|
53273
53273
|
;;
|
|
53274
53274
|
Linux)
|
|
53275
53275
|
BWRAP_ARGS=(
|
|
@@ -53283,7 +53283,7 @@ case "$(uname -s)" in
|
|
|
53283
53283
|
while IFS= read -r d; do
|
|
53284
53284
|
BWRAP_ARGS+=(--bind "$d" "$d")
|
|
53285
53285
|
done <<< "$EXPOSED_JSON"
|
|
53286
|
-
exec bwrap "
|
|
53286
|
+
exec bwrap "${"${BWRAP_ARGS[@]}"}" "${"${SHELL_CMD[@]}"}"
|
|
53287
53287
|
;;
|
|
53288
53288
|
*)
|
|
53289
53289
|
echo "clawd-ssh-jail: unsupported OS $(uname -s)" >&2
|
package/package.json
CHANGED