Improve MSSQL JS fingerprint via TDS prelogin - #7577
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds MSSQL TDS pre-login fingerprinting with parsed server metadata, memoized execution, MSSQL detection reuse, and JavaScript integration tests backed by a localhost mock listener. ChangesMSSQL fingerprinting
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant JavaScriptTemplate
participant MSSQLClient
participant MockMSSQLServer
JavaScriptTemplate->>MSSQLClient: Request MSSQL fingerprint
MSSQLClient->>MockMSSQLServer: Send TDS pre-login request
MockMSSQLServer-->>MSSQLClient: Return crafted pre-login response
MSSQLClient-->>JavaScriptTemplate: Return parsed MSSQLInfo
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/js/libs/mssql/fingerprint.go`:
- Around line 100-159: Update fingerprintMssql and its IsMssql caller to
distinguish parsePreloginResponse failures or missing MSSQL version tokens from
transport and permission errors: return a non-MSSQL result as (false, nil) for
unparseable/non-MSSQL TDS responses, while continuing to propagate dial,
allowlist, initialization, read, write, and other probe failures as errors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fdba497a-e6a5-4a67-9e84-768b1ed03ceb
⛔ Files ignored due to path filters (3)
internal/tests/integration/testdata/protocols/javascript/mssql-fingerprint.yamlis excluded by!**/*.yamlpkg/js/generated/go/libmssql/mssql.gois excluded by!**/generated/**pkg/js/generated/ts/mssql.tsis excluded by!**/generated/**
📒 Files selected for processing (6)
internal/tests/integration/javascript_mssql_test.gointernal/tests/integration/javascript_test.gopkg/js/libs/mssql/fingerprint.gopkg/js/libs/mssql/fingerprint_test.gopkg/js/libs/mssql/memo.fingerprint.gopkg/js/libs/mssql/mssql.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/js/libs/mssql/fingerprint_test.go`:
- Around line 68-73: Update TestFingerprintMarksInvalidPacketAsNotMssql to
exercise fingerprintMssql with the invalid packet and assert it returns a
non-MSSQL result while preserving the expected error behavior. Do not manually
wrap the parser error with errNotMssql, since that only tests the test’s own
fmt.Errorf call; if testing isMssqlResult directly instead, pass the wrapped
value into it and assert (false, nil).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7a5f1d7b-24d3-4806-8afd-8d35fb46a6b7
📒 Files selected for processing (3)
pkg/js/libs/mssql/fingerprint.gopkg/js/libs/mssql/fingerprint_test.gopkg/js/libs/mssql/mssql.go
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/js/libs/mssql/mssql.go
- pkg/js/libs/mssql/fingerprint.go
Summary
Summary by CodeRabbit