Skip to content

fix(provider): use #nosec G101 for endpoint URL constants - #35

Merged
Ptilopsi4 merged 1 commit into
mainfrom
fix/security-gosec-annotations
Aug 3, 2026
Merged

fix(provider): use #nosec G101 for endpoint URL constants#35
Ptilopsi4 merged 1 commit into
mainfrom
fix/security-gosec-annotations

Conversation

@s3loy

@s3loy s3loy commented Aug 3, 2026

Copy link
Copy Markdown
Member

问题

Security workflow(每周一跑 main 的 gosec + govulncheck)的 gosec job 每周都红:3 个 G101 Potential hardcoded credentials,全部是误报——internal/provider/github.golark.go 里三个公开 OAuth 端点 URL,只因常量名含 Token 命中 G101 命名启发式。

代码原本用 //nolint:gosec 抑制,但 独立 gosec v2.28.0 不识别 golangci-lint 风格的 //nolint,所以每次扫描照报。ci.yml 的 lint 一直绿,是因为 golangci-lint 自己处理 //nolint

修复

把三处 //nolint:gosec 换成 gosec 原生注释 // #nosec G101(说明文字保留)。#nosec 被独立 gosec 与 golangci-lint 的 gosec 都识别。

验证

  • 独立 gosec v2.28.0 -fmt text ./...Issues: 0(原 3)
  • golangci-lint run ./...0 issues

Standalone gosec (security.yml, weekly main scan) does not honor the
golangci-lint //nolint directive, so these three public OAuth endpoint
URLs were reported as G101 hardcoded credentials every run. #nosec is
gosec-native and honored by both standalone gosec and golangci-lint.
@Ptilopsi4
Ptilopsi4 merged commit baec09d into main Aug 3, 2026
8 checks passed
@Ptilopsi4
Ptilopsi4 deleted the fix/security-gosec-annotations branch August 3, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants