Skip to content

Conversation

OpenGaet
Copy link
Contributor

Fixes a bug that incorrectly raised an exception when executing select statements when allow_write is false.

Summary

Changes

Enhanced SQL mutation detection: Added new mutable_sql_detector.py utility with comprehensive keyword detection for SQL operations that modify data
Improved write access control: Replaced simple string matching with robust pattern matching to detect mutating SQL operations (INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, etc.)
Better error handling: More specific error messages when mutating operations are attempted without write access
Code reorganization: Moved query execution logic earlier in the flow for better validation sequencing

User experience

User will no longer experience a fatal bug when executing select statements with allow_write set to false.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? N

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

@ckha2000 ckha2000 enabled auto-merge October 15, 2025 22:44
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.50%. Comparing base (f8ac8dc) to head (d09c9da).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1511   +/-   ##
=======================================
  Coverage   89.50%   89.50%           
=======================================
  Files         730      731    +1     
  Lines       51332    51345   +13     
  Branches     8166     8167    +1     
=======================================
+ Hits        45943    45956   +13     
  Misses       3474     3474           
  Partials     1915     1915           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ckha2000 ckha2000 added this pull request to the merge queue Oct 15, 2025
Merged via the queue into awslabs:main with commit 5b1ceee Oct 15, 2025
138 of 139 checks passed
@github-project-automation github-project-automation bot moved this from To triage to Done in awslabs/mcp Project Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants