taskflow: task read roles and caller-filtered actions
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 12/100
Línea de trabajo
Start with the proposal's design rather than code: it spans the task template schema, the gorm task store (new task_roles table written in the same transaction as the task row), GetTaskRenderInfo and GetAllTasks, renderer.Facts, and ZoneViewAssembler.Assemble. Work is already under way in linked PR 375, so review that first. Done means the proposal's access_roles and Commands filtering are implemented as specified, with the breaking changes handled.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
taskflow has no way to say who may open a task, or to show a caller only the actions they may take.
- Who may open a task.
GetTaskRenderInfoandGetAllTasksreturn any task to any caller. A host that wants to gate a task, or list only the caller's tasks, has nothing in the task record to match against. It ends up keeping its own task-to-role mapping outside taskflow, and that mapping can drift from the templates. - What a caller may do. The
PRE_RESUMEauthz extension decides on the server which commands a caller may issue. The zoneview renderer, however, keeps a handle whenever its command is legal in the current state. A caller who may see a section but not act on it still gets its actions, which the server rejects only when they submit.
Proposed Solution
Keep the policy in the host. taskflow stores what the templates declare and forwards what the host has resolved. The two parts are independent and ship as separate PRs.
-
Task read roles (#375). Task templates already carry
read.roles(#377), an optional list of opaque role strings:{ "id": "apply", "workflow_id": "apply-flow", "render_config_id": "apply-render", "read": { "roles": ["applicant", "reviewer"] } }StartTaskcopies them to the task asTaskRecord.ReadRoles. The gorm store writes them to atask_roles (task_id, role, case_id)table in the same transaction as the task row, so a task never exists without its roles. A host gates and lists tasks by joining its own record of who holds each role on(case_id, role). The roles never change after the task starts. A template with no read roles writes no rows. -
Caller-filtered actions (#378).
renderer.FactsgainsCommands map[string]bool: the commands the caller may issue, which the host resolves from the same rules its authz extension enforces. The zoneview renderer keeps a handle only if its command is legal in the state and allowed for the caller, so a visible section with no allowed actions renders read-only. nil means nothing is filtered.ZoneViewAssembler.Assembletakes aCaller{Claims, Commands}.
What each mechanism decides:
| Question | Decided by |
|---|---|
| Can the caller open the task? | read.roles, recorded in task_roles (#375) |
| Can the caller see a section? | visibleWhen.requireClaim (unchanged) |
| Can the caller take an action? | the commands authz allows, enforced on submit and reflected in Facts.Commands (#378) |
Breaking changes: hosts must create task_roles before upgrading (#375), and Assemble's signature changes (#378). Templates need no change.
Alternatives
- A separate, required
access_rolesfield on the task template. Dropped once #377 addedread.roles: two lists of who may read a task would drift from each other. - Roles with a permission each (e.g.
{"role": "read&write"}). Rejected. Whether a role may write is already answered per command by the authz rules, and a second answer would drift from them. It's also coarser: "write" can't tell approve apart from reject. - Roles as an array column on the task row. Rejected. Listing a caller's tasks needs a join and a B-tree index on
(case_id, role), which a row per role gives directly, along with idempotent inserts through the primary key. - Keep the task-to-role mapping only in the host. Possible, but the host would have to re-read templates and keep its copy in step with the task's manifest version. Recording roles when the task starts, in the same transaction as the row, avoids both.
- Lenguaje dominante
- Go
- Estrellas
- 6
- Forks
- 8
- Merge medio
- 21 h 36 min
- PR fusionados (30 d)
- 42
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenNSW/core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholdersAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
nsw-sl cleanup Type/Improvement
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
remote: let the host inject a logger, and log with one consistent policyPosiblemente ocupada @mushrafmim la tomó hace 5 días. AbiertoType/Improvement
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
Los mantenedores suelen responder en 1 día
Todos los issues de OpenNSW/core
Issues similares
-
agent-research-finding chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jordansmall/spindrift#7370 ·
Los mantenedores suelen responder en 1 día
-
☢️ Bug v3
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
The repo's gates check is clean and runs need no swapsPosiblemente ocupada @turbot-agent-fleet la tomó hoy. Abiertoagent:ready
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
turbot/tailpipe#677 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
needs-kind needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
crossplane-contrib/provider-keycloak#806 ·
Los mantenedores suelen responder en 1 día