Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 9903c6d

Browse files
committed
common: Add FTS3/FTS4 functions to the SQLite authorizer white list
1 parent 6dfce4f commit 9903c6d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

common/sqlite.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,17 @@ const (
112112
fnJsonEach function = "json_each"
113113
fnJsonTree function = "json_tree"
114114

115-
// FTS5 functions
115+
// FTS3 & FTS4 functions: https://www.sqlite.org/fts3.html
116+
fnFts3 function = "fts3"
117+
fnFts3Tokenize function = "fts3tokenize"
118+
fnFts4 function = "fts4"
119+
fnFts4Aux function = "fts4aux"
120+
fnMatchinfo function = "matchinfo"
121+
fnOffsets function = "offsets"
122+
123+
// FTS5 functions: https://www.sqlite.org/fts5.html
116124
fnBm25 function = "bm25"
117-
fnFts function = "fts5"
125+
fnFts5 function = "fts5"
118126
fnFts5Vocab function = "fts5vocab"
119127
fnHighlight function = "highlight"
120128
fnSnippet function = "snippet"
@@ -202,8 +210,14 @@ var SQLiteFunctions = []function{
202210
fnJsonGroupObject,
203211
fnJsonEach,
204212
fnJsonTree,
213+
fnFts3,
214+
fnFts3Tokenize,
215+
fnFts4,
216+
fnFts4Aux,
217+
fnMatchinfo,
218+
fnOffsets,
205219
fnBm25,
206-
fnFts,
220+
fnFts5,
207221
fnFts5Vocab,
208222
fnHighlight,
209223
fnSnippet,
@@ -218,7 +232,8 @@ func init() {
218232
}
219233

220234
// AuthorizerLive is a SQLite authorizer callback intended to allow almost anything. Except for loading extensions,
221-
// and running pragmas.
235+
// and running pragmas. Note that the "page_size" pragma is always allowed by SQLite, and can't be overridden (any
236+
// attempt to AuthDeny it is ignored)
222237
func AuthorizerLive(d interface{}, action sqlite.Action, tableName, funcName, dbName, triggerName string) sqlite.Auth {
223238
if SqliteDebug > 0 {
224239
// Display some useful debug info

0 commit comments

Comments
 (0)