Skip to content

fix(notes): scope noteable lookup to the current practice - #1133

Open
raulriera wants to merge 1 commit into
masterfrom
fix/notes-practice-scoping
Open

fix(notes): scope noteable lookup to the current practice#1133
raulriera wants to merge 1 commit into
masterfrom
fix/notes-practice-scoping

Conversation

@raulriera

Copy link
Copy Markdown
Member

Summary

  • find_noteable constantized any *_id param and looked records up unscoped, so a logged-in user could create or destroy notes on another practice's patients (and instantiate arbitrary classes from crafted param names)
  • Notes routes are only nested under patients, so the lookup is now Patient.with_practice(current_user.practice_id).find(params[:patient_id]) — cross-practice requests raise RecordNotFound

Test plan

  • Red tests prove cross-practice note create and destroy succeed today
  • Green after fix
  • Full suite passes (524 runs, 0 failures)

find_noteable constantized any *_id param and looked it up unscoped, so
a logged-in user could attach or delete notes on another practice's
patients (and load arbitrary classes from crafted param names). Notes
are only nested under patients in routes, so resolve the patient
through the practice scope instead.
@github-actions github-actions Bot added the fix A bug has been resolved label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug has been resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant