[taskflow] Give hosts a task's read roles so they can check access to its detail
メンテナーはふだん 1 日以内に返信
@mushrafmim がすでに取り組んでいます。
2026年11月3日 から。
評価
この issue はまだ評価されていません。
説明
Current Limitation
Taskflow never decides who may read a task, so a host checks access itself. A listing goes through TaskManager.GetTasks with TaskFilter.Roles, which matches the caller's roles against the task's read roles in SQL. A single task's detail, TaskManager.GetTaskRenderInfo(ctx, taskID), checks nothing. frontend-guide.md says the host must first check "that the caller holds one of the task's read roles (TaskRecord.ReadRoles, stored in taskflow_task_roles) in the task's case", because a caller can request any task ID directly.
No TaskManager method lets a host do that check:
TaskView, whichGetTaskRenderInforeturns, has neither the task'sCaseIDnor its read roles.- In the store,
GetTaskandGetTaskByWorkflowIDfill everyTaskRecordfield exceptReadRoles. The roles live intaskflow_task_roles, and theTaskRecorddoc says "the read methods leave this field empty: a host that needs a task's roles reads them where InitTask stored them".
So the only way to do the required check is to query taskflow_task_roles directly. That ties every task-detail endpoint to the table, its columns and its name, outside the TaskManager API that hosts otherwise use. Hosts call TaskManager, not the store, which is the persistence port only the manager calls. A change to the table changes the host without a compile error, and a host that forgets the check exposes every task to anyone who can guess an ID.
Suggested Improvement
-
Store:
GetTaskandGetTaskByWorkflowIDreturnReadRoles, loaded fromtaskflow_task_rolesbytask_id(the leading column of its primary key).GetTaskskeeps leaving it empty, likeData: its role filter already runs in SQL, and a listing doesn't need the roles. -
Hosts: expose the check through
TaskManager, in one of two ways:- a. Match roles in
GetTaskRenderInfo(preferred). The host passes the roles the caller holds, as it does forGetTasks, and taskflow matches them by name, the same rule asTaskFilter.Matches. For example:
It returnsGetTaskRenderInfo(ctx context.Context, taskID string, roles []string) (TaskView, error)ErrTaskNotFound(or a dedicated error) when the caller holds none of the task's read roles. Taskflow still never decides who holds a role. A listing and a detail read then apply the same rule in one place, and the check can't be skipped by forgetting it. As withTaskFilter.Roles, a role the caller holds in only some cases must be passed only for a task in one of those cases; the host can check the case againstTaskView.CaseID(see b). - b. Return the inputs and let the host match. Add
CaseIDandReadRolestoTaskView, and the host compares them with its own record of who holds each role.TaskViewis what hosts send to clients, so decide whether these fields go over the wire or are taggedjson:"-".
Either way, update
frontend-guide.mdandintegration-guide.mdso no step tells a host to readtaskflow_task_roles. - a. Match roles in
This is a breaking change if (a) changes GetTaskRenderInfo's signature; a new method alongside it avoids that.
Version
910de31
Additional Context
- OpenNSW/core#383 makes hosts go through
TaskManagerfor finding and listing tasks (GetTaskswith the new step filter), and documents that hosts never call the store. This closes the same gap for a single task's access check. - If both land before the next release,
TaskStoreimplementations change once for both.
- 主要言語
- Go
- スター
- 6
- フォーク
- 8
- 平均マージ
- 21時間 36分
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenNSW/core のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholdersオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
nsw-sl cleanup Type/Improvement
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
remote: let the host inject a logger, and log with one consistent policy対応中かも @mushrafmim が 5 日前に担当しました。 オープンType/Improvement
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
agent-research-finding chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jordansmall/spindrift#7370 ·
メンテナーはふだん 1 日以内に返信
-
☢️ Bug v3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
The repo's gates check is clean and runs need no swaps対応中かも @turbot-agent-fleet が今日担当しました。 オープンagent:ready
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
turbot/tailpipe#677 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
needs-kind needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
crossplane-contrib/provider-keycloak#806 ·
メンテナーはふだん 1 日以内に返信