connection updates

This commit is contained in:
Mark Gregory
2026-10-19 12:17:32 +01:00
parent 7cf013a783
commit 69c8d2c4db
3 changed files with 78 additions and 6 deletions
+37
View File
@@ -0,0 +1,37 @@
# DBSyn source audit — 19 October 2026
## Scope and evidence
Reviewed all eight Swift source files, Xcode project configuration, XCTest source, and test-runner syntax. Baseline: Phase 74.6.2 (newer than the user-uploaded 11:13 archive). Checked source syntax using Linux Swift parser, not the macOS SDK or Xcode compiler. No live database, SSH or TLS tests were possible. This is a **static audit**, not a production certification.
## Fixes in this revision
- Fixed three accidentally escaped Swift interpolations in SQL script open/save status messages.
- Added a connection-epoch guard to prevent responses from a previous connection selection or saved-profile edit from changing query/database UI state.
- Guarded table, routine and column metadata updates after awaited network calls against stale connections.
- Added tests for legacy connection decoding and security-option persistence.
## Findings requiring further engineering and macOS validation
| Priority | Area | Evidence and risk | Required action |
|---|---|---|---|
| Critical | Native TLS | `MySQLProtocol.swift` upgrades already-open `CFStream`s using negotiated SSL settings. This approach has not been demonstrated to enforce TLS 1.2+ or validate peer identity on real servers. | Replace with tested transport using modern TLS APIs, enforce TLS >= 1.2, validate hostname/certificate, test against valid/expired/wrong-host certs. |
| High | Offline connections | `readExact` uses synchronous stream reads without a clearly enforced deadline. Per-profile serial queues prevent cross-profile blocking but the offline profile can remain stuck. | Add connection/read/write deadlines and cancellation with tests for unreachable/blackholed endpoints. |
| High | SSH startup | SSH tunnel launch sleeps 0.6 s and assumes process still running means forwarding is ready; local port derives from UUID and may collide. | Use ephemeral bound local port, readiness probe, bounded retry and stderr diagnostics. |
| High | UI performance | `MainView.swift` is >350 KB; complex SwiftUI view and administration features in a monolithic file. | Split by feature, profile redraws and memory, implement lazy paging for large result sets. |
| High | SQL execution | Multi-statement scripts may partially execute before a later failure; row editing and schema modifications depend on SQL generation. | Add transaction-awareness, explicit non-atomic warning, tests for generated SQL and identifiers. |
| High | Secrets | PHP CLI hashing is invoked using a subprocess, with password delivered via stdin (not command line). Plaintext and hash are retained in view state until dismissed. | Test memory/clipboard lifecycle, add clipboard-clear option and executable validation. |
| Medium | Legacy storage | Some settings keys still use `WorkbenchReplacement.*`. | Plan a versioned migration with compatibility tests before renaming keys. |
| Medium | Admin UI | Account privileges, account limits and options editing have not been verified against actual MySQL 8 servers and least-privilege accounts. | End-to-end test create/edit/grant/revoke/reload, confirm privilege matrices and SQL previews. |
| Medium | Regression testing | Existing XCTest covers parsers, profiles and diagrams, but not live networking, SQL result editing, TLS or admin changes. | Add integration suite against disposable MySQL with TLS, SSH and offline fault injection. |
## Release gate
1. Xcode build + XCTest pass on macOS 15+ (arm64).
2. Working → offline → working connection switch recovers without beachball.
3. TLS valid/invalid certificate cases verified; no password sent in plaintext on remote connections.
4. Create/edit/drop account and grant/revoke/limits tested with restricted permissions.
5. Laravel bcrypt output validated with `password_verify` and Laravel `Hash::check`.
6. Large result sets, imports and exports profiled for memory and responsiveness.
**Do not treat this ZIP as fully verified or production-ready until these gates pass.**