H2 - Implement Mass-Assignment and IDOR Fixes in RequestsController#469
Open
cycomachead wants to merge 1 commit into
Open
H2 - Implement Mass-Assignment and IDOR Fixes in RequestsController#469cycomachead wants to merge 1 commit into
cycomachead wants to merge 1 commit into
Conversation
- Remove :user_id from permitted params to prevent ownership hijacking - Scope assignment lookups to the current course to prevent cross-course IDOR - Verify student enrollment before allowing instructors to file requests - Offset User factory sequence to prevent UID collisions in tests Co-authored-by: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
General Info
Changes
Addresses two security vulnerabilities identified in an earlier audit of
RequestsController:Mass-assignment fix
Removed
:user_idfrom therequest_paramspermit list. Previously, a student could pass auser_idin the request body to file or reassign a request under another user's identity. Ownership is now set explicitly by the controller (user: @userincreate,user: studentincreate_for_student).IDOR fixes
assignment_in_course?helper that scopes assignment lookups to the current@course'sCourseToLmsrecords. Without this, a user could pass anassignment_idfrom a different course and have it silently accepted. This guard is applied increate,update, andcreate_for_student.student_enrolled_in_course?helper that verifies the target student has astudentenrollment in@coursebefore an instructor can file a request on their behalf increate_for_student. Previously, any validuser_idwould be accepted regardless of course membership.Incidental factory fix
Offset the
canvas_uidsequence in the User factory by100_000to prevent collisions with low literal UIDs (e.g.'123','566') used directly in existing specs.Testing
Added a
Mass-assignment and IDOR protectionsdescribe block tospec/controllers/requests_controller_spec.rbcovering:user_idincreateparams is ignored; request is assigned to the authenticated userassignment_idis rejected increate,update, andcreate_for_studentcreate_for_studentrejects an unenrolled student and succeeds for an enrolled oneFull non-feature suite: 431 examples, 0 failures.
Documentation
No additional documentation required. These are security hardening changes with no user-facing behavior changes for legitimate use cases.
Checklist
Superconductor Ticket Implementation | App Preview | Guided Review