Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41909

MDEV-40323 fix is incomplete: CONNECT JSON/BSON UDF internal read helpers bypass FILE_ACL / secure_file_priv checks

    XMLWordPrintable

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.

        1. 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.

      Attachments

        Activity

          People

            shipjain Shipra Jain
            csfuzz csfuzz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.