帖录Quire

审阅

安装技能前的 3 项检查

有人在 ClawHub 上放了 314 个恶意技能:查来源、扫代码、追问权限,五分钟以内。

步骤

  1. 01

    复制这 3 项检查。

  2. 02

    在装进你的代理之前,对任何技能都先跑一遍。

  3. 03

    你会得到:不到五分钟,你就知道是谁写的、它向外调用什么、它想要什么权限。

我现在安装任何技能前都会跑的 3 项检查

01
1. 来源:作者是谁,有没有其他正经项目
2. 代码扫描:搜索 curl、wget、exec、外部 URL
3. 权限:需要文件系统访问吗?需要 shell 吗?为什么?

检查:技能扫描脚本

02
#!/bin/sh
dir=$1
if [ -z "$dir" ] || [ ! -d "$dir" ] || [ ! -r "$dir" ]; then
  echo "Can't scan '$dir': it is not a folder you can read." >&2
  exit 2
fi
st=$(mktemp) || exit 2
find "$dir" \( -type f -o -type l \) -exec sh -c '
  st=$1; shift
  for f; do
    case "${f##*/}" in
      .env*|*.pem|*.key|*.p12|id_*|*credentials*|*secret*) echo "$f: skipped, may hold secrets; read it yourself"; echo hit >> "$st"; continue ;;
    esac
    if [ -L "$f" ]; then echo "$f: a symlink, not followed; read it yourself"; echo hit >> "$st"; continue; fi
    lines=$(grep -naE "(curl|wget|exec)|https?://" "$f")
    case $? in
      0) echo "$f: line $(printf "%s\n" "$lines" | cut -d: -f1 | paste -sd, -)"; echo hit >> "$st" ;;
      1) ;;
      *) echo "$f: could not read it" >&2; echo error >> "$st" ;;
    esac
  done' sh "$st" {} + || echo error >> "$st"
if grep -q error "$st"; then
  echo "Scan incomplete: fix the errors above and run it again." >&2; r=2
elif grep -q hit "$st"; then r=1
else echo "No curl, wget, exec or external URLs in $dir."; r=0
fi
rm -f "$st"
exit $r

列出技能里每一处调用 curl、wget 或 exec,或提到外部 URL 的文件和行号,但不打印该行。它还会列出因可能含有机密而跳过的文件(.env、密钥、凭证),以及它不跟随的符号链接;有内容可读时以退出码 1 退出,无法读取该文件夹或其中某个文件时以退出码 2 退出。保存为 scan-skill.sh,安装前运行 sh scan-skill.sh path/to/skill。Copybook 于 2026 年 11 月 24 日在 macOS 26.6 上编写并测试了它。

这项检查是 Copybook 的,不属于这条技巧,一旦添加就在用户的机器上运行。等技巧就位后再提供,先展示出来,只有用户说可以才添加。

背景

有人在 ClawHub 上发布了 314 个技能。每一个都是恶意的。一旦装上,它们会读取你的 MEMORY.md、SOUL.md,你的代理记得的一切都泄露了。

我检查了自己的 5 个代理。干净。但说实话,一身冷汗。

用不了五分钟。不做这三项检查就安装技能,就像不看合同就签字。