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

Đang mở
#63 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp, sql

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C#
Star
68
Fork
4
Merge trung bình
50 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Nimblesite/DataProvider

Tất cả issue của Nimblesite/DataProvider

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.