← Back to Pull requests

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

Closed
unknown closed this pull request without merging on Nov 02, 2026 15:37 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 17:11 UTC
Author

Registers go-mssqldb's krb5 integrated-auth provider so a SQL Server DSN with authenticator=krb5 and keytab params authenticates via Kerberos instead of failing with provider krb5 not found.

What changed

  • pkg/database/sqlserver/sqlserver.go: blank import of github.com/microsoft/go-mssqldb/integratedauth/krb5. Its init() registers the krb5 provider. Nothing imported it before, so the driver's registry never had it.

  • pkg/database/sqlserver/krb5_test.go: asserts the krb5 registry lookup reaches the provider (fails with provider krb5 not found if the import is dropped).

  • docs/docs-info.md: Kerberos/keytab DSN and connect.user/connect.params forms, runtime file mounts, SPN/FQDN and connect.database gotchas.

  • go.mod, go.sum, vendor/: adds jcmturner/gokrb5/v8 and its transitive modules. No existing pin moved.
  • Testing

  • Unit test: go test ./pkg/database/sqlserver/.

  • End to end against real containers: a Samba AD DC (KDC + DNS, realm CORP.EXAMPLE.COM) and SQL Server 2022 configured with an MSSQLSvc keytab. Login CORP\svcbaton was created FROM WINDOWS. baton-sql ran with only the client keytab, using the ticket's DSN form plus a username and no password.

  • - With this change: the sync completes and the session reports auth_scheme=KERBEROS as CORP\svcbaton, with 3 table rows synced. The KDC logs AS-REQ and TGS-REQ for MSSQLSvc/sql1.corp.example.com:1433 as SUCCESS.
    - Same tree with the import removed: validate failed: database "" ping failed: provider krb5 not found. This reproduces the ticket.
    - Using connect.database instead of ?database= fails with KDC_ERR_S_PRINCIPAL_UNKNOWN, because the path is read as an instance name. This is now documented.
  • Not covered: Windows AD, and the credcache and password krb5 methods.
  • Risk

    The gokrb5/v8 tree is vendored into every build, including for users who never use Kerberos.

    Release Notes

    baton-sql now supports Kerberos keytab authentication for SQL Server. Use a DSN with the Kerberos principal as the username (no password) plus authenticator=krb5, krb5-realm, krb5-keytabfile and krb5-configfile.

    Resolves CXH-3209

    🤖 Generated with Claude Code

    Diff: 280 lines (+210 / -70) across 3 files Reviewer: c1-squire-dev[bot] Review duration: 9985m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 280 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.337
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #156"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.8% (MEDIUM) · Higher = larger blast radius
    62.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.8% · Safe to merge
    24.8%