detached c35e93d

Revert "fix(lint): G117 annotate intentional secret-pattern fields in DTOs and config structs"

This reverts commit cdae3fa499035ee26e32059e34deb5af9ba4123b.
commit
c35e93d2a7b8a35bd7c055b9da4e0c629b1276cc
author
bnema · · 2026-02-25 02:07 UTC
parent
bc5b3f7
signature
unsigned
10 files · +17 -21
M internal/adapters/in/cli/remote/auth.go +1 -1
@@ -45,7 +45,7 @@ func (c *Client) Authenticate(ctx context.Context, username, password string) (*
4545 req.Header.Set("Content-Type", "application/json")
4646 req.Header.Set("Accept", "application/json")
4747
48- resp, err := c.httpClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote endpoint, not server-side SSRF
48+ resp, err := c.httpClient.Do(req)
4949 if err != nil {
5050 return nil, fmt.Errorf("failed to connect: %w", err)
5151 }
@@ -45,7 +45,7 @@ func (c *Client) Authenticate(ctx context.Context, username, password string) (*
45 req.Header.Set("Content-Type", "application/json")45 req.Header.Set("Content-Type", "application/json")
46 req.Header.Set("Accept", "application/json")46 req.Header.Set("Accept", "application/json")
47 47
48- resp, err := c.httpClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote endpoint, not server-side SSRF48+ resp, err := c.httpClient.Do(req)
49 if err != nil {49 if err != nil {
50 return nil, fmt.Errorf("failed to connect: %w", err)50 return nil, fmt.Errorf("failed to connect: %w", err)
51 }51 }
M internal/adapters/in/cli/remote/client.go +2 -2
@@ -150,7 +150,7 @@ func (c *Client) request(ctx context.Context, method, path string, body any) (*h
150150 req.Header.Set("Authorization", "Bearer "+c.token)
151151 }
152152
153- resp, err := c.httpClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote, not server-side SSRF
153+ resp, err := c.httpClient.Do(req)
154154 if err != nil {
155155 return nil, err
156156 }
@@ -914,7 +914,7 @@ func (c *Client) streamLogs(ctx context.Context, path string) (<-chan string, er
914914 streamClient := &http.Client{
915915 Transport: c.httpClient.Transport,
916916 }
917- resp, err := streamClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote, not server-side SSRF
917+ resp, err := streamClient.Do(req)
918918 if err != nil {
919919 return nil, fmt.Errorf("failed to connect: %w", err)
920920 }
@@ -150,7 +150,7 @@ func (c *Client) request(ctx context.Context, method, path string, body any) (*h
150 req.Header.Set("Authorization", "Bearer "+c.token)150 req.Header.Set("Authorization", "Bearer "+c.token)
151 }151 }
152 152
153- resp, err := c.httpClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote, not server-side SSRF153+ resp, err := c.httpClient.Do(req)
154 if err != nil {154 if err != nil {
155 return nil, err155 return nil, err
156 }156 }
@@ -914,7 +914,7 @@ func (c *Client) streamLogs(ctx context.Context, path string) (<-chan string, er
914 streamClient := &http.Client{914 streamClient := &http.Client{
915 Transport: c.httpClient.Transport,915 Transport: c.httpClient.Transport,
916 }916 }
917- resp, err := streamClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote, not server-side SSRF917+ resp, err := streamClient.Do(req)
918 if err != nil {918 if err != nil {
919 return nil, fmt.Errorf("failed to connect: %w", err)919 return nil, fmt.Errorf("failed to connect: %w", err)
920 }920 }
M internal/adapters/in/http/auth/handler.go +2 -2
@@ -20,7 +20,7 @@ import (
2020 // InternalAuth holds credentials for internal loopback registry access.
2121 type InternalAuth struct {
2222 Username string
23- Password string //nolint:gosec // auth handler internal credential struct for loopback registry access
23+ Password string
2424 }
2525
2626 // Handler handles authentication requests at /auth/*.
@@ -42,7 +42,7 @@ func NewHandler(authSvc in.AuthService, internalAuth InternalAuth, log zerowrap.
4242 // PasswordRequest represents the request body for POST /auth/password.
4343 type PasswordRequest struct {
4444 Username string `json:"username"`
45- Password string `json:"password"` //nolint:gosec // auth handler request DTO: password field is intentional for the auth endpoint
45+ Password string `json:"password"`
4646 }
4747
4848 // PasswordResponse represents the response from POST /auth/password.
@@ -20,7 +20,7 @@ import (
20 // InternalAuth holds credentials for internal loopback registry access.20 // InternalAuth holds credentials for internal loopback registry access.
21 type InternalAuth struct {21 type InternalAuth struct {
22 Username string22 Username string
23- Password string //nolint:gosec // auth handler internal credential struct for loopback registry access23+ Password string
24 }24 }
25 25
26 // Handler handles authentication requests at /auth/*.26 // Handler handles authentication requests at /auth/*.
@@ -42,7 +42,7 @@ func NewHandler(authSvc in.AuthService, internalAuth InternalAuth, log zerowrap.
42 // PasswordRequest represents the request body for POST /auth/password.42 // PasswordRequest represents the request body for POST /auth/password.
43 type PasswordRequest struct {43 type PasswordRequest struct {
44 Username string `json:"username"`44 Username string `json:"username"`
45- Password string `json:"password"` //nolint:gosec // auth handler request DTO: password field is intentional for the auth endpoint45+ Password string `json:"password"`
46 }46 }
47 47
48 // PasswordResponse represents the response from POST /auth/password.48 // PasswordResponse represents the response from POST /auth/password.
M internal/adapters/in/http/middleware/auth.go +1 -1
@@ -48,7 +48,7 @@ func redactUsername(username string) string {
4848 // These are generated per Gordon instance and are never exposed in config.
4949 type InternalRegistryAuth struct {
5050 Username string
51- Password string //nolint:gosec // auth middleware credential struct for loopback-only registry access
51+ Password string
5252 }
5353
5454 // RegistryAuthV2 middleware provides enhanced Docker Registry authentication
@@ -48,7 +48,7 @@ func redactUsername(username string) string {
48 // These are generated per Gordon instance and are never exposed in config.48 // These are generated per Gordon instance and are never exposed in config.
49 type InternalRegistryAuth struct {49 type InternalRegistryAuth struct {
50 Username string50 Username string
51- Password string //nolint:gosec // auth middleware credential struct for loopback-only registry access51+ Password string
52 }52 }
53 53
54 // RegistryAuthV2 middleware provides enhanced Docker Registry authentication54 // RegistryAuthV2 middleware provides enhanced Docker Registry authentication
M internal/adapters/in/http/registry/handler.go +1 -2
@@ -279,11 +279,10 @@ func (h *Handler) handleGetManifest(w http.ResponseWriter, r *http.Request) {
279279
280280 w.Header().Set("Content-Type", manifestData.ContentType)
281281 w.Header().Set("Content-Length", strconv.Itoa(len(manifestData.Data)))
282- w.Header().Set("X-Content-Type-Options", "nosniff")
283282 w.WriteHeader(http.StatusOK)
284283
285284 if r.Method == "GET" {
286- _, _ = w.Write(manifestData.Data) //nolint:gosec // G705: OCI manifest bytes with explicit media type header, not HTML content
285+ _, _ = w.Write(manifestData.Data)
287286 }
288287 }
289288
@@ -279,11 +279,10 @@ func (h *Handler) handleGetManifest(w http.ResponseWriter, r *http.Request) {
279 279
280 w.Header().Set("Content-Type", manifestData.ContentType)280 w.Header().Set("Content-Type", manifestData.ContentType)
281 w.Header().Set("Content-Length", strconv.Itoa(len(manifestData.Data)))281 w.Header().Set("Content-Length", strconv.Itoa(len(manifestData.Data)))
282- w.Header().Set("X-Content-Type-Options", "nosniff")
283 w.WriteHeader(http.StatusOK)282 w.WriteHeader(http.StatusOK)
284 283
285 if r.Method == "GET" {284 if r.Method == "GET" {
286- _, _ = w.Write(manifestData.Data) //nolint:gosec // G705: OCI manifest bytes with explicit media type header, not HTML content285+ _, _ = w.Write(manifestData.Data)
287 }286 }
288 }287 }
289 288
M internal/adapters/out/httpprober/prober.go +1 -1
@@ -79,7 +79,7 @@ func (p *Prober) Probe(ctx context.Context, url string) (int, int64, error) {
7979 // Set a reasonable user agent
8080 req.Header.Set("User-Agent", "Gordon-HealthCheck/1.0")
8181
82- resp, err := p.client.Do(req) //nolint:gosec // G704: probe URL sourced from route configuration, not from user HTTP request
82+ resp, err := p.client.Do(req)
8383 if err != nil {
8484 elapsed := time.Since(start).Milliseconds()
8585 return 0, elapsed, fmt.Errorf("request failed: %w", err)
@@ -79,7 +79,7 @@ func (p *Prober) Probe(ctx context.Context, url string) (int, int64, error) {
79 // Set a reasonable user agent79 // Set a reasonable user agent
80 req.Header.Set("User-Agent", "Gordon-HealthCheck/1.0")80 req.Header.Set("User-Agent", "Gordon-HealthCheck/1.0")
81 81
82- resp, err := p.client.Do(req) //nolint:gosec // G704: probe URL sourced from route configuration, not from user HTTP request82+ resp, err := p.client.Do(req)
83 if err != nil {83 if err != nil {
84 elapsed := time.Since(start).Milliseconds()84 elapsed := time.Since(start).Milliseconds()
85 return 0, elapsed, fmt.Errorf("request failed: %w", err)85 return 0, elapsed, fmt.Errorf("request failed: %w", err)
M internal/adapters/out/telemetry/provider.go +1 -1
@@ -23,7 +23,7 @@ import (
2323 type Config struct {
2424 Enabled bool `mapstructure:"enabled"`
2525 Endpoint string `mapstructure:"endpoint"` // OTLP HTTP endpoint, e.g. "http://localhost:4318"
26- AuthToken string `mapstructure:"auth_token"` //nolint:gosec // telemetry provider API token field, required by external OTLP API schema
26+ AuthToken string `mapstructure:"auth_token"` // Basic auth token (base64 encoded user:pass)
2727 Traces bool `mapstructure:"traces"` // Enable trace export
2828 Metrics bool `mapstructure:"metrics"` // Enable metric export
2929 Logs bool `mapstructure:"logs"` // Bridge zerowrap logs to OTLP
@@ -23,7 +23,7 @@ import (
23 type Config struct {23 type Config struct {
24 Enabled bool `mapstructure:"enabled"`24 Enabled bool `mapstructure:"enabled"`
25 Endpoint string `mapstructure:"endpoint"` // OTLP HTTP endpoint, e.g. "http://localhost:4318"25 Endpoint string `mapstructure:"endpoint"` // OTLP HTTP endpoint, e.g. "http://localhost:4318"
26- AuthToken string `mapstructure:"auth_token"` //nolint:gosec // telemetry provider API token field, required by external OTLP API schema26+ AuthToken string `mapstructure:"auth_token"` // Basic auth token (base64 encoded user:pass)
27 Traces bool `mapstructure:"traces"` // Enable trace export27 Traces bool `mapstructure:"traces"` // Enable trace export
28 Metrics bool `mapstructure:"metrics"` // Enable metric export28 Metrics bool `mapstructure:"metrics"` // Enable metric export
29 Logs bool `mapstructure:"logs"` // Bridge zerowrap logs to OTLP29 Logs bool `mapstructure:"logs"` // Bridge zerowrap logs to OTLP
M internal/adapters/out/tokenstore/unsafe.go +1 -1
@@ -61,7 +61,7 @@ func NewUnsafeStore(dataDir string, log zerowrap.Logger) (*UnsafeStore, error) {
6161
6262 // unsafeTokenData holds both JWT and metadata in a single file.
6363 type unsafeTokenData struct {
64- JWT string `json:"jwt"` //nolint:gosec // token store persistence format: jwt field name is intentional
64+ JWT string `json:"jwt"`
6565 Metadata tokenMetadata `json:"metadata"`
6666 }
6767
@@ -61,7 +61,7 @@ func NewUnsafeStore(dataDir string, log zerowrap.Logger) (*UnsafeStore, error) {
61 61
62 // unsafeTokenData holds both JWT and metadata in a single file.62 // unsafeTokenData holds both JWT and metadata in a single file.
63 type unsafeTokenData struct {63 type unsafeTokenData struct {
64- JWT string `json:"jwt"` //nolint:gosec // token store persistence format: jwt field name is intentional64+ JWT string `json:"jwt"`
65 Metadata tokenMetadata `json:"metadata"`65 Metadata tokenMetadata `json:"metadata"`
66 }66 }
67 67
M internal/app/run.go +5 -8
@@ -126,7 +126,7 @@ type Config struct {
126126 Type string `mapstructure:"type"` // "password" or "token"
127127 SecretsBackend string `mapstructure:"secrets_backend"` // "pass", "sops", or "unsafe"
128128 Username string `mapstructure:"username"`
129- Password string `mapstructure:"password"` //nolint:gosec // config struct field mapped from TOML config file (deprecated, use password_hash)
129+ Password string `mapstructure:"password"` // deprecated: use password_hash
130130 PasswordHash string `mapstructure:"password_hash"` // path in secrets backend
131131 TokenSecret string `mapstructure:"token_secret"` // path in secrets backend
132132 TokenExpiry string `mapstructure:"token_expiry"` // e.g., "720h", "30d"
@@ -747,7 +747,7 @@ func randomTokenHex(size int) (string, error) {
747747 // InternalCredentials holds the internal registry credentials for CLI access.
748748 type InternalCredentials struct {
749749 Username string `json:"username"`
750- Password string `json:"password"` //nolint:gosec // internal credential wire format: json key is intentional for CLI interop
750+ Password string `json:"password"`
751751 }
752752
753753 // getSecureRuntimeDir returns a secure directory for runtime files.
@@ -755,12 +755,9 @@ type InternalCredentials struct {
755755 func getSecureRuntimeDir() (string, error) {
756756 // Try XDG_RUNTIME_DIR first (typically /run/user/<uid> on Linux)
757757 if runtimeDir := os.Getenv("XDG_RUNTIME_DIR"); runtimeDir != "" {
758- runtimeDir = filepath.Clean(runtimeDir)
759- if filepath.IsAbs(runtimeDir) {
760- gordonDir := filepath.Join(runtimeDir, "gordon")
761- if err := os.MkdirAll(gordonDir, 0700); err == nil { //nolint:gosec // G703: path cleaned and verified absolute before use
762- return gordonDir, nil
763- }
758+ gordonDir := filepath.Join(runtimeDir, "gordon")
759+ if err := os.MkdirAll(gordonDir, 0700); err == nil {
760+ return gordonDir, nil
764761 }
765762 }
766763
@@ -126,7 +126,7 @@ type Config struct {
126 Type string `mapstructure:"type"` // "password" or "token"126 Type string `mapstructure:"type"` // "password" or "token"
127 SecretsBackend string `mapstructure:"secrets_backend"` // "pass", "sops", or "unsafe"127 SecretsBackend string `mapstructure:"secrets_backend"` // "pass", "sops", or "unsafe"
128 Username string `mapstructure:"username"`128 Username string `mapstructure:"username"`
129- Password string `mapstructure:"password"` //nolint:gosec // config struct field mapped from TOML config file (deprecated, use password_hash)129+ Password string `mapstructure:"password"` // deprecated: use password_hash
130 PasswordHash string `mapstructure:"password_hash"` // path in secrets backend130 PasswordHash string `mapstructure:"password_hash"` // path in secrets backend
131 TokenSecret string `mapstructure:"token_secret"` // path in secrets backend131 TokenSecret string `mapstructure:"token_secret"` // path in secrets backend
132 TokenExpiry string `mapstructure:"token_expiry"` // e.g., "720h", "30d"132 TokenExpiry string `mapstructure:"token_expiry"` // e.g., "720h", "30d"
@@ -747,7 +747,7 @@ func randomTokenHex(size int) (string, error) {
747 // InternalCredentials holds the internal registry credentials for CLI access.747 // InternalCredentials holds the internal registry credentials for CLI access.
748 type InternalCredentials struct {748 type InternalCredentials struct {
749 Username string `json:"username"`749 Username string `json:"username"`
750- Password string `json:"password"` //nolint:gosec // internal credential wire format: json key is intentional for CLI interop750+ Password string `json:"password"`
751 }751 }
752 752
753 // getSecureRuntimeDir returns a secure directory for runtime files.753 // getSecureRuntimeDir returns a secure directory for runtime files.
@@ -755,12 +755,9 @@ type InternalCredentials struct {
755 func getSecureRuntimeDir() (string, error) {755 func getSecureRuntimeDir() (string, error) {
756 // Try XDG_RUNTIME_DIR first (typically /run/user/<uid> on Linux)756 // Try XDG_RUNTIME_DIR first (typically /run/user/<uid> on Linux)
757 if runtimeDir := os.Getenv("XDG_RUNTIME_DIR"); runtimeDir != "" {757 if runtimeDir := os.Getenv("XDG_RUNTIME_DIR"); runtimeDir != "" {
758- runtimeDir = filepath.Clean(runtimeDir)758+ gordonDir := filepath.Join(runtimeDir, "gordon")
759- if filepath.IsAbs(runtimeDir) {759+ if err := os.MkdirAll(gordonDir, 0700); err == nil {
760- gordonDir := filepath.Join(runtimeDir, "gordon")760+ return gordonDir, nil
761- if err := os.MkdirAll(gordonDir, 0700); err == nil { //nolint:gosec // G703: path cleaned and verified absolute before use
762- return gordonDir, nil
763- }
764 }761 }
765 }762 }
766 763
M internal/usecase/proxy/service.go +2 -2
@@ -551,7 +551,7 @@ func (s *Service) proxyToTarget(w http.ResponseWriter, r *http.Request, target *
551551 Str(zerowrap.FieldEntityID, target.ContainerID).
552552 Msg("proxying request")
553553
554- proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request
554+ proxy.ServeHTTP(w, r)
555555 }
556556
557557 func (s *Service) trackInFlight(containerID string) func() {
@@ -630,7 +630,7 @@ func (s *Service) proxyToRegistry(w http.ResponseWriter, r *http.Request) {
630630
631631 log.Debug().Str("target", targetURL.String()).Msg("proxying request to registry")
632632
633- proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request
633+ proxy.ServeHTTP(w, r)
634634 }
635635
636636 func (s *Service) isRunningInContainer() bool {
@@ -551,7 +551,7 @@ func (s *Service) proxyToTarget(w http.ResponseWriter, r *http.Request, target *
551 Str(zerowrap.FieldEntityID, target.ContainerID).551 Str(zerowrap.FieldEntityID, target.ContainerID).
552 Msg("proxying request")552 Msg("proxying request")
553 553
554- proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request554+ proxy.ServeHTTP(w, r)
555 }555 }
556 556
557 func (s *Service) trackInFlight(containerID string) func() {557 func (s *Service) trackInFlight(containerID string) func() {
@@ -630,7 +630,7 @@ func (s *Service) proxyToRegistry(w http.ResponseWriter, r *http.Request) {
630 630
631 log.Debug().Str("target", targetURL.String()).Msg("proxying request to registry")631 log.Debug().Str("target", targetURL.String()).Msg("proxying request to registry")
632 632
633- proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request633+ proxy.ServeHTTP(w, r)
634 }634 }
635 635
636 func (s *Service) isRunningInContainer() bool {636 func (s *Service) isRunningInContainer() bool {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close