Basic logging for sql sanitizer#4708
Open
dima-zakharov wants to merge 4 commits into
Open
Conversation
Signed-off-by: Dmitry Zakharov <zakharov@ibm.com>
Contributor
Author
|
I updatd workflow to make it possible to see logged messages in workflow: This log entry shows that plugin method was invoked with dangrouse sql: "DROP table asdf" |
Signed-off-by: Dmitry Zakharov <zakharov@ibm.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds debug-level logging around the SQL sanitizer plugin and updates CI workflow steps to capture and inspect server logs for sanitizer-related output.
Changes:
- Initialize a logger for
sql_sanitizerand emit debug logs for plugin config and incoming payload args. - Update GitHub Actions workflow to run the server with log redirection and grep for sanitizer-related logs.
- Minor import/comment cleanup and formatting change for the
@field_validatordecorator.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| plugins/sql_sanitizer/sql_sanitizer.py | Adds module-level logger initialization and debug logs for config/payload. |
| .github/workflows/sql-sanitizer.yml | Enables DEBUG logging in CI, captures gunicorn output to a file, and greps for sanitizer logs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+38
to
+42
| from mcpgateway.services.logging_service import LoggingService | ||
|
|
||
| # Initialize logging service first | ||
| logging_service = LoggingService() | ||
| logger = logging_service.get_logger(__name__) |
| config: Plugin configuration. | ||
| """ | ||
| super().__init__(config) | ||
| logger.debug(f"SQL-SANITIZER config: {config}") |
| Returns: | ||
| Result indicating SQL issues found or sanitized. | ||
| """ | ||
| logger.debug(f"SQL-SANITIZER payload: {payload.args} config: {self._cfg}") |
| config: Plugin configuration. | ||
| """ | ||
| super().__init__(config) | ||
| logger.debug(f"SQL-SANITIZER config: {config}") |
| Returns: | ||
| Result indicating SQL issues found or sanitized. | ||
| """ | ||
| logger.debug(f"SQL-SANITIZER payload: {payload.args} config: {self._cfg}") |
| Returns: | ||
| Result indicating SQL issues found or sanitized. | ||
| """ | ||
| logger.debug(f"SQL-SANITIZER payload: {payload.args} config: {self._cfg}") |
| JWT_SECRET_KEY: ${{ env.DYNAMIC_JWT_SECRET }} | ||
| ADMIN_REQUIRE_PASSWORD_CHANGE_ON_BOOTSTRAP: false | ||
| PASSWORD_CHANGE_ENFORCEMENT_ENABLED: false | ||
| LOG_LEVEL: DEBUG |
| make install | ||
| make stop-serve | ||
| make serve & | ||
| make serve > gunicorn.log 2>&1 & |
Comment on lines
+308
to
309
| cat gunicorn.log | grep sql_sanitizer | ||
|
|
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.
🔗 Related Issue
Closes #4707
📝 Summary
Added debug only logging for sql sanitizer
🏷️ Type of Change
🧪 Verification
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes (optional)
Screenshots, design decisions, or additional context.