Skip to content

Add permission checks for moving engagements between products#14634

Draft
Jino-T wants to merge 6 commits intoDefectDojo:bugfixfrom
Jino-T:change-to-moving-engagements
Draft

Add permission checks for moving engagements between products#14634
Jino-T wants to merge 6 commits intoDefectDojo:bugfixfrom
Jino-T:change-to-moving-engagements

Conversation

@Jino-T
Copy link
Copy Markdown
Contributor

@Jino-T Jino-T commented Apr 3, 2026

  • When editing an engagement and changing its product (moving it to a different product), the system now
    verifies the user has Engagement_Edit permission on the destination product
  • This applies to both the API (PUT/PATCH on /api/v2/engagements/{id}/) and the UI (edit engagement
    form)
  • Adds 8 new tests covering authorized moves, unauthorized moves, same-product updates, and partial
    updates without a product field

@github-actions github-actions bot added apiv2 New Migration Adding a new migration file. Take care when merging. labels Apr 3, 2026
Jino-T and others added 4 commits April 14, 2026 14:26
Reverting the approach of making Engagement.product editable=False
and splitting serializers. Will replace with proper permission checks
on the destination product when moving engagements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a user changes an engagement's product (via API PUT/PATCH or
the UI edit form), verify they have Engagement_Edit permission on
the destination product. Previously only the source product was
checked, allowing users to move engagements to products they lack
write access to.

- API: EngagementSerializer.validate() checks destination product
  permission on update, following the ProductMemberSerializer pattern
- UI: edit_engagement() view checks destination product permission
  before saving
- Tests: 8 new tests covering PATCH, PUT, and UI paths for both
  authorized and unauthorized product moves

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Maffooch Maffooch force-pushed the change-to-moving-engagements branch from 4e2c14c to b8a5c0f Compare April 14, 2026 20:44
@github-actions github-actions bot added unittests helm and removed New Migration Adding a new migration file. Take care when merging. labels Apr 14, 2026
@Maffooch Maffooch changed the base branch from dev to bugfix April 14, 2026 21:00
The EngForm product queryset is filtered to authorized products, so
submitting an unauthorized product fails form validation (200) before
the view-level permission check runs. Update the test to accept both
200 and 403 -- the key assertion is that the engagement does not move.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot removed the helm label Apr 14, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Maffooch Maffooch changed the title Change to moving engagements Add permission checks for moving engagements between products Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants