taskflow: task read roles and caller-filtered actions
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 12/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 6
- Fork
- 8
- Merge medio
- 21h 36m
- PR unite (30g)
- 42
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenNSW/core
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholdersAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
nsw-sl cleanup Type/Improvement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
remote: let the host inject a logger, and log with one consistent policyForse già presa @mushrafmim l’ha presa 5 giorni fa. ApertaType/Improvement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenNSW/core
Issue simili
-
agent-research-finding chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jordansmall/spindrift#7370 ·
I maintainer di solito rispondono entro 1 giorno
-
☢️ Bug v3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
The repo's gates check is clean and runs need no swapsForse già presa @turbot-agent-fleet l’ha presa oggi. Apertaagent:ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
turbot/tailpipe#677 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
needs-kind needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
crossplane-contrib/provider-keycloak#806 ·
I maintainer di solito rispondono entro 1 giorno