Skip to content

CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth - #156

Open
c1-squire-dev[bot] wants to merge 6 commits into
mainfrom
connector-farm/CXH-3209-cf-2610266c3s-CXH-3209-cf-2610266c3s.12.5-impl
Open

c1-squire-dev[bot] wants to merge 6 commits into
mainfrom
connector-farm/CXH-3209-cf-2610266c3s-CXH-3209-cf-2610266c3s.12.5-impl

Conversation

@c1-squire-dev

@c1-squire-dev c1-squire-dev Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

baton-sql can now authenticate to SQL Server with Kerberos: a DSN carrying authenticator=krb5 with keytab parameters reaches the driver's Kerberos provider instead of dying with provider krb5 not found. go-mssqldb ships its Kerberos support as an optional package that only registers itself when something imports it, and nothing in this repo imported it — so the provider name existed in the ticket and in the driver's docs, but never in the driver's registry.

What was asked

CXH-3209 (GitHub issue ConductorOne/baton-sql#155): configure a SQL Server DSN like
sqlserver://host:port?database=db&authenticator=krb5&krb5-realm=REALM&krb5-keytabfile=/etc/krb5/svc.keytab&krb5-configfile=/etc/krb5/krb5.conf
and run baton-sql against it. Expected: Kerberos keytab authentication works "the same way other supported authenticators work". Actual: connection fails with provider krb5 not found. Customer impact: blocks self-hosted/Kubernetes SQL Server deployments that require keytab auth.

What changed

go-mssqldb v1.8.0 already contains everything needed: the optional integratedauth/krb5 package registers a krb5 provider from its init() and reads the krb5-* DSN parameters itself. The connector's own plumbing already forwards every connect.params entry into the DSN verbatim. The only gap was the import. This PR closes that gap and adds the tests and docs that pin it.

1. pkg/database/sqlserver/sqlserver.go

Where: import block, line 8

What changed: one blank import — _ "github.com/microsoft/go-mssqldb/integratedauth/krb5" // registers the "krb5" integrated-auth provider.

Why: this is the driver's own registration seam (upstream uses the same pattern to register ntlm on unix in auth_unix.go). Importing the package runs its init(), which puts krb5 into the driver's provider registry. Nothing else in the file moves; Connect still opens the DSN untouched.

2. pkg/database/sqlserver/krb5_test.go (new)

Where: whole file, ~50 lines; Test_Krb5ProviderRegistered, Test_DefaultProviderNameUnchanged

What changed: two tests. The first calls the driver's exported integratedauth.GetIntegratedAuthenticator with authenticator=krb5 and nonexistent keytab/config paths and requires an error that does NOT contain "not found" — the registry miss provider %v not found is the exact failure the ticket reports, so any other error proves the lookup landed in the krb5 provider. The test deliberately does not blank-import the krb5 package itself, so it fails loudly if someone ever drops the production import in sqlserver.go (counterfactually verified during review: with the import removed the test fails with provider krb5 not found). The second asserts integratedauth.DefaultProviderName stays ntlm on unix, pinning that the new registration changes nothing about DSNs that don't ask for authenticator=krb5.

Why: the bug was invisible precisely because nothing exercised provider registration; these two tests convert the failure class into a red unit test.

3. pkg/database/database_test.go

Where: Test_buildConnectionURL table, new row "sqlserver with krb5 integrated-auth params round-trips verbatim" (~L775)

What changed: one case proving the four krb5 parameters survive buildConnectionURL into the built DSN query byte-for-byte (URL-encoded paths, sorted keys).

Why: pins that the connector passes authenticator=krb5&krb5-* through to the driver without allowlisting or mutation — the behavior the feature depends on.

4. docs/docs-info.md

Where: supported-DSN-forms list, line 53

What changed: one line documenting the Kerberos/keytab DSN form: a username with no password (upstream's validateKrb5LoginParams rejects a username-less keytab login with "user id is required to login with krb5 when using krb5-keytabfile" — worth knowing because the ticket's example DSN omits the username), the three required krb5-* parameters, and the note that a password alongside the keytab makes the keytab ignored.

Why: the repro DSN in the ticket would fail even after registration because it carries no username; the doc line teaches the form that actually connects.

5. go.mod, go.sum, vendor/

What changed: go mod tidy -v && go mod vendor (the repo's own make add-dep recipe) pulls github.com/jcmturner/gokrb5/v8 plus its transitive modules (six jcmturner/* modules and hashicorp/go-uuid, all required by the gokrb5 graph) into go.mod/go.sum and vendors the tree. No pinned version moved: baton-sdk v0.42.4, go-mssqldb v1.8.0, .versions.yaml, and the Go pin are untouched. vendor/ is excluded from review per BUGBOT.md.

How far this is verified

  • Targeted validation passed: go test ./pkg/database/... ./pkg/database/sqlserver/... (includes the registry, default-provider, negative-control and pass-through tests), and validate-changes.sh (targeted build/vet/test of the changed packages) is green. The connector rulebook checks (check-kind-rules.sh) are clean: zero violations, zero hints.
  • CI + judge: green and accepted at head e34fed7a. All repository workflows pass (test with live postgres sync, verify test/lint/docs, pr-review, connector-docs, check-versions). The repository's review bot reviewed this PR and accepted it after one fix pass: its first review suggested Test_DefaultProviderNameUnchanged needed a Windows build constraint (the default provider is winsspi there); the test moved to a //go:build !windows file, the thread was answered and resolved, and the bot's ruling at the current head is clean.
  • Independent deep review: CLEAR after 2 rounds; 4 findings, all answered and resolved. A reviewer with no connection to the batch (fresh env, fresh clone) verified the mechanism against the vendored driver, re-proved the fail-loud registration guard by counterfactual twice, validated all three claims of the docs line against the vendored readKrb5Config/validateKrb5LoginParams, and raised four findings (a self-checking negative control for the registry-miss wording; a comment deduplication; gofmt whitespace in the two new test files; the comment nit only half-fixed on the first pass). All four are fixed on the current head with the fixes quoted as evidence in the resolved threads. An audit confirms every bot/deep-review comment on the PR is replied and resolved.
  • Tester (VERA, fresh clone of the PR branch): 6 of 7 claims WORKS, 1 UNTESTABLE, overall INCONCLUSIVE by the claims floor. WORKS (with captured transcripts in the batch arena): the krb5 provider registers (a counterfactual harness shows the provider error with the import and provider krb5 not found without it), the PR's tests pass, the binary builds and starts, the DSN param round-trip row passes, the default provider stays ntlm. UNTESTABLE: actual Kerberos keytab authentication against a real SQL Server/KDC — no SQL Server, KDC or keytab exists in this environment (attempted and blocked; recorded). The tester ran in a clean checkout but on the batch's shared VM, not a clean room.
  • Smoke: the built cmd/baton-sql binary starts (--help runs). This repo declares no mock, so no sync was exercised — the change is unproven against a live or mocked upstream.
  • connector-eval (advisory): not-applicable, "no recording (eval-prepare: not-applicable: mock incomplete (1 misses)); static analysis only" — its recording proxy captures HTTP traffic only, and this connector speaks database wire protocols, so no sync comparison was possible with this tooling (no lost/gained objects to report).

Risk — what to look at hardest

  • The dependency surface. Enabling the krb5 provider vendors the gokrb5/v8 tree (~130 files) into every build, for all baton-sql users, including those who never use Kerberos. gokrb5/v8 is upstream's own choice for this feature (go-mssqldb's integratedauth/krb5 wraps it), but it is a maintenance-mode library; a future CVE fix lands as a multi-module vendor bump. The binary grows accordingly.
  • The docs line is the only user-facing prose, and the username requirement in it is load-bearing (a username-less keytab DSN fails upstream validation). If you disagree with its phrasing, that one line is the thing to edit.
  • The registry test reaches into vendored packages by design; a future go-mssqldb upgrade that moves integratedauth will fail that test loudly rather than silently.

Linear requirements

CXH-3209

This PR meets the ticket's acceptance criterion at the level CI and unit tests can reach; the live-authentication half of it needs a real KDC and is marked accordingly.

Requirement Status Evidence
The krb5 authenticator is registered with the driver ✅ Met pkg/database/sqlserver/sqlserver.go L8 blank import; vendored integratedauth/krb5/krb5.go init() → SetIntegratedAuthenticationProvider("krb5", …); pinned by Test_Krb5ProviderRegistered
A DSN with authenticator=krb5 + keytab params reaches the provider instead of failing provider krb5 not found ✅ Met (provider path) / 🔍 live handshake not verifiable from this PR Param pass-through pinned by the Test_buildConnectionURL krb5 row; provider routing pinned by the registry test. Actual Kerberos authentication needs a real KDC/SQL Server and keytab — no CI environment here has one
Kerberos works "the same way other supported authenticators work" ✅ Met Same blank-import registration mechanism the driver itself uses for ntlm on unix; existing authenticators' behavior pinned unchanged by Test_DefaultProviderNameUnchanged (default stays ntlm)
No regression for existing configurations ✅ Met pkg/bsql/config.go, pkg/database/database.go (non-test), .versions.yaml, config_schema.json, baton_capabilities.json: zero diff; additive registry entry only

Release Notes

baton-sql now supports Kerberos keytab authentication for SQL Server. A DSN with authenticator=krb5, krb5-realm, krb5-keytabfile and krb5-configfile — and the Kerberos principal as the DSN username with no password — authenticates via the driver's Kerberos provider instead of failing with provider krb5 not found. Self-hosted and Kubernetes SQL Server deployments that require keytab auth can connect without a custom build.

Impl1 and others added 3 commits October 26, 2026 16:47
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@linear-code

linear-code Bot commented Oct 26, 2026

Copy link
Copy Markdown

CXH-3209

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit f3ad3ae1eda9

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: full
View review run

Review Summary

This PR adds one blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go:8. The import's init() registers the krb5 integrated-auth provider. With it, a DSN that has authenticator=krb5 reaches the Kerberos provider instead of failing with provider krb5 not found.

The other changes:

  • Tests: a registry test and a default-provider test in krb5_test.go, plus a buildConnectionURL test case showing the krb5-* params pass through unchanged.
  • Docs: one line in docs/docs-info.md.
  • Dependencies: the gokrb5/v8 module graph is added to go.mod/go.sum/vendor/.

Coverage and checks:

  • I scanned the full PR diff for security and correctness issues.
  • Docs: I checked the docs line against the vendored krb5.go readKrb5Config/validateKrb5LoginParams, and it is accurate. A keytab login needs a username. If a password is also present, the username+password path is used and the keytab is ignored. The realm falls back to the user@REALM split.
  • Username-only DSN: buildConnectionURL already builds a DSN with a username and no password via url.User, so the documented form works.
  • Dependencies: go.mod adds only indirect modules required by the newly imported package: gokrb5 v8.4.4 (the current release, past the older gokrb5 CVEs), aescts, dnsutils, gofork, goidentity, rpc, and hashicorp/go-uuid. No existing version changed.

Repo-local criteria: I applied them. No resource builders, sync paths, provisioning, logging, spans, or API response structs changed, so sections A–G and S do not apply. Breaking-change rules B1–B9 do not apply: the change only adds a provider, and existing DSNs behave the same.

Coverage gaps: I did not review the vendored third-party sources line by line. I confirmed they match the modules.txt/go.mod additions. As the PR itself says, a live Kerberos handshake is not tested anywhere.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • New (confidence: medium) pkg/database/sqlserver/krb5_test.go:46-50: Test_DefaultProviderNameUnchanged expects ntlm but has no build constraint. go-mssqldb sets DefaultProviderName to winsspi on Windows, so the test fails on any Windows test run.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/database/sqlserver/krb5_test.go`:
- Around line 46-50: Test_DefaultProviderNameUnchanged asserts integratedauth.DefaultProviderName == "ntlm", which only holds on unix; go-mssqldb sets it to "winsspi" on Windows. Move this test into a file with a `//go:build !windows` constraint (e.g. krb5_unix_test.go) so it does not fail on Windows test runs.

Comment thread pkg/database/sqlserver/krb5_test.go Outdated
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 4c156cadf00b

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: full
View review run

Review Summary

This PR adds one blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go:8. The import's init() registers the krb5 integrated-auth provider. With it, a DSN that has authenticator=krb5 reaches the Kerberos provider instead of failing with provider krb5 not found.

The other changes:

  • Tests: a registry test and a default-provider test in krb5_test.go, plus a buildConnectionURL test case showing the krb5-* params pass through unchanged.
  • Docs: one line in docs/docs-info.md.
  • Dependencies: the gokrb5/v8 module graph is added to go.mod/go.sum/vendor/.

Coverage and checks:

  • I scanned the full PR diff for security and correctness issues.
  • Docs: I checked the docs line against the vendored krb5.go readKrb5Config/validateKrb5LoginParams, and it is accurate. A keytab login needs a username. If a password is also present, the username+password path is used and the keytab is ignored. The realm falls back to the user@REALM split.
  • Username-only DSN: buildConnectionURL already builds a DSN with a username and no password via url.User, so the documented form works.
  • Dependencies: go.mod adds only indirect modules required by the newly imported package: gokrb5 v8.4.4 (the current release, past the older gokrb5 CVEs), aescts, dnsutils, gofork, goidentity, rpc, and hashicorp/go-uuid. No existing version changed.

Repo-local criteria: I applied them. No resource builders, sync paths, provisioning, logging, spans, or API response structs changed, so sections A–G and S do not apply. Breaking-change rules B1–B9 do not apply: the change only adds a provider, and existing DSNs behave the same.

Coverage gaps: I did not review the vendored third-party sources line by line. I confirmed they match the modules.txt/go.mod additions. As the PR itself says, a live Kerberos handshake is not tested anywhere.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • New (confidence: medium) pkg/database/sqlserver/krb5_test.go:46-50: Test_DefaultProviderNameUnchanged expects ntlm but has no build constraint. go-mssqldb sets DefaultProviderName to winsspi on Windows, so the test fails on any Windows test run.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/database/sqlserver/krb5_test.go`:
- Around line 46-50: Test_DefaultProviderNameUnchanged asserts integratedauth.DefaultProviderName == "ntlm", which only holds on unix; go-mssqldb sets it to "winsspi" on Windows. Move this test into a file with a `//go:build !windows` constraint (e.g. krb5_unix_test.go) so it does not fail on Windows test runs.

Reviewed commit: f3ad3ae1eda9

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found — see the full review report

…nix_test.go

DefaultProviderName is set by go-mssqldb's platform-specific init (ntlm on
unix, winsspi on Windows), so the unix-default assertion needs //go:build
!windows. Keeps Test_Krb5ProviderRegistered compiling on every GOOS.
Addresses judge review comment 4380239426 on PR #156.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 4c156cadf00b

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: incremental since f3ad3ae
View review run

