Skip to content

fix(contact): enforce employee contact edit permissions#10890

Open
ignatremizov wants to merge 1 commit into
hcengineering:developfrom
ignatremizov:fix/contact-rbac-hardening
Open

fix(contact): enforce employee contact edit permissions#10890
ignatremizov wants to merge 1 commit into
hcengineering:developfrom
ignatremizov:fix/contact-rbac-hardening

Conversation

@ignatremizov
Copy link
Copy Markdown
Contributor

fix(contact): enforce employee contact edit permissions

Summary

Regular users should be able to maintain their own contact details, but they should not be able to edit another employee's person record or attached communication channels. This change enforces that boundary in both the UI and the server transaction middleware.

Changes

  • Allow regular users to edit their own person/contact details and non-employee contacts.
  • Reject regular-user CUD transactions that update another employee Person or channels attached to that employee.
  • Apply the server-side check to nested TxApplyIf payloads so direct transaction bypasses are still blocked.
  • Reuse a shared contact editability helper in person editing, channel editors, and channel presenters so blocked channel actions are hidden or disabled.
  • Add middleware coverage for own-person edits, blocked cross-employee person/channel edits, and maintainer bypass behavior.

Testing

  • git diff --check upstream/develop..HEAD
  • node common/scripts/install-run-rush.js test -t @hcengineering/middleware
  • node common/scripts/install-run-rush.js build -t @hcengineering/middleware -t @hcengineering/contact-resources

Notes

  • rushx svelte-check in plugins/contact-resources was attempted, but this fresh upstream worktree currently fails on broad dependency/export type errors outside this patch.

Enforce contact edit boundaries for regular users on both the UI and transaction middleware so users can maintain their own profile details without being able to change other employees' person records or communication channels.

Changes:
- Reject regular-user CUD transactions that update another employee Person or channels attached to that employee, including nested TxApplyIf payloads.
- Allow regular users to edit their own contact details and non-employee contacts, while Maintainers and Owners continue to manage employee records.
- Share contact editability logic in contact resources and use it in person editing, channel editors, and channel presenters so the UI hides or disables blocked actions.
- Add middleware tests covering own-person edits, blocked cross-employee person/channel edits, and maintainer bypass behavior.

Validation:
- git diff --check
- rushx svelte-check in plugins/contact-resources
- targeted Rush tests for @hcengineering/middleware and @hcengineering/contact-resources
- targeted Rush build for @hcengineering/middleware and @hcengineering/contact-resources

Behavioral effect:
Regular users can update their own profile contact details, but attempts to edit another employee's person record or attached email, phone, or GitHub channels are blocked even if sent directly to the server.
@huly-github-staging
Copy link
Copy Markdown

Connected to Huly®: UBERF-16480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant