Skip to content

Fix - Enforce activity ownership verification on media upload endpoint - #2380

Merged
Intenzi merged 3 commits into
developfrom
fix/media-upload-verification
Oct 13, 2026
Merged

Intenzi merged 3 commits into
developfrom
fix/media-upload-verification

Conversation

@Intenzi

@Intenzi Intenzi commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

When media is uploaded via RTMediaUploadEndpoint, callers can pass an optional client-supplied activity_id parameter. Prior to this fix, rtMedia accepted this parameter without verifying whether the currently logged-in user actually created or owned that target activity.

This PR introduces an explicit activity ownership check before accepting a client-supplied activity_id. If the acting user is not the author of that activity, the parameter is rejected and rtMedia safely falls back to creating a brand-new activity for the upload, preventing unauthorized activity overwrites.


Details

  • Verifies $_activity_id using bp_activity_get_specific() to ensure the current logged-in user is the author of the target activity.
  • Only sets activity_id when verification succeeds. If unauthorized or invalid, assignment is skipped, allowing the upload to proceed through the default standalone media flow.

@Intenzi Intenzi self-assigned this Oct 12, 2026
@Intenzi
Intenzi marked this pull request as ready for review October 12, 2026 09:48
@Intenzi
Intenzi requested a review from the-hercules October 12, 2026 09:48
@the-hercules
the-hercules requested a balanced review from Copilot October 12, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unauthorized IDs remain in the upload payload, and anonymous users can match userless activities.

2 open findings
What changed in this PR

Adds ownership verification before attaching uploads to a client-supplied BuddyPress activity.

Changes:

  • Fetches the requested activity.
  • Compares its author with the current user.
  • Falls back when verification fails.
File Description
app/​main/​controllers/​upload/​RTMediaUploadEndpoint.php Adds activity ownership validation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread app/main/controllers/upload/RTMediaUploadEndpoint.php
Comment thread app/main/controllers/upload/RTMediaUploadEndpoint.php Outdated
@rtBot

rtBot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Unable to PHPCS or SVG scan one or more files due to error running PHPCS/SVG scanner:

  • app/main/controllers/upload/RTMediaUploadEndpoint.php

The error may be temporary. If the error persists, please contact a human (commit-ID: 459a282).

@Intenzi
Intenzi merged commit 4ec5668 into develop Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants