feat: security hardening, test coverage and refactoring#34
Merged
Conversation
- Add request timeout wrapper to StreamableHTTP handler (60s default) - Add signal handling for graceful shutdown (SIGINT/SIGTERM) - Add NewStreamableHTTPHandlerWithTimeout for custom timeout - Fix ignored json.MarshalIndent error in output writer Security: prevents unbounded HTTP request handling Robustness: proper server shutdown on interrupt signals
- Add passphrase-protected key tests (correct/wrong passphrase) - Add E2E tests for SSH CLI flags (--ssh-skip-known-hosts-check, --ssh-identity-file, --ssh-user, --ssh-host) - Add configurable query timeout (--query-timeout flag, profile config) - Add configurable schema timeout (--schema-timeout flag, profile config) - Add query_timeout and schema_timeout fields to Profile config
- Add shared ProfileInfo struct and ProfileToInfo helper to config package - Update cmd/xsql/profile.go to use shared ProfileInfo - Update internal/mcp/tools.go to use shared ProfileInfo - Add SSH testing documentation to docs/testing.md - Add timeout configuration to docs/config.md
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
==========================================
- Coverage 82.03% 81.11% -0.92%
==========================================
Files 37 38 +1
Lines 2449 2468 +19
==========================================
- Hits 2009 2002 -7
- Misses 331 354 +23
- Partials 109 112 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Security & Robustness
json.MarshalIndenterrors in output writerTest Coverage
--ssh-skip-known-hosts-check,--ssh-identity-file,--ssh-user,--ssh-host--query-timeoutand--schema-timeoutflags (also configurable in profile viaquery_timeout/schema_timeout)Refactoring
profileInfostruct tointernal/configfor shared use betweencmd/xsqlandinternal/mcpdocs/testing.md(SSH testing) anddocs/config.md(timeout config)Breaking Changes
None - all changes are backward compatible.
Testing
go test ./...go test -tags=e2e ./tests/e2e/...