跳转到正文
报告库
用途分类 / 开发辅助

Golang Lint Skill 安全审计

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

Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user mentions golangci-lin

第三方安全检查结论

发现安全风险

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

依赖安装使用未固定的 `latest` 版本

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

安装命令从 GitHub 获取并构建 golangci-lint 的当前最新版本,没有固定版本号或校验值。相同指令在不同时间可能下载不同代码及其依赖。

为什么需要注意

如果上游发布、依赖链或分发账户遭破坏,安装或之后运行该二进制文件可能在用户权限下执行非预期代码;即使没有攻击,版本漂移也会改变修复结果。

依赖说明给出了可执行的 `go install ...@latest`,会在安装时从 GitHub 模块生态获取当时的最新版本,没有版本固定或校验步骤。因此用户执行它时,得到的代码和传递依赖可能随时间变化,并以用户权限安装可执行文件。这不是恶意行为的证据,但会降低构建可复现性并增加上游供应链风险。用户可要求作者提供经过测试的固定版本和校验/发布验证信息。

SKILL.md:37来自说明文档打开原文件
**Dependencies:**- golangci-lint: `go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest`
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
中风险

自动修复会并发改写项目中的 Go 文件

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

该 Skill 明确要求在日常编码时后台运行自动修复,并在旧代码库清理时让多个子代理同时处理不同问题;其中一个命令以 `./...` 为范围,可修改整个 Go 模块,而不只是用户正在查看的文件。

为什么需要注意

格式化、导入和部分代码结构可能在主任务仍进行时被改写。多个代理同时编辑相关文件还可能产生冲突、覆盖尚未检查的改动,或形成范围较大的难审查差异。

该风险有源码支持。编码模式要求后台代理对“已修改文件”运行带 `--fix` 的命令;旧代码库模式则要求最多 5 个代理并发处理,其中自动修复覆盖 `./...`,其他代理也被要求修复代码。只有在用户采用这些模式且授权修改时才会发生;影响可能包括整个 Go 模块的批量改写及并发编辑冲突。用户可要求先仅运行不带 `--fix` 的检查、限定明确文件,并禁止并发写入。

SKILL.md:34来自说明文档打开原文件
- **Setup mode** — configuring `.golangci.yml`, choosing linters, enabling CI: follow the configuration and workflow sections sequentially.- **Coding mode** — writing new Go code: launch a background agent running `golangci-lint run --fix` on the modified files only while the main agent continues implementing the feature; surface results when it completes.- **Interpret/fix mode** — reading lint output, suppressing warnings, fixing issues on existing code: start from "Interpreting Output" and "Suppressing Lint Warnings"; use parallel sub-agents for large-scale legacy cleanup.
查看另外 1 个位置
SKILL.md:147来自说明文档打开原文件
When adopting linting on a legacy codebase, use up to 5 parallel sub-agents to fix independent linter categories simultaneously:- Sub-agent 1: Run `golangci-lint run --fix ./...` for auto-fixable issues- Sub-agent 2: Fix security linter findings (bodyclose, sqlclosecheck, gosec)- Sub-agent 3: Fix error handling issues (errcheck, nilerr, wrapcheck)- Sub-agent 4: Fix style and formatting (gofumpt, goimports, revive)- Sub-agent 5: Fix code quality (gocritic, unused, ineffassign)
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。未发现风险
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 用于配置和运行 golangci-lint,并允许读取、编辑和写入 Go 源文件及 `.golangci.yml`;它还声明可运行 Go、golangci-lint 和 Git 命令。

查看原文
SKILL.md:21来自说明文档打开原文件
        bins: [golangci-lint]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agentpaths:  - "**/*.go"  - ".golangci.yml"---

推荐配置会检查测试文件,最多并行运行四项分析,并启用正确性、风格、复杂度、安全、资源、日志和测试等多类检查器。

查看原文
assets/.golangci.yml:2来自说明文档打开原文件
version: "2"run:  concurrency: 4  # Timeout for analysis  timeout: 5m  # Include test files  tests: true
assets/.golangci.yml:47来自说明文档打开原文件
    - goconst # repeated literals that should be constants    # security & resources    - gosec # security scanner: SQL injection, hardcoded credentials, weak crypto, path traversal    - bidichk # dangerous bidirectional Unicode sequences (trojan source CVE-2021-42574)    - bodyclose # unclosed HTTP response bodies (connection leaks)    - noctx # HTTP requests missing context.Context    - containedctx # context.Context stored in struct fields instead of passed as parameter    - fatcontext # context.WithValue/WithCancel in loops (unbounded context chain, memory leak)    - sqlclosecheck # unclosed sql.Rows and sql.Stmt    - rowserrcheck # unchecked sql.Rows.Err() after iteration    # logging

文档总体要求先修复根因,并要求每个 `nolint` 抑制指定检查器且说明理由;安全与资源泄漏检查不应轻易被抑制。

查看原文
SKILL.md:77来自说明文档打开原文件
Use `//nolint` directives sparingly — fix the root cause first.
SKILL.md:91来自说明文档打开原文件
1. **//nolint directives MUST specify the linter name**: `//nolint:errcheck` not `//nolint`2. **//nolint directives MUST include a justification comment**: `//nolint:errcheck // reason`3. **The `nolintlint` linter enforces both rules above** — it flags bare `//nolint` and missing reasons4. **NEVER suppress security linters** (gosec, bodyclose, sqlclosecheck) without a very strong reason
从这里开始 · 工作说明SKILL.md
golang-lint
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。 另有 1 个章节,可在原文件中查看。

文件引用关系图

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

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文
  • assets/.golangci.yml已纳入全文
  • references/linter-reference.md已纳入全文
  • references/nolint-directives.md已纳入全文
  • evals/evals.json已纳入全文

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

  • SKILL.md工作说明
  • assets/.golangci.yml配套文件
  • evals/evals.json配套文件
  • references/linter-reference.md配套文件
  • references/nolint-directives.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:12来自说明文档打开原文件
    emoji: "🧹"    homepage: https://github.com/samber/cc-skills-golang    requires:
运行命令
SKILL.md:21来自说明文档打开原文件
        bins: [golangci-lint]allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agentpaths:
SKILL.md:51来自说明文档打开原文件
```bash# Run all configured linters
读取密钥或账号配置
assets/.golangci.yml:48来自说明文档打开原文件
    # security & resources    - gosec # security scanner: SQL injection, hardcoded credentials, weak crypto, path traversal    - bidichk # dangerous bidirectional Unicode sequences (trojan source CVE-2021-42574)
references/linter-reference.md:90来自说明文档打开原文件
- **gosec** — Security scanner: SQL injection, hardcoded credentials, weak crypto, path traversal, unsafe usage, and 50+ other rules. The primary SAST tool in the config — never suppress without strong justification.- **bidichk** — Detects dangerous bidirectional Unicode sequences (CVE-2021-42574 trojan source attack — code that looks safe but executes differently)
读取了多少行
814
文件校验值(用于核对版本)
378c4779dc8009bd787d94d45c9c5d727838771880744b76cbc5e0f32c42591d