Skip to content

Block pg_cancel_backend and pg_terminate_backend in read-only mode#854

Open
sosedoff wants to merge 1 commit into
mainfrom
fix/readonly-restrict-cancel-terminate
Open

Block pg_cancel_backend and pg_terminate_backend in read-only mode#854
sosedoff wants to merge 1 commit into
mainfrom
fix/readonly-restrict-cancel-terminate

Conversation

@sosedoff
Copy link
Copy Markdown
Owner

Summary

  • Users could cancel/terminate queries via the activity panel even with read-only mode enabled, since pg_cancel_backend() and pg_terminate_backend() are SELECT-based function calls that bypass the existing keyword restriction
  • Added a regex check for these functions to the containsRestrictedKeywords filter
  • Added test cases covering both functions with various casing and spacing

Test plan

  • TestContainsRestrictedKeywords passes with new cases for pg_cancel_backend and pg_terminate_backend
  • Verify in read-only mode that clicking "stop query" in the activity panel returns an error

Users could terminate or cancel queries via the activity panel even when
read-only mode was enabled, since pg_cancel_backend() is a SELECT-based
function call that bypasses the keyword restriction. Add a regex check for
these functions to the restricted keywords filter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant