Skip to content

Private project assets exposed without authorization check #3904

@Nixxx19

Description

@Nixxx19

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

  1. Create a project and set visibility to Private.
  2. Add an asset (e.g. image) to the project.
  3. While logged out (or as another user), open the asset URL: e.g. https://editor.p5js.org/full/<project_id>/<asset_path>.
  4. 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.url

Metadata

Metadata

Assignees

Labels

BugError or unexpected behaviors

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions