security(sqlsafety): deny side-effecting functions in read-only vxd db sql (P0-05)#116
Merged
Merged
Conversation
…b sql READ ONLY transactions do not block pg_terminate_backend, lo_import, pg_read_file and friends — on a shared devdb host any local user could kill or snoop another user's session through vxd db sql without --write. - sqlsafety.ContainsDeniedFunction: call-shape matcher (whole identifier + open paren) over the comment/string-stripped query; built-in denylist of 8 catalog functions plus operator extras. - ValidateSQL(query, writeFlag, extraDeny) — read-only mode rejects any hit; --write (explicit opt-in) skips the denylist. Old ValidateSQLForReadOnly delegates unchanged. - New devdb.function_denylist_extra config knob, wired into vxd db sql. - Tests: TestSQLSafety_FunctionDenylist (15 denied incl. case/whitespace/ schema-qualified/comment-ambush + 5 non-matching), _DenylistExtraConfig. - Docs: CLAUDE.md CLI row + devdb block, README devdb section. Closes WEAKNESSES.md P0-05. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
pg_terminate_backend,lo_import,pg_read_fileand friends — on a shared devdb host any local user could kill or snoop another user's session throughvxd db sqlwithout--write.sqlsafety.ContainsDeniedFunctioncall-shape matcher (whole identifier + open paren) over the comment/string-stripped query; built-in denylist of 8 catalog functions plus operator extras via newdevdb.function_denylist_extraconfig knob.ValidateSQL(query, writeFlag, extraDeny)rejects hits in read-only mode;--write(explicit opt-in) skips the denylist.ValidateSQLForReadOnlydelegates unchanged.Tests
TestSQLSafety_FunctionDenylist— 15 denied cases (case-insensitivity, whitespace, schema-qualified, comment-ambush reassembly) + 5 non-matching (near-miss identifiers, quoted/comment mentions).TestSQLSafety_DenylistExtraConfig— operator extras denied, blank entries ignored.Closes WEAKNESSES.md P0-05.
🤖 Generated with Claude Code