跳转到正文
报告库
用途分类 / 内容写作

Golang Structs Interfaces Skill 安全审计

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

Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via interfaces, struct field tags, and pointer vs value receivers. Use this skill when designing Go types, defining or implementing interfaces, embedding structs or interfaces, writing type assertions or type switches, adding struct field tags for JSON/Y

第三方安全检查结论

发现安全风险

已检查文件
4
发现的风险
2
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。未发现风险
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 1 项风险
中风险

允许执行任意 git 子命令,超出 Go 类型设计所需范围

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

工具声明允许 `Bash(git:*)`,没有限制为只读命令;但技能所述任务是设计和修改 Go 类型,诊断步骤只需要 Go 工具。

为什么需要注意

如果技能指令被误用,代理可能暂存或提交用户改动、切换分支、改写历史,甚至在已有凭据和网络权限时推送到远端。仅有该权限声明不证明这些操作会发生。

该技能面向 Go 类型与接口设计,但声明允许所有 `git` 子命令,而不是仅限读取状态。若宿主按此权限执行模型生成的命令,技能可运行修改历史、删除分支或向远端推送等命令,影响用户的代码库和远端账户;这些能力并非所述类型设计任务的必要条件。用户可要求作者移除该权限或仅允许明确的只读 git 子命令。

SKILL.md:3来自说明文档打开原文件
name: golang-structs-interfacesdescription: 'Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via interfaces, struct field tags, and pointer vs value receivers. Use this skill when designing Go types, defining or implementing interfaces, embedding structs or interfaces, writing type assertions or type switches, adding struct field tags for JSON/YAML/DB serialization, or choosing between pointer and value receivers. Also use when the user asks about "accept interfaces, return structs", compile-time interface checks, or composing small interfaces into larger ones.'user-invocable: true
查看另外 2 个位置
SKILL.md:17来自说明文档打开原文件
    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestionpaths:
references/struct-fields.md:71来自说明文档打开原文件
**Diagnose:** 1- `go vet ./...` — `copylocks` reports every value copy of a lock-bearing struct 2- `go test -race ./...` — surfaces the data races a silent copy introduces
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。发现 1 项风险
低风险

多处引导代理采用当前审计未包含的外部技能

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

技能把若干设计问题转交给 `samber/cc-skills-golang` 中的其他技能,但提供的完整来源并不包含这些外部技能的内容或权限。

为什么需要注意

如果宿主自动解析这些引用,代理的行为可能受到未经本次审计检查、且可能独立更新的指令影响;其实际风险取决于外部技能内容。

这段证据能说明什么

这些行只是“参见”其他技能以及公司技能可覆盖本技能的说明,没有命令安装、下载或自动执行它们。若宿主会按名称自动加载外部技能,它们可能扩大指令和权限范围;但所给来源未说明这种行为,也未包含外部技能内容,因此无法判断实际风险。用户可要求作者说明交叉引用是否会触发加载,并在使用前审查对应技能。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:279来自说明文档打开原文件
- → See `samber/cc-skills-golang@golang-naming` skill for interface naming conventions (Reader, Closer, Stringer)- → See `samber/cc-skills-golang@golang-design-patterns` skill for functional options, constructors, and builder patterns- → See `samber/cc-skills-golang@golang-dependency-injection` skill for DI patterns using interfaces- → See `samber/cc-skills-golang@golang-code-style` skill for value vs pointer function parameters (distinct from receivers)- → See `samber/cc-skills-golang@golang-gopls` skill for safe rename and the `implementInterface` code action — renaming a method or receiver that participates in interface satisfaction updates every call site and refuses a rename that would silently break the interface, which grep/sed cannot detect
查看另外 1 个位置
SKILL.md:24来自说明文档打开原文件
> **Community default.** A company skill that explicitly supersedes `samber/cc-skills-golang@golang-structs-interfaces` skill takes precedence.
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该技能的公开用途是指导 Go 结构体和接口设计,并允许读取、编辑和写入项目中的 Go 文件。

查看原文
SKILL.md:3来自说明文档打开原文件
name: golang-structs-interfacesdescription: 'Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via interfaces, struct field tags, and pointer vs value receivers. Use this skill when designing Go types, defining or implementing interfaces, embedding structs or interfaces, writing type assertions or type switches, adding struct field tags for JSON/YAML/DB serialization, or choosing between pointer and value receivers. Also use when the user asks about "accept interfaces, return structs", compile-time interface checks, or composing small interfaces into larger ones.'user-invocable: true
SKILL.md:17来自说明文档打开原文件
    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestionpaths:  - "**/*.go"---

主要内容是设计规则和示例;明确要求类型断言使用 comma-ok 形式,以避免类型不匹配造成运行时崩溃。

查看原文
SKILL.md:175来自说明文档打开原文件
## Type Assertions & Type SwitchesType assertions MUST use the comma-ok form (`s, ok := val.(string)`) — the single-value form panics on a type mismatch instead of branching. Use a type switch to dispatch on the dynamic type, and an assertion to a small optional interface (`if f, ok := w.(Flusher); ok`) to exploit richer implementations without widening the declared parameter type.→ See [Type Assertions & Type Switches](references/type-assertions.md) for type switch ordering, nil cases, and the optional-behavior pattern.

技能建议运行 Go 的静态检查和竞态检测;这些命令会编译或测试项目,但所示命令不包含安装、网络上传或删除操作。

查看原文
references/struct-fields.md:71来自说明文档打开原文件
**Diagnose:** 1- `go vet ./...` — `copylocks` reports every value copy of a lock-bearing struct 2- `go test -race ./...` — surfaces the data races a silent copy introduces
从这里开始 · 工作说明SKILL.md
golang-structs-interfaces
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。 另有 5 个章节,可在原文件中查看。

文件引用关系图

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

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文
  • references/struct-fields.md已纳入全文
  • references/type-assertions.md已纳入全文
  • evals/evals.json已纳入全文

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

  • SKILL.md工作说明
  • evals/evals.json配套文件
  • references/struct-fields.md配套文件
  • references/type-assertions.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:12来自说明文档打开原文件
    emoji: "🧩"    homepage: https://github.com/samber/cc-skills-golang    requires:
references/struct-fields.md:46来自说明文档打开原文件
// noCopy may be added to structs which must not be copied after first use.// See https://pkg.go.dev/sync#noCopytype noCopy struct{}
运行命令
SKILL.md:17来自说明文档打开原文件
    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestionpaths:
修改文件
references/type-assertions.md:49来自说明文档打开原文件
func writeData(w io.Writer, data []byte) error {    if _, err := w.Write(data); err != nil {        return err
读取了多少行
598
文件校验值(用于核对版本)
8e1d0def0ee9aa4e186d1ee5a72afc853916d207a001876ff3737ee085ede713