Repository navigation
fix(sof): refuse fts3_tokenizer in SQL-on-FHIR queries - #2955
Open
angela-helios wants to merge 1 commit into
Open
angela-helios wants to merge 1 commit into
angela-helios wants to merge 1 commit into
Conversation
The read-only authorizer allowed every function, and the bundled SQLite
has FTS3, so SELECT fts3_tokenizer('simple') returned the address of a
tokenizer module in the server process. The authorizer now denies that
function and reports it as a refused function.
Closes #2954
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This branch has not been deployed
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.
Closes #2954
Summary
The SQL query engine's read-only authorizer allowed every function call. The bundled SQLite includes FTS3, so
SELECT fts3_tokenizer('simple')returned the address of a tokenizer module inside the server process: an address-layout leak to any$sql-runorsof-servercaller. The two-argument form registers a tokenizer at a caller-given address.The authorizer now denies
AuthAction::Functionforfts3_tokenizer, in any case. The refusal is reported asSqlQueryError::NotSelect("the SQL function fts3_tokenizer() is not permitted"), the same error class as a refused write. A smallRefusalenum keeps the statement message ("only SELECT queries are allowed; … statements are not permitted") for statements.Tests
sqlquery::engine::tests::execute_select_refuses_fts3_tokenizerchecks:fts3_tokenizer('simple'),FTS3_Tokenizer('porter'), the call nested inlength(...), and the call with a bound parameter:tare all refused, with the message;upper('ok')still runs.With the refusal disabled,
SELECT fts3_tokenizer('simple')runs and the test fails, which also confirms the function is reachable in the bundled build.The 30 engine tests pass. Clippy on
helios-sof --all-targetsis clean.