Skip to content

Improve MySQL JS fingerprint with native handshake parsing - #7575

Merged
Mzack9999 merged 3 commits into
devfrom
4789-mysql-fingerprint
Jul 27, 2026
Merged

Improve MySQL JS fingerprint with native handshake parsing#7575
Mzack9999 merged 3 commits into
devfrom
4789-mysql-fingerprint

Conversation

@Mzack9999

@Mzack9999 Mzack9999 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace fingerprintx in FingerprintMySQL / IsMySQL with a native MySQL greeting parser (one dial).
  • Expose handshake fields beyond version: protocol version, thread ID, capabilities, charset, status, salt, auth plugin (plus existing error packet debug).
  • Keep version detection aligned with fingerprintx; cover with unit, client, and docker integration tests (MySQL 5.7/8.0/8.4, MariaDB 11.4).

Closes #4789

Summary by CodeRabbit

  • New Features
    • Added richer MySQL service fingerprinting details (server/protocol version, capabilities/status, charset, authentication plugin, salt, and connection metadata).
    • Enhanced support for fingerprinting multiple MySQL and MariaDB versions.
  • Bug Fixes
    • Improved MySQL detection and fingerprinting consistency by reusing a single connection attempt.
  • Tests
    • Added extensive unit and client-harness tests for valid/invalid handshakes and error greetings.
    • Added an integration MySQL fingerprinting test case that runs when container tooling is available.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5823c200-7f1e-411c-9000-11174112b0d8

📥 Commits

Reviewing files that changed from the base of the PR and between c3a7fe0 and bc287ed.

📒 Files selected for processing (1)
  • pkg/js/libs/mysql/fingerprint.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/js/libs/mysql/fingerprint.go

Walkthrough

MySQL fingerprinting now parses and exposes handshake metadata, reuses memoized probes, preserves error details, and validates behavior across packet fixtures, client tests, and MySQL/MariaDB container versions.

Changes

MySQL fingerprint enrichment

Layer / File(s) Summary
Packet parser and fingerprint contract
pkg/js/libs/mysql/fingerprint.go
Adds MySQL greeting/error parsing, handshake enrichment, capability/status decoding, salt formatting, and JSON serialization.
Parser fixtures and compatibility validation
pkg/js/libs/mysql/fingerprint_test.go
Tests valid handshakes, error packets, malformed inputs, helper functions, JSON output, and fingerprintx parity.
Client fingerprint integration
pkg/js/libs/mysql/mysql.go
Uses memoized fingerprinting and exposes parsed handshake fields through MySQLInfo.
Client behavior tests
pkg/js/libs/mysql/mysql_fingerprint_client_test.go
Validates handshake/error handling, memoized dialing, policy restrictions, rejection behavior, and version propagation.
JavaScript MySQL fingerprint integration
internal/tests/integration/javascript_test.go
Runs the fingerprint template against MySQL and MariaDB container versions with readiness checks and combined failures.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Target
  participant IsMySQL
  participant FingerprintMySQL
  participant fingerprintConn
  Target->>fingerprintConn: MySQL greeting
  IsMySQL->>FingerprintMySQL: memoized fingerprint probe
  FingerprintMySQL->>fingerprintConn: parse greeting
  fingerprintConn-->>FingerprintMySQL: HandshakeInfo
  FingerprintMySQL-->>IsMySQL: MySQL availability and metadata
Loading

Poem

A rabbit hops through packets bright,
Finds salts and versions in the light.
MySQL speaks; the fields unfold,
MariaDB joins the testing hold.
“Hop, hop!” the fixtures cheer—
Fingerprints grow clearer here.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: native MySQL handshake parsing for JS fingerprinting.
Linked Issues check ✅ Passed The PR adds native MySQL network-layer fingerprinting and exposes the handshake data requested in #4789.
Out of Scope Changes check ✅ Passed The changes stay focused on MySQL fingerprinting and its tests, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 4789-mysql-fingerprint

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.

@Mzack9999
Mzack9999 merged commit 671b875 into dev Jul 27, 2026
19 checks passed
@Mzack9999
Mzack9999 deleted the 4789-mysql-fingerprint branch July 27, 2026 08:10
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.

Add/Improve Fingerprint data in Mysql Module

1 participant