Skip to content

fix(introspect): Harden live database connections and warn on malformed MySQL enum definitions#45

Merged
mhiro2 merged 2 commits into
mainfrom
fix/introspect-hardening
Apr 10, 2026
Merged

fix(introspect): Harden live database connections and warn on malformed MySQL enum definitions#45
mhiro2 merged 2 commits into
mainfrom
fix/introspect-hardening

Conversation

@mhiro2

@mhiro2 mhiro2 commented Apr 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enforce TLS on remote TCP connections and apply a 30-second statement deadline for PostgreSQL,
    MySQL, and MariaDB introspection, while preserving local/loopback behavior untouched
  • Extract shared ParallelCatalogReader trait and connection helpers to eliminate duplicated
    catalog assembly and pool cleanup across PostgreSQL, MySQL, and SQLite adapters
  • Replace silent fallback on malformed MySQL ENUM/SET definitions with structured parse
    errors and emit diagnostics instead of silently ignoring bad input
  • Update ARCHITECTURE.md, docs/cli-reference.md, and docs/getting-started.md to document
    the new security defaults

Changes

  • dcf78ff : fix(introspect): harden live database connections
    • Enforce TLS on remote PostgreSQL, MySQL, and MariaDB TCP connections while keeping local/loopback and socket transports untouched
    • Apply a default 30-second statement deadline via PostgreSQL statement_timeout and MySQL/MariaDB max_execution_time/max_statement_time
    • Extract shared ParallelCatalogReader trait and close_pool_when_done helper to unify parallel catalog fetching and guaranteed pool draining across all three adapters
  • 8174cde : fix(parser): warn on malformed mysql enum definitions
    • Replace silent None returns in MySQL ENUM/SET parsing with structured MySqlEnumLikeParseError variants covering incomplete escapes, unterminated quotes, missing parentheses, and unexpected separators
    • Emit parse diagnostics when malformed definitions are encountered instead of silently skipping them
    • Add unit tests for incomplete escape sequences and diagnostic emission on malformed definitions

mhiro2 added 2 commits April 10, 2026 08:46
Remote PostgreSQL and MySQL/MariaDB introspection now upgrades weak TLS
settings to encrypted connections by default, while loopback and socket
connections keep their local transport behavior.
PostgreSQL adds a default statement timeout, MySQL/MariaDB configures a
per-session execution deadline, pool draining now runs on every return
path, and shared catalog fetch scaffolding removes duplicated dialect
boilerplate.
MySQL enum and set parsing now distinguishes unsupported types from
malformed definitions instead of collapsing through  chains.
Malformed enum/set column types emit warning diagnostics during schema
inference, and dedicated regression tests cover incomplete escape
sequences so broken input no longer disappears silently.
@mhiro2 mhiro2 self-assigned this Apr 10, 2026
@mhiro2 mhiro2 added the enhancement New feature or request label Apr 10, 2026
@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (5dfe5d4) #45 (730f4fb) +/-
Coverage 94.0% 94.1% +0.1%
Test Execution Time 1m39s 1m41s +2s
Details
  |                     | main (5dfe5d4) | #45 (730f4fb) |  +/-  |
  |---------------------|----------------|---------------|-------|
+ | Coverage            |          94.0% |         94.1% | +0.1% |
  |   Files             |             71 |            73 |    +2 |
  |   Lines             |          29573 |         29749 |  +176 |
+ |   Covered           |          27805 |         28004 |  +199 |
- | Test Execution Time |          1m39s |         1m41s |   +2s |

Code coverage of files in pull request scope (88.0% → 89.3%)

Files Coverage +/- Status
crates/relune-introspect/src/catalog.rs 97.1% +97.1% added
crates/relune-introspect/src/connect.rs 95.9% +95.9% added
crates/relune-introspect/src/lib.rs 90.0% 0.0% modified
crates/relune-introspect/src/mysql/catalog.rs 94.2% -1.0% modified
crates/relune-introspect/src/mysql/mod.rs 86.6% -1.3% modified
crates/relune-introspect/src/postgres/catalog.rs 96.7% +11.7% modified
crates/relune-introspect/src/postgres/mod.rs 75.0% -6.9% modified
crates/relune-introspect/src/sqlite/catalog.rs 97.1% 0.0% modified
crates/relune-introspect/src/sqlite/mod.rs 84.6% -1.1% modified
crates/relune-parser-sql/src/lib.rs 86.7% +0.3% modified

Reported by octocov

@mhiro2
mhiro2 merged commit d0c858e into main Apr 10, 2026
3 checks passed
@mhiro2
mhiro2 deleted the fix/introspect-hardening branch April 10, 2026 09:21
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.

1 participant