ClaudeMods
☰
ZH-TW
● — 人在線上 · 瀏覽 — 次
贊助提交作品
教學資源 · 發布者 Yaori

一個 CLAUDE CODE 外掛可以在你看到之前就讀取你的 API 金鑰並批准命令

一個 CLAUDE CODE 外掛可以在你看到之前就讀取你的 API 金鑰並批准命令。以下是如何在 30 秒內檢查一個外掛。

Y
Yaori@Pashoke1

A CLAUDE CODE MOD CAN READ YOUR API KEYS AND APPROVE COMMANDS BEFORE YOU SEE THEM. HERE'S HOW TO CHECK ONE IN 30 SECONDS. not a theory. it's written on Anthropic's own mods page. once a mod loads, it can: → read and write files anywhere your user account can → read your environment variables and settings files, API keys included → see every prompt you send and every tool call Claude makes → rewrite a prompt or a tool call → approve a tool call before you're asked → spend your usage by calling a model mods aren't sandboxed either. sandboxing isolates the Bash commands Claude runs. a process a mod starts runs outside it. the one thing a mod can't touch is the permission prompt. it can't change what that prompt shows you. so here's the 30-second check before installing anything from a stranger: 01. get the files without running them git clone the repo. don't install yet. 02. run the validator claude plugin validate ./the-mod it reads the code without running it and tells you exactly what the mod does. 03. read the "hooks:" line the events it listens to. a theme should be drawing things. if a theme also hooks every tool call, ask why. 04. read the "calls:" line everything it asks Claude Code to do. a skin calling http.fetch is a red flag. a cost tracker writing files outside its own folder is a red flag. anything calling a model is spending your usage. 05. look for "env reads:" if the mod reads environment variables, the validator prints that line. a timer has no reason to read your keys. 06. know your brakes before you need them → one mod: /plugin, Installed tab, disable it → every mod you installed, one session: claude --safe-mode → every mod you installed, every session: "disableAllHooks": true in ~/.claude/settings.json (this also stops your settings hooks and custom status line) one more trap if you write your own guard mod: a hook that throws gets skipped, and the command it was meant to stop runs anyway. give every guard a .catch and test that it actually blocks. good news for the mods Claude writes for you: they only load after you approve hot reload, only in a workspace you've trusted, and never in claude -p where nobody can say yes. mods are the best thing to happen to Claude Code in a long time. just treat them like browser extensions that run as you, because that's what they are. the full safety section, the install order and every command are in the article below.

已翻譯

關於這個 mod

一個 CLAUDE CODE 外掛可以在你看到之前就讀取你的 API 金鑰並批准命令。以下是如何在 30 秒內檢查一個外掛。

這不是理論。它寫在 Anthropic 自己的外掛頁面上。

一個外掛一旦載入,它可以:

→ 在你的使用者帳戶能存取的任何地方讀寫檔案 → 讀取你的環境變數和設定檔案,包括 API 金鑰 → 看到你發送的每一條提示以及 Claude 進行的每一次工具呼叫 → 重寫一條提示或一次工具呼叫 → 在你被詢問之前批准一次工具呼叫 → 透過呼叫模型消耗你的用量

外掛也沒有沙箱隔離。沙箱隔離的是 Claude 執行的 Bash 命令。外掛啟動的行程在沙箱之外執行。

外掛唯一不能碰的是權限提示。它不能改變那個提示向你顯示的內容。

所以,在安裝任何來自陌生人的東西之前,這裡是 30 秒檢查:

  1. 取得檔案但不執行它們

git clone 倉庫。先不要安裝。

  1. 執行驗證器

claude plugin validate ./the-mod

它讀取程式碼而不執行它,並準確告訴你這個外掛做什麼。

  1. 讀取 "hooks:" 行

它監聽的事件。一個主題應該是用來繪製東西的。如果一個主題還掛接每一次工具呼叫,問問為什麼。

  1. 讀取 "calls:" 行

它要求 Claude Code 做的所有事情。一個面板呼叫 http.fetch 是一個危險訊號。一個成本追蹤器在自己的資料夾之外寫檔案是一個危險訊號。任何呼叫模型的東西都在消耗你的用量。

  1. 尋找 "env reads:"

如果外掛讀取環境變數,驗證器會印出那一行。一個計時器沒有理由讀取你的金鑰。

  1. 在需要之前了解你的煞車

→ 一個外掛:/plugin,已安裝分頁,將它停用 → 你安裝的每一個外掛,一個工作階段:claude --safe-mode → 你安裝的每一個外掛,每個工作階段:在 ~/.claude/settings.json 中設定 "disableAllHooks": true(這也會停止你的設定掛接和自訂狀態列)

如果你撰寫自己的防護外掛,還有一個陷阱:一個拋出的掛接會被跳過,而它本應阻止的命令無論如何都會執行。給每一個防護加上 .catch,並測試它確實能阻止。

對於 Claude 為你撰寫的外掛來說,好消息是:它們只在你批准熱重新載入後載入,只在你信任的工作區中載入,並且永遠不會在 claude -p 中載入,因為在那裡沒有人能說不。

外掛是 Claude Code 在很長一段時間裡發生最好的事情。只是要把它們當作以你的身分執行的瀏覽器擴充功能來對待,因為它們就是這樣。

完整的安全部分、安裝順序和每一條命令都在下面的文章中。

安裝

安裝方式請查看原始來源。

原文 / README

A CLAUDE CODE MOD CAN READ YOUR API KEYS AND APPROVE COMMANDS BEFORE YOU SEE THEM. HERE'S HOW TO CHECK ONE IN 30 SECONDS.

not a theory. it's written on Anthropic's own mods page.

once a mod loads, it can:

→ read and write files anywhere your user account can → read your environment variables and settings files, API keys included → see every prompt you send and every tool call Claude makes → rewrite a prompt or a tool call → approve a tool call before you're asked → spend your usage by calling a model

mods aren't sandboxed either. sandboxing isolates the Bash commands Claude runs. a process a mod starts runs outside it.

the one thing a mod can't touch is the permission prompt. it can't change what that prompt shows you.

so here's the 30-second check before installing anything from a stranger:

  1. get the files without running them

git clone the repo. don't install yet.

  1. run the validator

claude plugin validate ./the-mod

it reads the code without running it and tells you exactly what the mod does.

  1. read the "hooks:" line

the events it listens to. a theme should be drawing things. if a theme also hooks every tool call, ask why.

  1. read the "calls:" line

everything it asks Claude Code to do. a skin calling http.fetch is a red flag. a cost tracker writing files outside its own folder is a red flag. anything calling a model is spending your usage.

  1. look for "env reads:"

if the mod reads environment variables, the validator prints that line. a timer has no reason to read your keys.

  1. know your brakes before you need them

→ one mod: /plugin, Installed tab, disable it → every mod you installed, one session: claude --safe-mode → every mod you installed, every session: "disableAllHooks": true in ~/.claude/settings.json (this also stops your settings hooks and custom status line)

one more trap if you write your own guard mod: a hook that throws gets skipped, and the command it was meant to stop runs anyway. give every guard a .catch and test that it actually blocks.

good news for the mods Claude writes for you: they only load after you approve hot reload, only in a workspace you've trusted, and never in claude -p where nobody can say yes.

mods are the best thing to happen to Claude Code in a long time. just treat them like browser extensions that run as you, because that's what they are.

the full safety section, the install order and every command are in the article below.

更多類似作品