Skip to content

fix(core): DSPX-4607 clear sloglint, goconst, nolintlint and SA1019 findings - #3978

Open
dmihalcik-virtru wants to merge 1 commit into
mainfrom
fix/lint-core-sloglint
Open

fix(core): DSPX-4607 clear sloglint, goconst, nolintlint and SA1019 findings#3978
dmihalcik-virtru wants to merge 1 commit into
mainfrom
fix/lint-core-sloglint

Conversation

@dmihalcik-virtru

@dmihalcik-virtru dmihalcik-virtru commented Sep 4, 2026

Copy link
Copy Markdown
Member

Part of the DSPX-4607 burndown of the 351 pre-existing findings that golangci-lint v2.13.2 (#3965) surfaced and v2.8.0 never reported. They don't fail CI today — the lint step runs with only-new-issues: true — but any future PR touching one of these lines would trip on them.

This PR covers the service core slice (60 findings) — everything under service/ that isn't service/policy (#3977) or service/kas (#3970). It is independent of the other DSPX-4607 PRs: no file overlap, and it does not touch .golangci.yaml.

Changes

sloglint (25)

Audit event keys are suppressed, not renamed (6). service/logger/audit/utils.go emits userAgent, requestIP, requestID and actorID. Those names are a published contract: they're asserted as golden JSON in logger_test.go and enforced as reserved paths by schema.go, and renaming them would break downstream SIEM consumers. Each LogValue gets one function-level //nolint:sloglint carrying that rationale.

The other 17 are ordinary operational keys, renamed to snake_case: from groupfrom_group (entityresolution), FQNfqn (evaluate), supportsResourceAuthsupports_resource_auth (casbin v1 + v2 authorizers), isDefaultModel / isBuiltinPolicy / isPolicyExtended / isDefaultAdapter (casbin enforcer), kasInfokas_info, runMigrations / verifyConnection (db), prettyPrint / maxSizeMB / maxBackups / maxAgeDays (otel), Indexerindexer.

SDKConfig.LogValue in pkg/config/config.go also moves from loose key-value pairs to typed slog.Group/slog.String/slog.Bool attrs.

nolintlint (9 removed) — 2 stale //nolint:sloglint // emoji in integration/main_test.go and 7 // preserve emoji usage in internal/fixtures/fixtures.go. Six of those were reported unused outright. The seventh was genuinely suppressing something — but args-on-separate-lines, not emoji, so the stated reason was wrong. Rather than keep a misleading directive, the three slog.Error calls in (*Fixtures).provision are split one attr per line.

goconst (17) — constants extracted where the repeated literal has a real name:

  • entityresolution/multi-strategy/mapper.gotransformationCSVToArray / transformationArray / transformationString / transformationLowercase / transformationUppercase, shared by mapper.go and output_mapper.go. Named transformation* rather than transform* to avoid colliding with the existing (*OutputMapper).transformCSVToArray method.
  • providers/{claims,ldap,sql} — one providerType* const per package, used by both the provider and its mapper.
  • internal/securitypemTypePublicKey = "PUBLIC KEY", used by standard_crypto.go, basic_manager.go and in_process_provider.go.

canonicalheader (1)internal/auth/authn.go: r.Header.Values("Dpop")r.Header.Values("DPoP"). Cosmetic only: Header.Values canonicalizes through textproto.CanonicalMIMEHeaderKey, so the lookup is unchanged and there is no DPoP interop exposure.

CodeQL follow-on — DPoP proofs are no longer logged verbatim. Touching that line made CodeQL attribute a pre-existing go/clear-text-logging flow (2 high) to this PR: dp is a raw request header and both WarnContext calls in the failure path logged it with slog.Any("dpop", dp). The same code is on main today — CodeQL only reports it here because the taint source line is in the diff — but rather than suppress it, the two call sites now log slog.Int("dpop_proof_count", len(dp)).

That keeps the diagnostic that actually matters (was a proof presented at all?) and drops attacker-controlled header content out of warn-level logs on every unauthenticated request, which was also a log-injection surface. No test asserts on the attribute, and go test ./internal/auth/... passes.

staticcheck SA1019 (9)//nolint:staticcheck with a per-site reason:

  • authorization/authorization.go — the v1 authorization API still returns the deprecated Action.Value oneof for clients that have not moved to Action.Name.
  • integration/keymanagement_test.go — exercises the deprecated Manager field and Name identifier, which must keep validating until they're removed.
  • internal/server/memhttp/memhttp.go, internal/server/server.goh2c.NewHandler is deprecated in favour of http.Server.Protocols; that migration is a Go 1.24+ server rework and is tracked separately.

Testing

Related

#3965 (linter bump) · #3968 (config tuning) · #3969 · #3970 · #3971 · #3973 · #3974 · #3975 · #3977

DSPX-4607 burndown index

@dmihalcik-virtru
dmihalcik-virtru requested a review from a team as a code owner September 4, 2026 12:59
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 02b429b4-bbc1-4c91-ae87-88fb8cae7335

📥 Commits

Reviewing files that changed from the base of the PR and between d5933ed and 5b4769a.

📒 Files selected for processing (28)
  • service/authorization/authorization.go
  • service/entityresolution/keycloak/v2/entity_resolution.go
  • service/entityresolution/multi-strategy/mapper.go
  • service/entityresolution/multi-strategy/output_mapper.go
  • service/entityresolution/multi-strategy/providers/claims/claims_mapper.go
  • service/entityresolution/multi-strategy/providers/claims/claims_provider.go
  • service/entityresolution/multi-strategy/providers/ldap/ldap_mapper.go
  • service/entityresolution/multi-strategy/providers/ldap/ldap_provider.go
  • service/entityresolution/multi-strategy/providers/sql/sql_mapper.go
  • service/entityresolution/multi-strategy/providers/sql/sql_provider.go
  • service/integration/keymanagement_test.go
  • service/integration/main_test.go
  • service/internal/access/v2/evaluate.go
  • service/internal/auth/authn.go
  • service/internal/auth/authz/casbin/v1/authorizer.go
  • service/internal/auth/authz/casbin/v1/enforcer.go
  • service/internal/auth/authz/casbin/v2/authorizer.go
  • service/internal/fixtures/fixtures.go
  • service/internal/security/basic_manager.go
  • service/internal/security/in_process_provider.go
  • service/internal/security/standard_crypto.go
  • service/internal/server/memhttp/memhttp.go
  • service/internal/server/server.go
  • service/logger/audit/utils.go
  • service/pkg/config/config.go
  • service/pkg/db/db.go
  • service/tracing/otel.go
  • service/trust/delegating_key_service_test.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 242.8342ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 132.875155ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 419.545076ms
Throughput 238.35 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 58.763012059s
Average Latency 586.575388ms
Throughput 85.09 requests/second

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 229.474899ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 153.065542ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 454.21105ms
Throughput 220.16 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 57.765819872s
Average Latency 576.439442ms
Throughput 86.56 requests/second

…indings

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>

wip
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 238.78803ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 142.034495ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 432.695431ms
Throughput 231.11 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 58.918418794s
Average Latency 587.847972ms
Throughput 84.86 requests/second

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • otdfctl
  • service
  • tests-bdd

See the workflow run for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant