OpenLake / OpenLake/Student_Database_COSA

Security: unrestricted mass-assignment on event update lets a club coordinator bypass president-only approvals and tamper with budget

Open
#259 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13
Forks
58
Avg merge
20h 27m
Merged PRs (30d)
3

Description

Summary

PUT /api/events/:eventId writes the entire request body straight into the Event document with no field whitelist, and is only gated by an "is this unit's coordinator" check — not by what fields are being changed.

Location

  • Route: backend/routes/events.jsrouter.put("/:eventId", isAuthenticated, isEventContact, eventsController.updateEvent)
  • Controller: backend/controllers/eventControllers.js, updateEvent (around line 215-233) — const updates = req.body; ... Event.findByIdAndUpdate(eventId, updates, { new: true, runValidators: true })
  • Middleware: backend/middlewares/isEventContact.js only verifies the caller's login email matches the organizing unit's contact email (i.e. that unit's CLUB_COORDINATOR account) — it says nothing about which fields on the event that contact is allowed to touch.

Impact

A CLUB_COORDINATOR — a mid-tier role, not an admin — can use this single endpoint to:

  • Directly set room_requests[].status to "Approved", bypassing the dedicated PRESIDENT-only approval route (PATCH /room-requests/:requestId/status, gated by authorizeRole("PRESIDENT")) sitting right above it in the same route file.
  • Directly edit budget.allocated / budget.spent on the event, bypassing the properly session-guarded, audited BudgetTransaction system entirely (no transaction record, no balance validation).
  • Reassign the event to a different organizing_unit_id.
  • Inject arbitrary entries into winners or participants.

Suggested fix

Whitelist the fields updateEvent is allowed to write (title, description, schedule, registration, media, etc.) and explicitly exclude budget, room_requests, organizing_unit_id, and winners — those already have (or should have) their own properly-authorized endpoints.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PUT route in backend/routes/events.js, then read updateEvent in backend/controllers/eventControllers.js and isEventContact.js. Compare the fields accepted there with the PRESIDENT-only room-request route and the BudgetTransaction flow. Done means ordinary event edits still work while budget, room_requests, organizing_unit_id, and winners cannot be changed through this endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
authorization, backend-api-design, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.