LQL: support table/setof-returning functions for SECURITY DEFINER row reads

オープン
#63 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
csharp, sql

調査の方向性

Start with the functions: surface in schema.yaml and the LQL/DataProvider handling for scalar returns such as boolean and uuid. Determine whether table/setof returns and tuple projection exist; document the supported syntax and behavior, or record the missing capability in the roadmap, using the linked kill-app-admin plans as acceptance context.

索引モデルが issue の本文から書いたものです。

説明

Need

NAP's `[AUTHZ-ONE-ROLE]` migration (docs/plans/kill-app-admin.md) drops the direct `app_user` SELECT grant on a handful of operator-owned tables (`cost_card_llm`, `cost_card_machine`, `wallet.markup`, `bundles` in the HMAC-only path). Reads from those tables move behind `SECURITY DEFINER` functions that re-verify the caller's intent server-side (HMAC, GUC, etc.) and return the row(s).

The existing LQL `functions:` surface in `schema.yaml` supports scalar returns (`boolean`, `uuid`). Example:

```yaml

  • name: is_member
    arguments: [...]
    returns: boolean
    securityDefiner: true
    bodyLql: |
    exists(tenant_members |> filter(fn(m) => m.user_id = u and m.tenant_id = t))
    executeRoles: [app_user, app_admin]
    ```

The pipeline syntax `

|> filter(...)` could naturally extend to row sets, but there is no example of a function returning a row (`returns: table(...)` / `returns: setof
`) and no obvious LQL operator to project a tuple.

Ask

  1. Document whether table/setof returns are supported today (and how — `returns: setof cost_card_llm` style?).
  2. If not supported, add it to the roadmap. NAP can work around by emitting JSON-encoded rows from a SECDEF returning `text` / `jsonb`, but that's a hack — proper typed support would be far cleaner.

Workarounds NAP is considering (in order of preference)

  1. `returns: jsonb` + decode in Python (works today if jsonb is supported by LQL).
  2. `returns: setof <table_name>` (needs DataProvider support).
  3. Multiple scalar SECDEF fns (one per column) — slow + many round-trips.
  4. Keep `admin_session` for these reads — defeats the whole `[AUTHZ-ONE-ROLE]` invariant.

Filed during the 2026-05-19 NAP coverage / kill-app-admin push. Cross-link: NimblesiteAgenticPlatform/docs/plans/kill-app-admin.md, NimblesiteAgenticPlatform/docs/plans/kill-app-admin-edit-list.md.

主要言語
C#
スター
68
フォーク
4
平均マージ
50分
マージ済み PR(30日)
2

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Nimblesite/DataProvider のほかの issue

Nimblesite/DataProvider の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。