fix(core): DSPX-4607 clear sloglint, goconst, nolintlint and SA1019 findings - #3978
Open
dmihalcik-virtru wants to merge 1 commit into
Open
fix(core): DSPX-4607 clear sloglint, goconst, nolintlint and SA1019 findings#3978dmihalcik-virtru wants to merge 1 commit into
dmihalcik-virtru wants to merge 1 commit into
Conversation
|
Warning Review limit reachedNext included review available in 19 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (28)
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. Comment |
Contributor
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
dmihalcik-virtru
force-pushed
the
fix/lint-core-sloglint
branch
from
September 4, 2026 13:13
6a6af49 to
1ba9644
Compare
This was referenced Sep 4, 2026
Open
Contributor
Contributor
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Contributor
…indings Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com> wip
dmihalcik-virtru
force-pushed
the
fix/lint-core-sloglint
branch
from
September 4, 2026 13:36
1ba9644 to
5b4769a
Compare
Contributor
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Contributor
|
Contributor
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.
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
servicecore slice (60 findings) — everything underservice/that isn'tservice/policy(#3977) orservice/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.goemitsuserAgent,requestIP,requestIDandactorID. Those names are a published contract: they're asserted as golden JSON inlogger_test.goand enforced as reserved paths byschema.go, and renaming them would break downstream SIEM consumers. EachLogValuegets one function-level//nolint:sloglintcarrying that rationale.The other 17 are ordinary operational keys, renamed to snake_case:
from group→from_group(entityresolution),FQN→fqn(evaluate),supportsResourceAuth→supports_resource_auth(casbin v1 + v2 authorizers),isDefaultModel/isBuiltinPolicy/isPolicyExtended/isDefaultAdapter(casbin enforcer),kasInfo→kas_info,runMigrations/verifyConnection(db),prettyPrint/maxSizeMB/maxBackups/maxAgeDays(otel),Indexer→indexer.SDKConfig.LogValueinpkg/config/config.goalso moves from loose key-value pairs to typedslog.Group/slog.String/slog.Boolattrs.nolintlint (9 removed) — 2 stale
//nolint:sloglint // emojiinintegration/main_test.goand 7// preserve emoji usageininternal/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 threeslog.Errorcalls in(*Fixtures).provisionare split one attr per line.goconst (17) — constants extracted where the repeated literal has a real name:
entityresolution/multi-strategy/mapper.go—transformationCSVToArray/transformationArray/transformationString/transformationLowercase/transformationUppercase, shared bymapper.goandoutput_mapper.go. Namedtransformation*rather thantransform*to avoid colliding with the existing(*OutputMapper).transformCSVToArraymethod.providers/{claims,ldap,sql}— oneproviderType*const per package, used by both the provider and its mapper.internal/security—pemTypePublicKey = "PUBLIC KEY", used bystandard_crypto.go,basic_manager.goandin_process_provider.go.canonicalheader (1) —
internal/auth/authn.go:r.Header.Values("Dpop")→r.Header.Values("DPoP"). Cosmetic only:Header.Valuescanonicalizes throughtextproto.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-loggingflow (2 high) to this PR:dpis a raw request header and bothWarnContextcalls in the failure path logged it withslog.Any("dpop", dp). The same code is onmaintoday — CodeQL only reports it here because the taint source line is in the diff — but rather than suppress it, the two call sites now logslog.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:staticcheckwith a per-site reason:authorization/authorization.go— the v1 authorization API still returns the deprecatedAction.Valueoneof for clients that have not moved toAction.Name.integration/keymanagement_test.go— exercises the deprecatedManagerfield andNameidentifier, which must keep validating until they're removed.internal/server/memhttp/memhttp.go,internal/server/server.go—h2c.NewHandleris deprecated in favour ofhttp.Server.Protocols; that migration is a Go 1.24+ server rework and is tracked separately.Testing
golangci-lint runover the affected packages — 0 findings, verified under both the tuned config from chore(ci): DSPX-4607 linter cfg: tune goconst; schema updates #3968 andmain's config, so merge order doesn't matter.make fmtcd service && go test ./logger/audit/... -race— pass. This is the guard for the audit change: the golden-JSON and reserved-path assertions confirm the emitted event schema is byte-identical.cd service && go test ./... -race— pass, other than pre-existing environmental failures unrelated to this change (rttestsneeds a platform on:8080;integrationandentityresolution/integrationneed testcontainers, and both pass with the Docker socket configured).service/policy/orservice/kas/are touched, so this stays disjoint from fix(policy): DSPX-4607 clear sloglint and SA1019 lint findings #3977 and fix(kas): DSPX-4607 use snake_case slog key in rewrap test fake #3970.Related
#3965 (linter bump) · #3968 (config tuning) · #3969 · #3970 · #3971 · #3973 · #3974 · #3975 · #3977
DSPX-4607 burndown index
.golangci.yamlgoconst tuning +gomodguard_v2migration (merged)otdfctl), fix(kas): DSPX-4607 use snake_case slog key in rewrap test fake #3970 (service/kas), chore(core): DSPX-4607 drop stale lib/fixtures nolint directives and reuse keycloakBoolTrue #3971 (lib/fixtures), fix(sdk): DSPX-4607 canonicalize DPoP headers and extract zipstream constants #3973 (sdk), fix(examples): DSPX-4607 clear goconst and SA1019 lint findings #3974 (examples), fix(ci): DSPX-4607 clear tests-bdd goconst, gosec, nestif and sloglint findings #3975 (tests-bdd), fix(policy): DSPX-4607 clear sloglint and SA1019 lint findings #3977 (service/policy)