Skip to content

review app - permission and validation hardening#1515

Open
davmlaw wants to merge 1 commit intomasterfrom
fix/review-app-security
Open

review app - permission and validation hardening#1515
davmlaw wants to merge 1 commit intomasterfrom
fix/review-app-security

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Closes part of SACGF/variantgrid_private#3827.

Changes

  • new_review() permission check: new_review() now calls review.check_can_view(request.user) before rendering, making it consistent with edit_review() which already did this.
  • Default lab filtering: The default lab pre-selection on a new review is now filtered to only include labs that are valid for the reviewed object, preventing a misleading pre-selection that would fail on submit.
  • MultiChoiceLabField validation: to_python() now raises a ValidationError on unrecognised lab PKs instead of a bare KeyError (which would produce a 500).
  • Deterministic source_object resolution: Added order_by('pk') to the .first() call so the result is stable rather than database-ordering-dependent.
  • Template {% csrf_token %} cleanup: Removed a spurious action="{{ request.path }}" attribute that Django silently ignores — the form already defaults to the current URL.

…ivate#3827

- new_review() now checks view permission before rendering, consistent with edit_review()
- Default lab pre-selection on new review filtered to only labs allowed for the reviewed object
- MultiChoiceLabField.to_python() raises ValidationError on invalid lab PKs instead of KeyError
- source_object resolution uses order_by('pk') for deterministic results
- Remove invalid action attribute from csrf_token template tag
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