Commit Graph

6 Commits

Author SHA1 Message Date
王性驊 09d782bc32 fix: 獨立審查找到的問題(二):技能的工具限制、連接器登入、檢查點、監看、目標
技能的 allowed-tools(三個會讓限制失效的):
- 用部分名字讀技能時沒有套上限制;靠左寫的清單(- Read)和帶冒號的項目讀成空的;Read(docs/**) 連改檔也放行,而且 docs/../.. 繞得出去。
- 後讀的技能會把限制換掉(現在第一個的限制留著);browser、computer 寫了卻永遠對不上;參數裡的 ' 把後面全吃掉。
連接器登入:
- token 只認名字不認網址:改了網址或同名重加,舊 token 會送到新的地方。現在綁登入時的網址;移除就登出;登出後連線也斷。
- 連接器給的登入位址沒有檢查:可以指到雲端中繼資料、Docker 管理端點,或非網頁的位址。現在都要是網頁位址、過安全規則;resource 不能是別的網站。
- 鑰匙圈一時打不開時,存別的連接器會把其他 token 清空。
檢查點:還原失敗還是把檢查點丟掉;同一個 Bot 另一段對話改的檔案也被退;監看、例行任務的訊息被當成可以退回的點;紀錄檔沒有鎖。
監看:輸出滿 4 MB 之後就再也不叫;印很多又馬上結束的指令被說成「太多行停掉」。
目標:數字在動的進度(還差 7 → 還差 6)被當成同一個理由而暫停;使用者說繼續後,下一輪又跟暫停前比;做不到也撒彩帶;沒有電腦時評審連網頁都不能看。
其他:fork 技能在群組裡被吃掉(群組沒有支線,改在聊天裡做)。

已驗證:cargo test 613 通過(技能、連接器、檢查點、目標各補了斷言)、clippy -D warnings 乾淨。
沒修:Box/SSH 上非 UTF-8 的檔案檢查點會存壞(edit_file 本來就只處理文字);引用訊息再打指令不算指令(原本就這樣);Windows 的管理員 hook 檔位置一般使用者可能寫得進去(沒辦法在這裡驗)。

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-17 14:24:12 +08:00
王性驊 35807099bb fix: 回頭檢查這兩天的改動,修 5 個問題(2 個是安全問題)
- 目標的評審讀檔沒有過安全檢查:讀得到 .env、金鑰、AnyBot 自己的資料和工作資料夾以外的檔案,還會送給另一家模型。現在只讀 Bot 不用問就能讀的。
- Linux 沙盒:工作資料夾就是家目錄(起始資料夾沒填)時整個放行,~/.ssh 和 AnyBot 的資料變成讀寫都可以。現在工作資料夾裡有私密資料夾就不整個放行。
- 技能參數:技能自己程式碼裡的 $1(awk '{print $1}')被當成參數換掉。現在 $N 只在技能有寫 arguments、argument-hint 或 $ARGUMENTS 時才換。
- 連接器登入:token 每條連線只會換新一次,之後再過期就說「金鑰不對」。現在每次過期都換。
- Hooks:hook 不讀輸入、事件又很大(長的工具結果)時,寫入會卡住,逾時也停不了。寫入改在另一條執行緒。

已驗證:cargo test 613 通過(每一項都加了測試,連接器再次換新除外)、clippy -D warnings 乾淨。
未驗證:Linux 沙盒那一項只測了規劃,真的核心上沒跑。

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-17 14:07:48 +08:00
王性驊 f4911b1b7e feat: 技能帶參數:argument-hint/arguments($ARGUMENTS、$0…、$名字)、allowed-tools(這一輪只准用這些)、context: fork(在支線做)
- SKILL.md 開頭多四個欄位,寫法跟 Claude Code 一樣(一行逗號、[a, b]、或一行一個 - 都讀得懂),存回去也寫得回去。
- 「/名稱 參數」:技能有參數時,替模型加的那一行帶上參數,use_skill 多一個 arguments,讀到的做法裡換好(都沒寫就附在最後);沒參數的技能照舊。/ 清單顯示 argument-hint。
- allowed-tools 是限制不是放行:讀了這個技能之後這一輪只准用那些(Claude Code 的名字對到 AnyBot 的工具,Bash(git log:*) 是 shell(git log *),走 gate.rs 的固定樣式),別的步驟不執行;use_skill、read_result、ask_person 一定能用。裝來的技能不能替自己開權限。
- context: fork:打「/名稱 …」改開支線(跟 /btw 一樣);走 commands.rs 的 command_for,電腦和手機/螢幕一樣。

已驗證:cargo test 597 通過(欄位讀寫來回、參數代換含引號和 $5、名稱對照和樣式、真的一輪裡 use_skill 之後 edit_file 被擋、fork 技能變支線、沒參數的技能提示不變)、clippy -D warnings 乾淨。
未驗證:真的模型拿到參數和限制時的做法。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:51:07 +08:00
王性驊 eb3157852a 安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
  concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
  mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
  ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
  forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
  gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
  the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
  labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
  verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
  and PDF export while masking card/CVC values and screenshots; remember sites only on
  always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
  ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
  paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
  routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
  team-member turns from owner memories, appctl and grants; scrub shared bot exports and
  reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
  and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
  reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
  buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
  setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
  wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
  mirror edits across brief disconnects; give Chinese skills distinct folders and approval
  gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
  fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
  cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 14:34:10 +08:00
王性驊 41b6b7f465 技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
  start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
  pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
  brain recognises 「/name」 and adds a line after the message telling the model to read that skill
  with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
  path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
  since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
  brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
  skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
  brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
  own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
  computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
  hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
  / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
  before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:54:58 +08:00
王性驊 f9a261959c version_0_1_1-alpha 2026-11-11 16:19:06 +08:00