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

Abierto
#63 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
csharp, sql

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C#
Estrellas
68
Forks
4
Merge medio
50 min
PR fusionados (30 d)
2

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Nimblesite/DataProvider

Todos los issues de Nimblesite/DataProvider

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.