Permission sets cannot confine instrument deletion to the holder's groups
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- authorization, backend-api-design, documentation
Hướng nghiên cứu
Start with packages/schemas/src/core/core.ts, apps/api/src/auth/ability.factory.ts, apps/api/prisma/schema.prisma, and the permission editor code named in the issue; read .agents/docs/architecture/auth-and-permissions.md and packages/schemas/AGENTS.md for the current scope rules. Trace how permission rules are validated, applied, and presented for Instrument, including the existing GROUP_MANAGER condition. Done means the chosen action and group scope behave consistently across schema, API, web, and documentation, with tests covering the read and delete behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
A permission set rule on Instrument can only have the scope "Every group". As a result, a set cannot grant deleting series instruments only within the holder's groups. The GROUP_MANAGER base level grants exactly that:
// apps/api/src/auth/ability.factory.ts
ability.can('delete', 'Instrument', { seriesGroupId: { in: groupIds } });
To let someone delete series instruments through a set, an admin has to add delete Instrument with ALL_GROUPS. InstrumentsService.deleteById filters only by the ability, so a holder of that set can delete any group's series instrument that has no records or assignments yet, not only their own groups' series.
Cause
packages/schemas/src/core/core.ts excludes Instrument from the subjects that can be confined to a group:
export const $GroupScopableSubjectName = $AppSubjectName.exclude(['all', 'Instrument']);
.agents/docs/architecture/auth-and-permissions.md gives the reason: an instrument is "a shared asset with no owning group". That holds for shared instruments but not for series instruments, which have seriesGroupId (apps/api/prisma/schema.prisma). That field was added in 87ce6b5d9, before this exclusion was written in 8c4cbeeed.
Every layer follows the exclusion:
- Schema:
$PermissionSetRuleand$UserPermissionreject a group scope onInstrument. - API:
GROUP_SCOPED_CONDITIONShas noInstrumententry, andgrantWithinthrows on one. - Web:
toPermissionSetRuleandPermissionSetRulesEditorforce and display "Every group".
Per-user additional permissions have the same gap, since they are checked against the same list.
Proposed fix
Make Instrument group-scopable with the condition { seriesGroupId: { in: groupIds } }. That condition matches what the group manager rule already uses.
Decision needed
With that condition, any HOLDER_GROUPS instrument rule matches only series owned by the holder's groups:
- For
delete, that is the intended meaning. - For
read, it would hide every shared instrument, which is almost certainly not what an admin choosing "Holder's groups" expects. createis already checked against the target group inInstrumentsService.
Options:
- Allow the group scope on
Instrumentfordeleteonly. The scopable check would then depend on the action as well as the subject, which is a bigger change to the schema and the editor. - Allow it for every action, and document in the editor what it means for
read.
Either way, the "shared asset with no owning group" rule in packages/schemas/AGENTS.md and .agents/docs/architecture/auth-and-permissions.md needs updating.
- Ngôn ngữ chính
- TypeScript
- Star
- 119
- Fork
- 19
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 61
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DouglasNeuroInformatics/OpenDataCapture
-
Area: API Bug Difficulty: Low Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: Infrastructure Bug Difficulty: Low Priority: Medium Security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DouglasNeuroInformatics/OpenDataCapture#1916 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: Instruments Bug Difficulty: Low Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DouglasNeuroInformatics/OpenDataCapture#1824 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Completing a series instrument logs a TypeError "Cannot read properties of undefined (reading 'kind')"Có thể đã có người làm @SAY-5 đã nhận 3 ngày trước. Đang mởArea: Shared Bug Difficulty: Low Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
DouglasNeuroInformatics/OpenDataCapture#1813 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DouglasNeuroInformatics/OpenDataCapture
Issue tương tự
-
infra needs-triage
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 82/100
LucasSantana-Dev/Lucky#3331 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
kOaDT/oss-oopssec-store#381 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nocobase/nocobase#11669 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS: Clear Context (/clear) and model picker fallback use negative agent check instead of isClaudeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày