Repository navigation
Fix bugs, improve error handling, and expand test coverage - #29
Merged
Merged
Conversation
- Use p.ErrorNumber and p.ErrorDetail instead of hardcoded package constants in prepareResponse, so user-configured values take effect - Propagate context with a configurable timeout (default 10s) to the prediction API HTTP call instead of using context.Background() - Handle encode errors from EmptyQueryResponse and ReadyForQuery instead of silently discarding them
- Fix "Clinet" -> "Client" typos in test function names - Add Test_emptyResponse for the "empty" response type branch - Add Test_GetPluginConfig for the config retrieval method - Add Test_OnTrafficFromClientBelowThreshold for the no-detection path - Add Test_OnTrafficFromClientEmptyQuery for empty request handling - Remove duplicate Test_OnTrafficFromClientFailedPrediction
- Fix copy-paste error: "gatewayd-plugin-cache" -> "gatewayd-plugin-sql-ids-ips" - Update actions/checkout from v3 to v4 - Update actions/setup-go from v3 to v5 - Update softprops/action-gh-release from v1 to v2
Merged
4 tasks done
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.
Ticket(s)
Description
This PR fixes several bugs, improves error handling, and expands test coverage for the SQL IDS/IPS plugin.
Bug fixes
prepareResponseusing hardcoded constants:ErrorNumberandErrorDetailwere package-level constants instead ofp.ErrorNumber/p.ErrorDetail, so user-configured values from the config were silently ignored.gatewayd-plugin-cachecorrected.Test_OnTrafficFromClinet→Test_OnTrafficFromClient.Improvements
context.Background(), preventing the plugin from blocking indefinitely if DeepSQLi is slow or unresponsive.prepareResponse: Errors fromEmptyQueryResponse.Encode()andReadyForQuery.Encode()are now logged instead of silently discarded.actions/checkoutv3→v4,actions/setup-gov3→v5,softprops/action-gh-releasev1→v2.New tests
Test_emptyResponse— exercises theResponseType == "empty"branchTest_GetPluginConfig— covers config retrievalTest_OnTrafficFromClientBelowThreshold— verifies no-detection path for legitimate queriesTest_OnTrafficFromClientEmptyQuery— verifies empty request handlingRelated PRs
Development Checklist
Legal Checklist