1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-04 20:02:48 +03:00

When UNSAFE_IN_VIEW is disabled, only allow functions in views that are

tagged with SQLITE_INNOCUOUS.

FossilOrigin-Name: 9ee79b254e4c51a2a41f7ed49ad389d8d7105e649483adb79772052fa0ade3c0
This commit is contained in:
drh
2020-01-03 20:57:38 +00:00
parent 9ee00200ef
commit c4ad849921
6 changed files with 58 additions and 37 deletions

View File

@@ -5025,12 +5025,26 @@ int sqlite3_create_window_function(
** [sqlite3_create_function_v2()].
**
** The SQLITE_DETERMINISTIC flag means that the new function always gives
** the same output when the input parameters are the same. The abs() function
** is deterministic, for example, but randomblob() is not. Functions must
** the same output when the input parameters are the same.
** The [abs|abs() function] is deterministic, for example, but
** [randomblob|randomblob()] is not. Functions must
** be deterministic in order to be used in certain contexts such as
** [CHECK constraints] or [generated columns]. SQLite might also optimize
** deterministic functions by factoring them out of inner loops.
**
** The SQLITE_INNOCUOUS flag means that the new function is unlikely
** to cause problems even if misused. An innocuous function should have
** no side effects and consume few resources. The [abs|abs() function]
** is an example of an innocuous function.
** The [load_extension() SQL function] is not innocuous because of its
** side effects. Some heightened security settings
** ([SQLITE_DBCONFIG_UNSAFE_FUNC_IN_VIEW])
** disable the use of SQLlfunctions inside views and triggers unless
** the function is tagged with SQLITE_INNOCUOUS. Most built-in functions
** are innocuous. Developers are advised to avoid using the
** SQLITE_INNOCUOUS flag for application-defined functions unless the
** function is specifically intended for use inside of views and triggers.
**
** The SQLITE_DIRECTONLY flag means that the function may only be invoked
** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is
** a security feature which is recommended for all
@@ -5050,6 +5064,7 @@ int sqlite3_create_window_function(
#define SQLITE_DETERMINISTIC 0x000000800
#define SQLITE_DIRECTONLY 0x000080000
#define SQLITE_SUBTYPE 0x000100000
#define SQLITE_INNOCUOUS 0x000200000
/*
** CAPI3REF: Deprecated Functions