OpenLake / OpenLake/Student_Database_COSA
Security: unrestricted mass-assignment on event update lets a club coordinator bypass president-only approvals and tamper with budget
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.js—router.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.jsonly 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[].statusto"Approved", bypassing the dedicated PRESIDENT-only approval route (PATCH /room-requests/:requestId/status, gated byauthorizeRole("PRESIDENT")) sitting right above it in the same route file. - Directly edit
budget.allocated/budget.spenton 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
winnersorparticipants.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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