fix(provider): use #nosec G101 for endpoint URL constants - #35
Merged
Conversation
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
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Security workflow(每周一跑 main 的 gosec + govulncheck)的 gosec job 每周都红:3 个
G101 Potential hardcoded credentials,全部是误报——internal/provider/github.go与lark.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 都识别。验证
-fmt text ./...:Issues: 0(原 3)golangci-lint run ./...:0 issues