跳转到正文
报告库
用途分类 / 其他用途

Golang Dependency Management Skill 安全审计

作者说它能做什么(原文)

Dependency management for Golang projects — go.mod and go.sum, `go get` install and upgrade flows, Minimal Version Selection, conflict resolution with replace/exclude/retract, `govulncheck` scanning of the module tree, outdated dependency and binary size auditing, vendoring, `tool` directives, and go.work workspaces. Use when adding, removing, or upgrading Go dependencies, deciding whether to take

第三方安全检查结论

发现安全风险

已检查文件
8
发现的风险
5
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
中风险

安装并运行未固定版本的最新工具会引入可变的供应链执行风险

原文依据:4 处
发现了什么

安装说明和项目工具示例使用 `@latest`,随后指示通过 `go tool` 或 PATH 执行下载的程序。相同操作在不同日期可能取得不同代码,不能仅凭仓库中的固定版本审查来预测。

为什么需要注意

如果上游版本、模块分发路径或账号在安装时被破坏,恶意或有缺陷的可执行代码可能以代理的文件和环境权限运行。

该技能主动声明安装 `govulncheck@latest`,并允许代理执行该程序;工具固定示例也先以 `@latest` 修改模块,再通过 `go tool` 运行。首次解析的版本会随时间变化,因此用户可能在审查具体版本前下载并执行外部代码。用户可要求作者使用明确版本,并在执行前展示来源、版本及 go.mod/go.sum 差异。

SKILL.md:17来自说明文档打开原文件
        - govulncheck    install:      - kind: go        package: golang.org/x/vuln/cmd/govulncheck@latest        bins: [govulncheck]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent Bash(govulncheck:*) AskUserQuestion
查看另外 3 个位置
SKILL.md:114来自说明文档打开原文件
```bash# Add tools to the current module.go get -tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latestgo get -tool golang.org/x/vuln/cmd/govulncheck@latestgo get -tool golang.org/x/perf/cmd/benchstat@latest# Run pinned tools reproducibly.go tool golangci-lint run ./...go tool govulncheck ./...go tool benchstat old.txt new.txt
SKILL.md:21来自说明文档打开原文件
        bins: [govulncheck]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent Bash(govulncheck:*) AskUserQuestion---
SKILL.md:115来自说明文档打开原文件
```bash# Add tools to the current module.go get -tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latestgo get -tool golang.org/x/vuln/cmd/govulncheck@latestgo get -tool golang.org/x/perf/cmd/benchstat@latest# Run pinned tools reproducibly.go tool golangci-lint run ./...go tool govulncheck ./...go tool benchstat old.txt new.txt
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 2 项风险
中风险

现有依赖升级被称为“安全”,因此可在没有逐次确认时大范围改写依赖

原文依据:4 处
发现了什么

技能把 `go get -u` 升级称为安全,并提供升级全部直接和间接依赖的命令。虽然稍后推荐补丁升级和测试,但这句规则可能允许代理先执行广泛变更。

为什么需要注意

go.mod、go.sum 和构建结果可能发生大范围变化;次版本或间接依赖的行为变化可能通过测试仍未覆盖的路径进入产品。

风险来自规则把现有依赖的 `go get -u` 概括为“safe”,同时示例明确会升级全部直接和间接依赖。后文确实降低了风险:优先补丁更新,并要求评审、测试和扫描;但这不能完全消除前述措辞可能被代理理解为无需确认即可执行广泛改写。用户可限制为补丁更新并要求先展示计划和差异。

SKILL.md:34来自说明文档打开原文件
**Before running `go get` to add any new dependency, AI agents MUST ask the user for confirmation.** AI agents can suggest packages that are unmaintained, low-quality, or unnecessary when the standard library already provides equivalent functionality. Using `go get -u` to upgrade an existing dependency is safe.
查看另外 3 个位置
SKILL.md:83来自说明文档打开原文件
### Upgrading```bashgo get -u ./...            # Upgrade ALL direct+indirect deps to latest minor/patchgo get -u=patch ./...      # Upgrade to latest patch only (safer)go get github.com/pkg@v1.5 # Upgrade specific package```
SKILL.md:32来自说明文档打开原文件
## AI Agent Rule: Ask Before Adding Dependencies**Before running `go get` to add any new dependency, AI agents MUST ask the user for confirmation.** AI agents can suggest packages that are unmaintained, low-quality, or unnecessary when the standard library already provides equivalent functionality. Using `go get -u` to upgrade an existing dependency is safe.
SKILL.md:91来自说明文档打开原文件
**Prefer `go get -u=patch`** for routine updates. Patch and minor updates are usually lower risk than major upgrades, but still require review. For dependency updates, run:```bashgo get -u=patch ./...go mod tidygo test ./...go vet ./...govulncheck ./...   # or: go tool govulncheck ./...```
中风险

安全更新被建议无视版本级别自动合并,可能把破坏性主版本变更直接写入代码库

原文依据:1 处
发现了什么

文档先说主版本更新应人工审查,紧接着又要求安全更新无论版本级别均自动合并。安全修复若同时包含主版本 API 或行为变化,这两个规则会冲突。

为什么需要注意

即使 CI 通过,未覆盖的接口、配置或运行时行为仍可能中断部署或改变安全边界。

这是生效的策略建议,不是测试或警告。它先要求主版本更新人工评审,却又让所有安全更新无视版本级别自动合并;安全修复若只能通过破坏性主版本获得,两条规则会冲突,可能在无人评审时改变 API 或行为。CI 通过只能部分缓解此风险。用户可要求所有主版本更新始终人工批准。

references/automated-updates.md:18来自说明文档打开原文件
## Auto-Merge Strategy- **Minor and patch updates**: Auto-merge only after CI passes (tests + lint + govulncheck) and the package is low-risk for the project- **Major updates**: Create PR for manual review (may contain breaking changes)- **Security updates**: Auto-merge regardless of version bump type
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
中风险

无限定的 git 命令权限超出依赖管理所需范围

原文依据:2 处
发现了什么

`Bash(git:*)` 不只涵盖查看依赖差异,也可能涵盖提交、重写历史、删除分支、修改远端或推送等命令。技能正文没有为这些高影响操作建立确认边界。

为什么需要注意

若宿主按该声明授予权限,错误指令或注入内容可能导致持久的仓库变化,甚至把本地内容发送到配置的远端。

`allowed-tools` 是技能请求的实际能力范围,其中 `Bash(git:*)` 覆盖所有以 git 调用的命令,而非仅只读检查。正文虽提到提交依赖文件,但没有给 git 推送、历史重写、远端修改或删除操作设置确认限制。因此,启用该能力会给代理超出依赖审计必需范围的权限;这不证明代理一定会滥用。用户可把权限限制为只读 git 子命令及必要的差异检查。

SKILL.md:21来自说明文档打开原文件
        bins: [govulncheck]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent Bash(govulncheck:*) AskUserQuestion---
查看另外 1 个位置
SKILL.md:45来自说明文档打开原文件
## Key Rules- `go.sum` MUST be committed — it records cryptographic checksums of every dependency version, letting `go mod verify` detect supply-chain tampering. Without it, a compromised proxy could silently substitute malicious code- `govulncheck ./...` or `go tool govulncheck ./...` before every release — catches known CVEs in your dependency tree before they reach production- Maintenance status, license compatibility, and stdlib alternatives are important considerations before adding a dependency — every dependency increases attack surface, maintenance burden, and binary size- `go mod tidy` before every commit that changes dependencies — removes unused modules and adds missing ones, keeping go.mod honest
中风险

一律忽略 go.work.sum 会丢失工作区专属依赖的可审查校验记录

原文依据:3 处
发现了什么

技能要求绝不提交 go.work.sum。该文件可能包含未出现在各模块 go.sum 中、但工作区构建需要的校验和;统一忽略它会使团队无法在代码审查中固定并比较这些记录。

为什么需要注意

不同开发者或 CI 首次解析工作区依赖时可能生成不同的校验记录,降低工作区构建的可审计性和异常发现能力。

该技能给出无条件的“不要提交 go.work.sum”规则,同时说明工作区可包含多个本地模块并同步模块变化。工作区解析可能产生各模块 go.sum 尚未记录的校验和;统一忽略会使这些记录无法随已共享的工作区配置接受评审,也会降低团队环境的一致性。风险取决于团队是否提交并依赖 go.work。用户可要求作者将规则改为按是否共享 go.work 决定,并说明完整性取舍。

references/workspaces.md:22来自说明文档打开原文件
## Key Points- Workspaces eliminate the need for `replace` directives during local development — the workspace automatically resolves local modules- **Do not commit `go.work.sum`** to version control (add to `.gitignore`)- `go.work` is for development only — it does not affect how consumers of your published modules resolve dependencies- For workspace directory structure examples, see the `samber/cc-skills-golang@golang-project-layout` skill
查看另外 2 个位置
references/workspaces.md:5来自说明文档打开原文件
| Scenario                                       | Use       || ---------------------------------------------- | --------- || Single module project                          | `go.mod`  || Developing multiple related local modules      | `go.work` || Monorepo with separate Go modules              | `go.work` || Testing local changes across module boundaries | `go.work` || Published library consumed by others           | `go.mod`  |
references/workspaces.md:15来自说明文档打开原文件
```bashgo work init                    # Initialize workspacego work use ./services/auth     # Add module to workspacego work use -rm ./old-module    # Remove module from workspacego work sync                    # Sync workspace with module changes```
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

7 个说明模块

该技能用于检查、添加、升级、删除和可视化 Go 依赖,并会修改 go.mod、go.sum,某些流程还会生成 vendor/ 或报告文件。

查看原文
SKILL.md:58来自说明文档打开原文件
| ----------------- | -------------------------------------------- || `go mod tidy`     | Add missing deps, remove unused ones         || `go mod download` | Download modules to local cache              || `go mod verify`   | Verify cached modules match go.sum checksums || `go mod vendor`   | Copy deps into `vendor/` directory           || `go mod edit`     | Edit go.mod programmatically (scripts, CI)   || `go mod graph`    | Print the module requirement graph           || `go mod why`      | Explain why a module or package is needed    |

新增依赖前要求用户确认,并要求先考虑标准库、许可证和替代方案;但该确认规则明确不涵盖现有依赖的升级。

查看原文
SKILL.md:34来自说明文档打开原文件
**Before running `go get` to add any new dependency, AI agents MUST ask the user for confirmation.** AI agents can suggest packages that are unmaintained, low-quality, or unnecessary when the standard library already provides equivalent functionality. Using `go get -u` to upgrade an existing dependency is safe.Before proposing a dependency, evaluate:- Does the standard library already cover the use case?- Is the license compatible?- Are there well-known alternatives?- What it does and why it's needed?

依赖升级流程包含整理模块文件、测试、静态检查和漏洞扫描,能够在变更后发现部分兼容性或安全问题。

查看原文
SKILL.md:91来自说明文档打开原文件
**Prefer `go get -u=patch`** for routine updates. Patch and minor updates are usually lower risk than major upgrades, but still require review. For dependency updates, run:```bashgo get -u=patch ./...go mod tidygo test ./...go vet ./...govulncheck ./...   # or: go tool govulncheck ./...```

技能声明了项目文件读写能力,并允许运行所有匹配 go、git、golangci-lint 和 govulncheck 的命令;实际影响取决于宿主是否把该字段作为权限授予。

查看原文
SKILL.md:21来自说明文档打开原文件
        bins: [govulncheck]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent Bash(govulncheck:*) AskUserQuestion---
从这里开始 · 工作说明SKILL.md
golang-dependency-management
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

6 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录8 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • references/auditing.md已纳入全文
  • references/automated-updates.md已纳入全文
  • references/conflicts.md已纳入全文
  • references/versioning.md已纳入全文
  • references/visualization.md已纳入全文
  • references/workspaces.md已纳入全文
  • evals/evals.json已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • evals/evals.json配套文件
  • references/auditing.md配套文件
  • references/automated-updates.md配套文件
  • references/conflicts.md配套文件
  • references/versioning.md配套文件
  • references/visualization.md配套文件
  • references/workspaces.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:12来自说明文档打开原文件
    emoji: "📦"    homepage: https://github.com/samber/cc-skills-golang    requires:
references/auditing.md:78来自说明文档打开原文件
**Modern alternative**: [go-size-analyzer](https://github.com/Zxilly/go-size-analyzer) (`gsa`) supports ELF, Mach-O, PE, and WebAssembly formats with interactive HTML/SVG visualization:
运行命令
SKILL.md:21来自说明文档打开原文件
        bins: [govulncheck]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent Bash(govulncheck:*) AskUserQuestion---
SKILL.md:74来自说明文档打开原文件
```bashgo get github.com/google/uuid          # Latest version
SKILL.md:85来自说明文档打开原文件
```bashgo get -u ./...            # Upgrade ALL direct+indirect deps to latest minor/patch
修改文件
references/workspaces.md:18来自说明文档打开原文件
go work use ./services/auth     # Add module to workspacego work use -rm ./old-module    # Remove module from workspacego work sync                    # Sync workspace with module changes
读取了多少行
714
文件校验值(用于核对版本)
56d2a12109fc417ecd25b4cf71f10c4571897593be3a4805c988fd1e95137238