Security reference says standard users cannot read any data and unannotated routes default to admin-only
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
docs/en/5-reference/5.1-security.md と apps/api/src/auth/ability.factory.ts、apps/api/src/auth/guards/jwt-auth.guard.ts を読み、ロールの権限とルートがない場合の動作を確認してください。Standard User に対して記載されているアクセス権を更新し、@RouteAccess のないルートは 500 エラーになることを説明してください。また、テキストに payload の lint-rule に関する注記も反映されていることを確認してください。参照ドキュメントがこれらのソースと一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The Security reference misstates what the Standard User role can read and what happens to a route with no @RouteAccess. It says standard users "are not able to access any data" and "are only allowed to administer instruments". AbilityFactory gives the STANDARD role read Subject and read Session in their groups, and read Group too. So a standard user can list every subject in their groups, including the stored names, dates of birth and sex (GET /v1/subjects), and every session there with its subject embedded (GET /v1/sessions). For a route with no route access defined, the page also says "the default is manage and all", so only an admin may call it. JwtAuthGuard instead logs an error and throws a 500 for every caller, including admins. An admin deciding which role to give a research assistant uses this page to judge exposure. As written, it understates what the default role can see.
Where
docs/en/5-reference/5.1-security.md:28, :38 and :50-52:
... If there is no route access explicitly defined for a given route, the default is `manage` and `all`.
...
... If a route does not have any required permission set specified, the user must have permission to manage all resources to have access (i.e., the platform admin). ...
...
#### Standard User
By default, standard users are not able to access any data. They are only allowed to administer instruments, and download the record once complete (as it is stored in memory at that time).
apps/api/src/auth/ability.factory.ts:78-88:
case 'STANDARD':
ability.can('read', 'Group', { id: { in: groupIds } });
ability.can('read', 'Instrument');
ability.can('create', 'InstrumentRecord');
ability.can('create', 'InstrumentRecordFile', { groupId: { in: groupIds } });
ability.can('read', 'Session', { groupId: { in: groupIds } });
ability.can('create', 'Session');
ability.can('create', 'Subject');
ability.can('read', 'Subject', { groupIds: { hasSome: groupIds } });
ability.can('read', 'User', { id: payload.id });
apps/api/src/auth/guards/jwt-auth.guard.ts:31-34:
if (!routeAccess) {
this.loggingService.error(`Route access is not defined for url: ${request.url}`);
throw new InternalServerErrorException();
}
Reproduce
- Create a user with the Standard User role in a group that has subjects identified by personal information.
- Sign in as that user and call
GET /v1/subjects?groupId=<group>andGET /v1/sessions?groupId=<group>.
Actual: both return the group's subjects (with firstName, lastName, dateOfBirth, sex) and its sessions.
Expected (per the page): no data is returned.
Tests
docs/ has no test runner (docs/AGENTS.md). Review the corrected text against ability.factory.ts and jwt-auth.guard.ts.
Suggested fix
Rewrite "Standard User" to list what the role holds: it can create subjects, sessions and records, and it can read the subjects, sessions and group of its own groups, but not instrument records. Replace both "default is manage all" sentences with what the guard does: a route without @RouteAccess fails with 500 for everyone, and eslint (REQUIRE_ROUTE_ACCESS) refuses such a route at lint time.
- 主要言語
- TypeScript
- スター
- 119
- フォーク
- 19
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 56
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DouglasNeuroInformatics/OpenDataCapture のほかの issue
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
メンテナーはふだん 1 日以内に返信
-
Area: Instruments Bug Difficulty: Low Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
メンテナーはふだん 1 日以内に返信
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
メンテナーはふだん 1 日以内に返信
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
メンテナーはふだん 1 日以内に返信
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
メンテナーはふだん 1 日以内に返信
DouglasNeuroInformatics/OpenDataCapture の issue をすべて見る
似ている issue
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
maniator/verticopolis#880 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
siyuan-note/siyuan#20353 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
black-forest-labs/skills#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Albert-Weasker/niubigeo#168 ·
メンテナーはふだん 1 日以内に返信