Skip to content

feat: add MySQL/MariaDB protocol class - #62

Merged
BugFriendlyGarden merged 1 commit into
sandialabs:mainfrom
jgallagheriii:feat/mysql-protocol
Aug 24, 2026
Merged

feat: add MySQL/MariaDB protocol class#62
BugFriendlyGarden merged 1 commit into
sandialabs:mainfrom
jgallagheriii:feat/mysql-protocol

Conversation

@jgallagheriii

Copy link
Copy Markdown
Contributor

Add MySQL/MariaDB protocol class

Description

  • Add MySQL/MariaDB protocol class (peat/protocols/mysql.py) with unauthenticated server fingerprinting via TCP greeting packet, PyMySQL-backed query helpers, and on_connected/enumerate subclass hooks
  • Add PyMySQL >=1.1.0 as a project dependency
  • Add unit tests for MySQL protocol class
  • Update docs with MySQL protocol and PyMySQL dependency
    Please include a summary of the changes made.

Related Issue

Closes #59

Checklist

Please check the following items as they're completed.
Completion of all checklist items signals to maintainers that a PR is fully ready for review.

  • This PR conforms to the process detailed in the Contributing Guide
  • I have included no proprietary/sensitive information in my code
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have tested my code
  • I have added a description of my changes to the changelog in CHANGELOG.rst
  • Apply appropriate Tags to this PR, if any (e.g. bugfix, enhancement(feature), documentation, etc.)
  • Removing "Draft" status from the PR (if applicable).

@jgallagheriii
jgallagheriii force-pushed the feat/mysql-protocol branch 2 times, most recently from 0307579 to 9be85dc Compare May 8, 2026 16:29

@GhostofGoes GhostofGoes 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.

Some other requests:

  • Has this been tested extensively against a OT device/system running MySQL? What SQL server instances has it been tested against (if you can share in open-source)
  • Add references to new class to developer API documentation
  • Add a documentation page dedicated to MySQL

Comment thread peat/protocols/mysql.py Outdated
Comment thread peat/protocols/mysql.py
Comment thread peat/protocols/mysql.py Outdated
Comment thread peat/protocols/mysql.py
Comment thread peat/protocols/mysql.py Outdated
Comment thread peat/protocols/mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
@jgallagheriii

Copy link
Copy Markdown
Contributor Author

Some other requests:

  • Has this been tested extensively against a OT device/system running MySQL? What SQL server instances has it been tested against (if you can share in open-source)
  • Add references to new class to developer API documentation
  • Add a documentation page dedicated to MySQL

This has not been tested against an OT device running MySQL. The implementation was validated against a standard MySQL instance running in Docker. The class is designed as a base class — device-specific subclasses are expected to override on_connected() and enumerate() to query proprietary tables relevant to a particular device. Testing against specific OT targets is left to those subclasses.

@GhostofGoes

Copy link
Copy Markdown
Contributor

Add a GitHub Actions workflow that spawns a MySQL container and executes tests against it

@jgallagheriii
jgallagheriii force-pushed the feat/mysql-protocol branch 3 times, most recently from 2048256 to 7aa7109 Compare August 3, 2026 18:20
@BugFriendlyGarden BugFriendlyGarden added the enhancement New feature or request label Aug 4, 2026
@jgallagheriii
jgallagheriii force-pushed the feat/mysql-protocol branch 2 times, most recently from ad00988 to 70498bb Compare August 20, 2026 23:02

@GhostofGoes GhostofGoes 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.

I'd like to see an example module that adds to the data model, eg Users

- MySQL wrapper around PyMySQL with lazy connection via conn property
- Bound logger, __enter__/__exit__ context manager support
- on_connected and enumerate hooks for subclass customization
- Helper methods: get_databases, get_tables, get_table_row_count,
  get_users, get_grants, get_global_variables, get_process_list
- read_greeting staticmethod for unauthenticated banner fingerprinting
- Plain-function pytest suite covering all public methods and hooks
- Integration tests (test_mysql_integration.py) tagged with container
  marker for running against a live MySQL instance
- MySQL integration test job added to tests-container.yml, spinning up
  MySQL 8.0 as a service container on push/PR

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread newsfragments/62.feature
Comment thread pdm.lock
@BugFriendlyGarden

Copy link
Copy Markdown
Collaborator

This PR has been approved by the team so we're going to merge it in without a module that directly utilizes the new capability. We can do that later when it comes up.

@BugFriendlyGarden
BugFriendlyGarden merged commit a0554c2 into sandialabs:main Aug 24, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add MySQL protocol module

3 participants