Skip to content

fix(backlog): enforce task access on bulk update, create, comments and lookups - #35

Merged
somaraj merged 1 commit into
developfrom
fix/backlog-authorization
Dec 1, 2026
Merged

somaraj merged 1 commit into
developfrom
fix/backlog-authorization

Conversation

@somaraj

@somaraj somaraj commented Dec 1, 2026

Copy link
Copy Markdown
Member

What and why

Several Backlog actions checked only the Backlog permission, not whether the user belongs to the task's project. Any signed-in user with that permission could read or change tasks in other projects by calling them directly.

Action Before Now
BatchUpdate (POST) no permission attribute and no per-task check requires ManageBacklog; only tasks the user can edit (CanEditTaskAsync) are updated, and the response counts the skipped ones
Create (POST) no project check same rule as the Create page: reporting, edit or close rights in the chosen project
CommentCreate any task, including pushing to the linked issue only tasks the user can see (CanViewTaskAsync)
Comments, History, Documents any task CanViewTaskAsync, otherwise the access-denied partial
GetParentTasks, ExportReleaseToExcel every project's tasks filtered to tasks the user can see
SearchBranches, GetClosingCommentStatus any task CanViewTaskAsync

"Can see" is now one pure rule, Core.Common.TaskVisibility.CanSee: project member, plus either "view others' tasks" or being the task's developer or tester. That is the same rule as CanViewTaskAsync and the backlog grid.

The comment box now shows the server's message when a comment is refused, instead of adding it to the list.

Not changed: the project-member flag Can comment is still not enforced (it never was). Enforcing it could block people who comment today, so it's left for a separate decision.

How it was tested

  • dotnet build src/Taskist.sln and dotnet test src/Taskist.sln pass: 442 tests, 5 new in TaskVisibilityTests.
  • 14 end-to-end checks against the running app on a fresh database, with a non-member, a member, and a member who can see but not edit others' tasks:
    • non-member: bulk update, comment, create, comments/history/documents, parent search and branch search are all refused or empty
    • partial bulk update: only the editable task changes, and the message reports the skipped one
    • members: bulk update, comments, the comments panel and parent search still work

Checklist

  • dotnet build src/Taskist.sln and dotnet test src/Taskist.sln pass
  • Entity changes come with an EF migration, and the migration is additive (n/a, no schema change)
  • New UI text is added to sql-scripts/03_locale.sql (Backlog.NotAuthorizedViewMsg, Backlog.BatchUpdate.Skipped)
  • New menu entries or permissions are added to sql-scripts/02_defaults.sql (n/a)
  • No inline scripts or styles, no CDN links, no ViewBag/ViewData, no comments in .cs files
  • New dependencies are MIT, Apache or BSD licensed (n/a)
  • This touches authentication, authorization, file uploads, outbound HTTP or query building: authorization only, as described above

…d lookups

Bulk update requires the Backlog permission and only changes tasks the user can edit. Create requires reporting rights in the chosen project. Comments, history and the attachment list are limited to tasks the user can see, and comments are only accepted there. Parent-task search, release export and branch search leave out tasks the user can't see.
@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

@somaraj
somaraj merged commit f0cd378 into develop Dec 1, 2026
4 checks passed
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