Skip to content

fix(storage): allow unauthenticated participants to upload media into storage for public tests (#2286) - #2302

Open
chirag-gupta-07 wants to merge 1 commit into
ruxailab:developfrom
chirag-gupta-07:2286-fix-allow-anonymous-storage-uploads
Open

fix(storage): allow unauthenticated participants to upload media into storage for public tests (#2286)#2302
chirag-gupta-07 wants to merge 1 commit into
ruxailab:developfrom
chirag-gupta-07:2286-fix-allow-anonymous-storage-uploads

Conversation

@chirag-gupta-07

Copy link
Copy Markdown

Description

Resolves an issue where unauthenticated / anonymous participants could not upload screen, audio, or video recordings during public user tests due to restrictive Firebase Storage security rules and unconfigured storage initialization in media recorder components.

Problem

  1. Firebase Storage Security Rules: storage.rules did not allow unauthenticated access to the test upload paths (tests/{studyId}/{userId}/...) even when the test was configured as public (study.isPublic == true). This resulted in 403 Forbidden (storage/unauthorized) errors when submitting recordings.
  2. Storage Instance Initialization: Media recorder components (ScreenRecorder.vue, AudioRecorder.vue, VideoRecorder.vue) were calling getStorage() directly without configuration, causing requests to route to production Firebase Storage instead of the configured emulator, triggering CORS failures.
  3. Screen Recording Filename: ScreenRecorder.vue was not generating a valid timestamped .webm filename, causing upload path issues.

Related Issue

Fixes #2286


Changes Made

  • storage.rules: Added study(studyId).isPublic == true check to canAnswerStudy and match /tests/{studyId}/{userId}/{allPaths=**} to allow unauthenticated read and upload access for public studies.
  • ScreenRecorder.vue:
    • Imported and used the configured storage instance from @/app/plugins/firebase.
    • Updated filename generation to format as unique timestamped .webm (${Date.now()}.webm).
  • AudioRecorder.vue & VideoRecorder.vue:
    • Imported and used the configured storage instance from @/app/plugins/firebase.

How to Test

  1. Start the development/emulator environment.
  2. Create an unmoderated User Test and set it to Public in the Settings tab.
  3. Add a Task with Screen Recording enabled.
  4. Open the participant link in an Incognito / Private Window (without being logged in).
  5. Complete the task, allow screen recording, and submit.
  6. Verify that the recording uploads successfully without any 403 or CORS errors and the .webm file is present in Firebase Storage.

Video Proof

Part 1-

Part.1.mp4

Part 2-

Part.2.mp4
Screenshot 2026-08-19 000907

@sonarqubecloud

Copy link
Copy Markdown

@chirag-gupta-07

Copy link
Copy Markdown
Author

@KarinePistili Take a look at this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: improve Firestore and Storage rules for anonymous users and legacy data

1 participant