-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
BugError or unexpected behaviorsError or unexpected behaviors
Description
p5.js version
latest
What is your operating system?
Mac OS
Web browser and version
all
Actual Behavior
getProjectAsset() serves project assets (files, images) for any project ID without checking visibility. Anyone who knows or guesses a project ID can access Private project assets. Project listing correctly filters by visibility; this endpoint does not.
Location: server/controllers/project.controller.js lines 104–137
Vulnerable routes: /full/:project_id/*, /embed/:project_id/*, /:username/sketches/:project_id/*, /present/:project_id/*
Expected Behavior
Private project assets should be served only to the project owner (or not at all for unauthenticated users). Public projects may be served to anyone.
Steps to reproduce
- Create a project and set visibility to Private.
- Add an asset (e.g. image) to the project.
- While logged out (or as another user), open the asset URL: e.g.
https://editor.p5js.org/full/<project_id>/<asset_path>. - Observe that the private asset is returned (200) instead of 403.
Snippet:
// server/controllers/project.controller.js - getProjectAsset()
// Currently no visibility check before serving:
const project = await Project.findOne({ $or: [{ _id: projectId }, { slug: projectId }] })...
// ... then directly serves resolvedFile.content or fetches resolvedFile.urlReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugError or unexpected behaviorsError or unexpected behaviors