Review Summary

This PR adds a blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go:8. That import registers the driver's krb5 integrated-auth provider. The PR also vendors the gokrb5/v8 module graph (vendor/modules.txt lists integratedauth/krb5 and the jcmturner/* modules) and adds tests and a docs line.

The new commit moves Test_DefaultProviderNameUnchanged out of krb5_test.go into a new krb5_unix_test.go behind a //go:build !windows constraint. krb5_test.go still uses the integratedauth and msdsn imports, so it still compiles. The rest of the change is the same as last time.

I re-scanned the full PR diff for security and correctness and found no issues; the incremental diff was complete, with no dropped paths. I applied the repo-local criteria, but none of the sync-path, logging, provisioning or JSON sections apply: no resource builders, logging, spans, or API structs changed. The dependency changes in go.mod match the new import.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • New (confidence: high, cosmetic) The test files aren't gofmt-formatted. pkg/database/sqlserver/krb5_test.go:42-44 ends with extra blank lines left behind when the test was moved out, and krb5_unix_test.go:18 has no newline at end of file. golangci-lint has no formatters enabled, so CI won't catch this. Running gofmt -w on both files fixes it.

Resolved prior findings

  • Fixed: Test_DefaultProviderNameUnchanged used to fail on Windows, where DefaultProviderName is winsspi. It now lives in pkg/database/sqlserver/krb5_unix_test.go:1 behind //go:build !windows.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/database/sqlserver/krb5_test.go`:
- Around line 42-44: Delete the extra blank lines at the end of the file, left behind when Test_DefaultProviderNameUnchanged was moved out, so the file ends right after the closing brace of Test_Krb5ProviderRegistered. Running `gofmt -w` does this.

In `pkg/database/sqlserver/krb5_unix_test.go`:
- Around line 18: Add a newline at the end of the file. Running `gofmt -w` does this.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit d8c37cf88432

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: incremental since f3ad3ae
View review run

Review Summary

This PR adds a blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go:8. That import registers the driver's krb5 integrated-auth provider. The PR also vendors the gokrb5/v8 module graph (vendor/modules.txt lists integratedauth/krb5 and the jcmturner/* modules) and adds tests and a docs line.

The new commit moves Test_DefaultProviderNameUnchanged out of krb5_test.go into a new krb5_unix_test.go behind a //go:build !windows constraint. krb5_test.go still uses the integratedauth and msdsn imports, so it still compiles. The rest of the change is the same as last time.

I re-scanned the full PR diff for security and correctness and found no issues; the incremental diff was complete, with no dropped paths. I applied the repo-local criteria, but none of the sync-path, logging, provisioning or JSON sections apply: no resource builders, logging, spans, or API structs changed. The dependency changes in go.mod match the new import.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • New (confidence: high, cosmetic) The test files aren't gofmt-formatted. pkg/database/sqlserver/krb5_test.go:42-44 ends with extra blank lines left behind when the test was moved out, and krb5_unix_test.go:18 has no newline at end of file. golangci-lint has no formatters enabled, so CI won't catch this. Running gofmt -w on both files fixes it.

Resolved prior findings

  • Fixed: Test_DefaultProviderNameUnchanged used to fail on Windows, where DefaultProviderName is winsspi. It now lives in pkg/database/sqlserver/krb5_unix_test.go:1 behind //go:build !windows.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/database/sqlserver/krb5_test.go`:
- Around line 42-44: Delete the extra blank lines at the end of the file, left behind when Test_DefaultProviderNameUnchanged was moved out, so the file ends right after the closing brace of Test_Krb5ProviderRegistered. Running `gofmt -w` does this.

In `pkg/database/sqlserver/krb5_unix_test.go`:
- Around line 18: Add a newline at the end of the file. Running `gofmt -w` does this.

Reviewed commit: 4c156cadf00b

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found — see the full review report

Comment thread pkg/database/sqlserver/krb5_test.go
Comment thread pkg/database/sqlserver/krb5_test.go Outdated
… clarify comments

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit d8c37cf88432

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: incremental since 4c156ca
View review run

Review Summary

The PR adds a blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go. That import registers the driver's krb5 integrated-auth provider. The PR also vendors gokrb5/v8 v8.4.4 and its jcmturner/* and hashicorp/go-uuid dependencies, which every module in the go.mod diff needs because of that import. It adds a DSN round-trip test, a registry test, and one docs line. The new commit only rewords the comments in Test_Krb5ProviderRegistered and adds Test_ProviderMissMessageControl, a negative control that fails if the driver's registry-miss message stops containing "not found". The control is sound, and none of the vendored krb5 error strings contain "not found" either (vendor/.../integratedauth/krb5/krb5.go:33-42).

I scanned the full PR diff for security and correctness, including go.mod. The vendor/ contents only got a reachability check, not a line-by-line read. I applied the repo-local criteria. Sections S (sync data loss), A (log levels), B (error wrapping), C (spans) and J (JSON types) don't apply, because the PR doesn't touch any sync, logging, client or provisioning code. The breaking-change gate (E) isn't triggered either: the change only adds a provider, and DSNs without authenticator=krb5 behave as before.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • Prior — still present (confidence: high, cosmetic): the test files are still not gofmt-formatted. pkg/database/sqlserver/krb5_test.go:62-63 has extra blank lines after the last closing brace, and pkg/database/sqlserver/krb5_unix_test.go:18 has no newline at end of file. An open thread already covers this.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/database/sqlserver/krb5_test.go`:
- Around line 62-63: Delete the extra blank lines after the closing brace of Test_ProviderMissMessageControl so the file ends with a single newline. Running `gofmt -w` does this.

In `pkg/database/sqlserver/krb5_unix_test.go`:
- Around line 18: Add a newline at the end of the file. Running `gofmt -w` does this.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit e34fed7a9a94

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: incremental since 4c156ca
View review run

Review Summary

The PR adds a blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go. That import registers the driver's krb5 integrated-auth provider. The PR also vendors gokrb5/v8 v8.4.4 and its jcmturner/* and hashicorp/go-uuid dependencies, which every module in the go.mod diff needs because of that import. It adds a DSN round-trip test, a registry test, and one docs line. The new commit only rewords the comments in Test_Krb5ProviderRegistered and adds Test_ProviderMissMessageControl, a negative control that fails if the driver's registry-miss message stops containing "not found". The control is sound, and none of the vendored krb5 error strings contain "not found" either (vendor/.../integratedauth/krb5/krb5.go:33-42).

I scanned the full PR diff for security and correctness, including go.mod. The vendor/ contents only got a reachability check, not a line-by-line read. I applied the repo-local criteria. Sections S (sync data loss), A (log levels), B (error wrapping), C (spans) and J (JSON types) don't apply, because the PR doesn't touch any sync, logging, client or provisioning code. The breaking-change gate (E) isn't triggered either: the change only adds a provider, and DSNs without authenticator=krb5 behave as before.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • Prior — still present (confidence: high, cosmetic): the test files are still not gofmt-formatted. pkg/database/sqlserver/krb5_test.go:62-63 has extra blank lines after the last closing brace, and pkg/database/sqlserver/krb5_unix_test.go:18 has no newline at end of file. An open thread already covers this.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/database/sqlserver/krb5_test.go`:
- Around line 62-63: Delete the extra blank lines after the closing brace of Test_ProviderMissMessageControl so the file ends with a single newline. Running `gofmt -w` does this.

In `pkg/database/sqlserver/krb5_unix_test.go`:
- Around line 18: Add a newline at the end of the file. Running `gofmt -w` does this.

Reviewed commit: d8c37cf88432

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found — see the full review report

Comment thread pkg/database/sqlserver/krb5_test.go Outdated
Comment thread pkg/database/sqlserver/krb5_test.go Outdated
- gofmt -w both test files (trailing blank lines at EOF in krb5_test.go;
  missing final newline in krb5_unix_test.go) — G1
- shrink the inline comment in Test_Krb5ProviderRegistered to one line that
  adds only what the doc comment does not (deterministic error via
  nonexistent config paths); the doc comment remains the full explanation — G2

Co-authored-by: Resolver3 <resolver3@connector-farm.local>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit e34fed7a9a94

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: incremental since d8c37cf
View review run

Review Summary

The PR adds one blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go. That import's init() registers the krb5 provider, so a DSN with authenticator=krb5&krb5-* now reaches the Kerberos provider and no longer fails with provider krb5 not found. The PR also adds registry and DSN pass-through tests and one line of docs. The new commit (e34fed7) only runs gofmt on the two test files and shortens a comment. It does not change any behavior.

I scanned the full PR diff for security and correctness issues. I also checked the go.mod and go.sum changes, which add only the gokrb5/v8 dependency tree (jcmturner/* and hashicorp/go-uuid) and its go.sum entries. I confirmed vendor/modules.txt lists those modules. No pinned direct dependency changed. I confirmed in the vendored krb5.go that the registry test is sound: with /nonexistent paths the provider returns an os.Open error, which does not contain "not found", while a registry miss does.

The connector criteria were applied: client and pagination (C/R), sync data loss (S), logging (L), spans (T), JSON safety (J), provisioning (P) and breaking changes (B/BP). None apply here, because the change touches no sync, provisioning, resource or logging code. The registration only adds an opt-in driver provider, and DSNs without authenticator=krb5 are unaffected.

Coverage gap: I did not review the vendored gokrb5 source line by line (vendored code is excluded). I only checked that it matches go.mod. As the PR itself says, the actual Kerberos handshake with a real KDC is not tested anywhere.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Resolved prior findings

  • Fixed: the earlier gofmt finding (extra blank lines after the last closing brace in pkg/database/sqlserver/krb5_test.go, and no final newline in pkg/database/sqlserver/krb5_unix_test.go). Commit e34fed7 fixes it: both files now end with a single }\n.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Connector PR Review: CXH-3209: register go-mssqldb's krb5 authenticator for keytab auth

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5f86dd03c43c.
Review mode: incremental since d8c37cf
View review run

Review Summary

The PR adds one blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5 in pkg/database/sqlserver/sqlserver.go. That import's init() registers the krb5 provider, so a DSN with authenticator=krb5&krb5-* now reaches the Kerberos provider and no longer fails with provider krb5 not found. The PR also adds registry and DSN pass-through tests and one line of docs. The new commit (e34fed7) only runs gofmt on the two test files and shortens a comment. It does not change any behavior.

I scanned the full PR diff for security and correctness issues. I also checked the go.mod and go.sum changes, which add only the gokrb5/v8 dependency tree (jcmturner/* and hashicorp/go-uuid) and its go.sum entries. I confirmed vendor/modules.txt lists those modules. No pinned direct dependency changed. I confirmed in the vendored krb5.go that the registry test is sound: with /nonexistent paths the provider returns an os.Open error, which does not contain "not found", while a registry miss does.

The connector criteria were applied: client and pagination (C/R), sync data loss (S), logging (L), spans (T), JSON safety (J), provisioning (P) and breaking changes (B/BP). None apply here, because the change touches no sync, provisioning, resource or logging code. The registration only adds an opt-in driver provider, and DSNs without authenticator=krb5 are unaffected.

Coverage gap: I did not review the vendored gokrb5 source line by line (vendored code is excluded). I only checked that it matches go.mod. As the PR itself says, the actual Kerberos handshake with a real KDC is not tested anywhere.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Resolved prior findings

  • Fixed: the earlier gofmt finding (extra blank lines after the last closing brace in pkg/database/sqlserver/krb5_test.go, and no final newline in pkg/database/sqlserver/krb5_unix_test.go). Commit e34fed7 fixes it: both files now end with a single }\n.

Reviewed commit: e34fed7a9a94

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found — see the full review report

@c1-squire-dev
c1-squire-dev Bot marked this pull request as ready for review October 26, 2026 17:51
@c1-squire-dev
c1-squire-dev Bot requested a review from a team October 26, 2026 17:51

@luisina-santos luisina-santos left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits inline.

  • nit (optional, general): Not needed for this ticket. Importing the package also enables the credential-cache (krb5-credcachefile) and user/password Kerberos methods. Mention them in one line, or leave a follow-up to document them.
  • nit (PR description): The title has the issue ID, good. The body is very long. Trim it to what changed, why, and how it was tested.

Comment on lines +11 to +17
// Test_Krb5ProviderRegistered proves the blank import in sqlserver.go registers
// the "krb5" integrated-auth provider. Normative wording (no specific upstream
// error label): the assertion is err != nil AND the error message does not
// contain "not found". Any non-"not found" error from GetIntegratedAuthenticator
// proves the registry lookup reached the krb5 provider rather than the miss
// `provider %v not found`; upstream may reword its config-load or keytab error
// messages, so no specific upstream string is asserted here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This comment is long and reads like review notes. Cut it to one or two lines, e.g. // A non-"not found" error proves the lookup reached the krb5 provider.

Comment on lines +11 to +13
// Test_DefaultProviderNameUnchanged guards that registering the krb5 provider
// does not change the platform default authenticator, which stays "ntlm" on
// unix (per auth_unix.go init() being its only unix writer).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Drop "(per auth_unix.go init() being its only unix writer)". // Default provider stays ntlm on unix. is enough.

},
want: "postgres://testuser:testpass@[::1]:5432/testdb",
},
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add User: "svc-account" (no Password) to this row so it pins the form the docs tell users to use: sqlserver://svc-account@host… with no password. As written it pins params only, and upstream rejects a keytab login without a username (ErrUsernameRequiredWithKeytab).

Comment thread docs/docs-info.md
> - PostgreSQL: `postgres://username:password@host:port/database`
> - Oracle: `oracle://username:password@host:port/service`
> - SQL Server: `sqlserver://username:password@host:port?database=dbname`
> - SQL Server (Kerberos/keytab): use a DSN with a username but no password, e.g. `sqlserver://<user>@host:port?database=dbname&authenticator=krb5&krb5-realm=<REALM>&krb5-keytabfile=<path>&krb5-configfile=<path>` (with both username and password present the keytab is ignored; the realm may also be encoded as `<user>@<REALM>`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Consider also covering connect.user with no connect.password plus connect.params (the README's recommended style), since most users configure through params, not a raw DSN. Also note that the keytab and krb5.conf paths must exist inside the connector's runtime (container mount for K8s).

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.

1 participant