Skip to content

Improve access denial messages for task assignments - #5437

Open
ajrbyers wants to merge 1 commit into
r-v1.9.xfrom
b-2970-permission-denied-messages-1.9
Open

Improve access denial messages for task assignments#5437
ajrbyers wants to merge 1 commit into
r-v1.9.xfrom
b-2970-permission-denied-messages-1.9

Conversation

@ajrbyers

Copy link
Copy Markdown
Member

Closes #2970

Adds options for decorators to pass messages to deny_access. Most security decorators now determine a reason for the user being denied access in such a way that they do not leak whether the assignment exists or not when that particular user isnt the owner of the task.

… Denied

Task links opened with the wrong account signed in gave no clue what was
wrong. Each denial now names the account making the request and what it
would take to get in, without ever naming the account a task belongs to.

Assignment lookups are scoped to the account and the journal in the URL,
so a task belonging to somebody else, one on another journal and one that
does not exist are answered identically and cannot be told apart.

Staff no longer pass reviewer_user_for_assignment_required. The views
behind it fetch the assignment again filtered by reviewer=request.user,
so admitting staff only moved the failure into the view, where it was
reported as the review not belonging to them. Staff read reviews through
the editor pages. Two tests that asserted the old behaviour are updated.
@ajrbyers
ajrbyers force-pushed the b-2970-permission-denied-messages-1.9 branch from a1a91b5 to 2a3e266 Compare August 14, 2026 14:23
@ajrbyers
ajrbyers requested a review from mauromsl August 14, 2026 14:31

@mauromsl mauromsl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new error messages and will improve useability when facing these 403 screens.

Added a couple minor comments inline regarding the changes to the security checks. In general I prefer the default return on these to be deny_access and the conditional logic to be the allow flag, somehow it gives me higher confidence even though all you've done is apply de morgan's law, so they should be equivalent :D

Comment thread src/security/decorators.py
Comment thread src/security/decorators.py
Comment thread src/security/decorators.py
Comment thread src/security/decorators.py
@mauromsl mauromsl assigned ajrbyers and unassigned mauromsl Aug 20, 2026
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.

2 participants