Security reference says standard users cannot read any data and unannotated routes default to admin-only
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- authorization, documentation
Research direction
Read docs/en/5-reference/5.1-security.md alongside apps/api/src/auth/ability.factory.ts and apps/api/src/auth/guards/jwt-auth.guard.ts to verify the role permissions and missing-route behavior. Update the stated Standard User access and explain that a route without @RouteAccess fails with a 500; confirm the text also reflects the payload’s lint-rule note. Done when the reference matches those sources.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 19
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 56
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Maintainers usually reply within 1 day
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
cockpit-project/cockpit-machines#2835 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/kumo#866 ·
Maintainers usually reply within 1 day
-
area:connector bug
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
environment: OPENCODE_API_KEY is described as a Console service account key, but a Go subscription key worksPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tester-army/e2e#1015 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day