简介
Use when a user submits an asdf plugin for inclusion in this repository (asdf-vm/asdf-plugins) and gives a Git repo URL, or asks to security-audit or security-review an asdf plugin repo. Clones the plugin repo and reviews every callback script for malicious code, exploits, and unsafe practices before it is added to plugins/.
通过你的 Agent 添加
安装目录:security-audit-plugin/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: security-audit-plugin
description: Use when a user submits an asdf plugin for inclusion in this repository (asdf-vm/asdf-plugins) and gives a Git repo URL, or asks to security-audit or security-review an asdf plugin repo. Clones the plugin repo and reviews every callback script for malicious code, exploits, and unsafe practices before it is added to plugins/.
Security Audit of an asdf Plugin
Audit an asdf plugin's source code for security issues before it is accepted into this index repository. Input is a Git repo URL (and optionally a proposed shortname). Output is a written security report with a clear verdict.
Background: how asdf plugins work
An asdf plugin is a directory of executable scripts (usually bash) at fixed paths, invoked by asdf core with specific arguments and env vars. Read https://asdf-vm.com/plugins/create.html if any callback's contract is unclear. The scripts that matter most:
bin/list-all— prints available versions. Usually curls/wgets a listing from a remote host.bin/download— downloads a release archive for$ASDF_INSTALL_VERSIONto$ASDF_DOWNLOAD_PATH. Highest-risk script: decides what URL is fetched and nothing validates the content after download unless the plugin itself checks it.bin/install— builds/copies files from$ASDF_DOWNLOAD_PATHinto$ASDF_INSTALL_PATH. Runs arbitrary build steps (make, compilers, package managers).bin/exec-env,bin/exec-path,bin/uninstall,bin/help.*,bin/latest-stable,bin/list-bin-paths— smaller surface but still run on every shell invocation (exec-envin particular is sourced into the user's environment on every command).lib/*,scripts/*, or vendored binaries sourced/called by the above.
All of these run with the permissions of the user's shell, with no sandboxing. There is no signature verification step provided by asdf itself unless the plugin implements one.
Procedure
-
Clone the repo into a scratch directory, never into this working tree:
mkdir -p /tmp/opencode/plugin-audit
git clone --depth 50 <repo_url> /tmp/opencode/plugin-audit/<shortname>
Use --depth 50 (not a shallow depth of 1) so history tampering is still visible, but avoid a full clone for large repos.
-
Inventory the repo. List all files (git ls-files). Note the language the plugin manages (e.g. Elixir, Go, Rust) from the repo name or README. Identify every executable entry point under bin/ and any file they source (lib/, scripts/, hidden helper scripts). Flag any binary, archive, or compiled artifact committed to the repo itself — source-only repos should contain no .exe, .bin, .o, .jar, prebuilt tarballs, etc. Committed binaries are an automatic flag since their contents can't be line-reviewed.
-
Read every line of every script reachable from a callback, in order of risk: bin/download and bin/list-all first, then bin/install, then the rest. Don't rely on a grep-only pass — open and read full file contents, since malicious code is often placed after a long innocuous-looking block, inside a comment-like heredoc, or appended after a trailing semicolon on an otherwise normal line.
-
Check each item in the Security Checklist below against what was read.
-
Write the report to ./reports/<plugin_name>.md using the Report Format below. Give a clear verdict: PASS or FAIL. One or more "Automatic Flag" findings (see checklist) means FAIL unless there is a well-documented, legitimate reason confirmed by reading upstream docs. Create the reports/ directory if it doesn't exist. <plugin_name> is the shortname asdf will use (the proposed plugins/<name> file name), not the repo's own name, when the two differ.
Security Checklist
A. Download source legitimacy (automatic flag if violated)
- Identify every URL, host, and domain the scripts can fetch from (
curl, wget, fetch, git clone, language-specific fetchers like mix, go install, cargo, pip, npm install, nix). List them all explicitly in the report.
- For each host, judge whether it is the plausible, official source for that language/tool. Examples of expected hosts:
- Elixir/Erlang:
github.com/elixir-lang, hex.pm, repo.hex.pm, erlang.org, github.com/erlang/otp.
- Go:
go.dev, golang.org, github.com/golang.
- Rust:
static.rust-lang.org, github.com/rust-lang.
- Node:
nodejs.org, github.com/nodejs.
- Generic pattern: the tool's own GitHub org/repo, its own official site, or a first-party package registry (hex.pm, npmjs.org for Node's own distribution, pypi.org only if the tool itself is distributed there, etc.)
- A plugin mirroring releases via
github.com/<org>/<tool>/releases where <org>/<tool> is the well-known upstream project is normal.
- Any URL downloaded over plain
http:// instead of https:// is a flag — no integrity protection in transit.
- Automatic flag: a download host that is unrelated to the tool's known upstream (a random personal domain, a URL shortener, a paste site such as pastebin, a raw-content host serving attacker-controlled content like an unfamiliar CDN, an IP-literal URL, a typosquat of an official domain, or a mismatch between the plugin's stated purpose and where it fetches from). State explicitly why the host is unexpected.
- Note any host or URL that is built at runtime via string concatenation, env var indirection, or decoded from base64/hex — these hide the real destination from static review and are themselves a flag regardless of where they ultimately point (see section C).
B. Integrity and transport
Clone the repo into a scratch directory, never into this working tree:
mkdir -p /tmp/opencode/plugin-audit
git clone --depth 50 <repo_url> /tmp/opencode/plugin-audit/<shortname>
Use --depth 50 (not a shallow depth of 1) so history tampering is still visible, but avoid a full clone for large repos.
Inventory the repo. List all files (git ls-files). Note the language the plugin manages (e.g. Elixir, Go, Rust) from the repo name or README. Identify every executable entry point under bin/ and any file they source (lib/, scripts/, hidden helper scripts). Flag any binary, archive, or compiled artifact committed to the repo itself — source-only repos should contain no .exe, .bin, .o, .jar, prebuilt tarballs, etc. Committed binaries are an automatic flag since their contents can't be line-reviewed.
Read every line of every script reachable from a callback, in order of risk: bin/download and bin/list-all first, then bin/install, then the rest. Don't rely on a grep-only pass — open and read full file contents, since malicious code is often placed after a long innocuous-looking block, inside a comment-like heredoc, or appended after a trailing semicolon on an otherwise normal line.
Check each item in the Security Checklist below against what was read.
Write the report to ./reports/<plugin_name>.md using the Report Format below. Give a clear verdict: PASS or FAIL. One or more "Automatic Flag" findings (see checklist) means FAIL unless there is a well-documented, legitimate reason confirmed by reading upstream docs. Create the reports/ directory if it doesn't exist. <plugin_name> is the shortname asdf will use (the proposed plugins/<name> file name), not the repo's own name, when the two differ.
A. Download source legitimacy (automatic flag if violated)
curl, wget, fetch, git clone, language-specific fetchers like mix, go install, cargo, pip, npm install, nix). List them all explicitly in the report.- Elixir/Erlang:
github.com/elixir-lang,hex.pm,repo.hex.pm,erlang.org,github.com/erlang/otp. - Go:
go.dev,golang.org,github.com/golang. - Rust:
static.rust-lang.org,github.com/rust-lang. - Node:
nodejs.org,github.com/nodejs. - Generic pattern: the tool's own GitHub org/repo, its own official site, or a first-party package registry (hex.pm, npmjs.org for Node's own distribution, pypi.org only if the tool itself is distributed there, etc.)
- A plugin mirroring releases via
github.com/<org>/<tool>/releaseswhere<org>/<tool>is the well-known upstream project is normal. - Any URL downloaded over plain
http://instead ofhttps://is a flag — no integrity protection in transit.
- Does
bin/downloadverify the artifact after fetching it (checksum, GPG/minisign signature) beforebin/installuses it? Absence isn't automatically disqualifying (many real-world plugins skip this) but note it as a comment. - Is TLS certificate validation ever disabled (
curl -k/--insecure,wget --no-check-certificate,GIT_SSL_NO_VERIFY, Pythonssl._create_unverified_context, etc.)? Flag this. - Does the script pin a specific release asset by exact name/version, or does it fetch something mutable like a
latest/master/HEADtarball or a moving tag whose contents can change after review? Note as a comment unless combined with other red flags.
C. Obfuscation and indirection (automatic flag if present)
Flag any of the following, since there is no legitimate reason for a plugin's shell scripts to use them:
- Base64/hex/rot13/gzip-encoded strings that are decoded and executed (
echo ... | base64 -d | bash,eval "$(echo ... | base64 --decode)"). eval,source, orexecapplied to data built from concatenation, downloaded content, or environment variables rather than a static literal.- Downloading a script and piping it directly to a shell (
curl ... | sh,curl ... | bash,wget -O- ... | sh) — flag this even when the host looks legitimate, since it defeats any later review of what actually runs. - Unicode homoglyphs, zero-width characters, or unusual escape sequences in identifiers, strings, or comments.
- Deliberately confusing variable/function names, dead code designed to distract from one real payload line, or logic that behaves differently depending on whether it's being read vs. executed (anti-review tricks).
- Code that only activates under narrow, suspicious conditions (specific username, hostname, date, CI environment, or absence of a debugger/TTY) — a classic way to hide a payload from casual testing.
- Any construct whose only purpose seems to be to make the data flow hard to trace by hand.
D. Destructive or exfiltration-capable behavior
- File writes/deletes outside the paths asdf grants (
$ASDF_DOWNLOAD_PATH, $ASDF_INSTALL_PATH, $ASDF_DATA_DIR, plugin's own directory, standard temp dirs). Flag any rm -rf on an absolute path outside those, writes to ~/.ssh, ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.gitconfig, system crontab, /etc/*, shell rc files, or other persistence locations.
- Reads of sensitive files (
~/.ssh/*, ~/.aws/credentials, ~/.netrc, environment variables holding tokens/secrets) followed by any network call, write to a world-readable location, or inclusion in a URL/log — likely exfiltration.
- Network calls whose only purpose is to send data (POST/PUT with a body built from local file contents, env vars,
whoami, hostname, id, uname -a, installed package lists) to a remote host. Any outbound data transmission beyond what's needed to fetch a release is a flag.
- Spawning background/daemonized processes, modifying
PATH or shell rc files to persist beyond the current asdf invocation, installing cron jobs, systemd units, or launch agents.
- Privilege escalation:
sudo, su, chmod to 777/setuid, writing outside the user's home directory without clear justification.
- Supply-chain pivot: the plugin downloading a different tool (not the one it claims to manage) and executing it, or installing a package manager package as a side effect without documenting it.
E. Plugin-specific asdf risks
bin/exec-env is sourced into the shell on every command invocation for the tool — review it hardest for anything beyond setting PATH/ env vars relevant to the tool itself.
bin/list-all / bin/latest-stable output is parsed by asdf and shown to the user; code that writes anything other than clean version strings, or that has side effects (network exfiltration, file writes) beyond fetching a version list, is unexpected.
- Check
bin/install for use of the version string ($ASDF_INSTALL_VERSION) or other asdf-provided variables directly inside a shell command without quoting/sanitizing — command injection via a crafted version string is possible if a user is tricked into installing a malicious "version".
- Check for path traversal: version or filename values used to build paths without validation (
../ sequences reaching outside $ASDF_INSTALL_PATH).
- Check any
Makefile, configure script, or build step invoked by bin/install for the same classes of issues (D and C above) — build systems are a common place to hide a payload.
F. General code quality signals (comment-level, not automatic flags)
- Scripts don't set
set -e/set -u/set -o pipefail — not a security bug by itself, but increases risk of partial/unsafe state on failure.
- Unquoted variable expansions in contexts where word-splitting or glob expansion could matter.
- Use of
$(...) output directly in rm/mv/chmod targets without validation.
- Outdated or abandoned repo (last commit far in the past, open issues about security) — note as context, not a blocker by itself.
Report Format
$ASDF_DOWNLOAD_PATH, $ASDF_INSTALL_PATH, $ASDF_DATA_DIR, plugin's own directory, standard temp dirs). Flag any rm -rf on an absolute path outside those, writes to ~/.ssh, ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.gitconfig, system crontab, /etc/*, shell rc files, or other persistence locations.~/.ssh/*, ~/.aws/credentials, ~/.netrc, environment variables holding tokens/secrets) followed by any network call, write to a world-readable location, or inclusion in a URL/log — likely exfiltration.whoami, hostname, id, uname -a, installed package lists) to a remote host. Any outbound data transmission beyond what's needed to fetch a release is a flag.PATH or shell rc files to persist beyond the current asdf invocation, installing cron jobs, systemd units, or launch agents.sudo, su, chmod to 777/setuid, writing outside the user's home directory without clear justification.bin/exec-envis sourced into the shell on every command invocation for the tool — review it hardest for anything beyond settingPATH/env varsrelevant to the tool itself.bin/list-all/bin/latest-stableoutput is parsed by asdf and shown to the user; code that writes anything other than clean version strings, or that has side effects (network exfiltration, file writes) beyond fetching a version list, is unexpected.- Check
bin/installfor use of the version string ($ASDF_INSTALL_VERSION) or other asdf-provided variables directly inside a shell command without quoting/sanitizing — command injection via a crafted version string is possible if a user is tricked into installing a malicious "version". - Check for path traversal: version or filename values used to build paths without validation (
../sequences reaching outside$ASDF_INSTALL_PATH). - Check any
Makefile,configurescript, or build step invoked bybin/installfor the same classes of issues (D and C above) — build systems are a common place to hide a payload.
F. General code quality signals (comment-level, not automatic flags)
- Scripts don't set
set -e/set -u/set -o pipefail — not a security bug by itself, but increases risk of partial/unsafe state on failure.
- Unquoted variable expansions in contexts where word-splitting or glob expansion could matter.
- Use of
$(...) output directly in rm/mv/chmod targets without validation.
- Outdated or abandoned repo (last commit far in the past, open issues about security) — note as context, not a blocker by itself.
Report Format
set -e/set -u/set -o pipefail — not a security bug by itself, but increases risk of partial/unsafe state on failure.$(...) output directly in rm/mv/chmod targets without validation.Write a single markdown file to ./reports/<plugin_name>.md. Keep it tight — this is read by maintainers and shared with plugin authors, not an exhaustive audit log.
# <plugin_name>: PASS
<One short paragraph describing what the plugin does and where it gets its artifacts from, e.g. "This plugin downloads precompiled Elixir versions from hex.pm, unpacks them, and installs them as asdf-managed Elixir versions.">
## Notes
- <minimal, only what's useful to share with the plugin author>
For a failing review:
# <plugin_name>: FAIL
<Same one short paragraph describing expected/observed behavior.>
## Security Issues
- <file path + line/snippet>: <concrete issue, why it's a problem>
- ...
## Notes
- <minimal>
Rules:
- The first line is always
# <plugin_name>: PASSor# <plugin_name>: FAIL— nothing else on that line. - The expectation paragraph is always present, regardless of verdict.
- The "Security Issues" section appears only on FAIL, and only lists issues confirmed to be real problems (not every checklist item considered) — cite the file and the specific line/snippet for each.
- The "Notes" section is always present but stays minimal: just enough context for the plugin author (e.g. missing checksum verification, reliance on a mutable
latesttag, outdated repo) — skip anything not worth their attention. - Do not include file inventories, host tables, or an itemized checklist walkthrough in the final report; that reasoning stays in your working process, not in the output file.