Details
-
Bug
-
Status: Needs Feedback (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
source HEAD `c894d97781b5` (13.2.0-alpha)
Description
MDEV-40323 added `connect_can_access_file()` (`storage/connect/filechk.cpp:25-42`, checks `FILE_ACL`
and `is_secure_file_path`) at six entry points:
- `json_file` (`plugin/connect/jsonudf.cpp:4556-4576`),
- `jfile_make` output (`:4719-4735`),
- `jbin_file` (`:5821-5835`),
- `bson_file` (`plugin/connect/bsonudf.cpp:4475-4496`),
- `bfile_make` output (`:4642-4647`),
- `bbin_file`.
The following paths reach the same internal reader `GetJsonFile`
(`plugin/connect/jsonudf.cpp:1905-1938`, no ACL check) without going through the new gate:
1. `jfile_make` auto-filename detection: `jsonudf.cpp:4689-4696` calls `GetJsonFile(g, p)` for any first
argument that does not start with `[{ \t\r\n` — no `connect_can_access_file()` call.
2. `MakeValue` (`jsonudf.cpp:1969`): whenever `IsJson()` returns 2 (`jsonudf.cpp:1533-1560`, i.e. the
argument item's name carries a `Json_`/`Jfile_`/`Jbin_` prefix; `UDF_ARGS::attributes` is `item->name`,
`sql/item_func.cc:3696`), it calls `GetJsonFile` directly. A derived-table column alias such as
`... AS Jfile_x` makes `IsJson()==2`.
3. `bfile_make` input auto-detect (`bsonudf.cpp:4603-4610`) likewise reaches the reader ungated.
-
- Expected result
Every path that opens a file for a JSON/BSON UDF must enforce the same `FILE_ACL`/`secure_file_priv`
policy as the six already-gated entry points.