Skip to content

Enforce per-user ownership on survey media in Storage rules #2578

Description

@rfontanarosa

Media authorization in storage/storage.rules is survey-scoped, while the equivalent Firestore rules are owner-scoped.

Storage rules authorize media at survey level, not owner level:

  • Reads leak: allow read: if canViewSurvey() ignores canViewDataCollectedByOthers, and read includes list — any collector can list and download everyone's photos, even when Firestore hides their submissions.
  • Writes can't be owner-scoped: Authorize user-media writes at the survey level #2576 had to fall back to organizer-only for update/delete, so owners can't manage their own media.

Cause: the upload path user-media/surveys/{surveyId}/submissions/{taskId}-{uuid}.jpg carries no user or submission ID, and putFile() sets no metadata. The owner is in Firestore (submission['5']) but only reachable submission → path; rules can't query.

Fix: add {submissionId} to the upload path (ground-android) so rules can do an exact firestore.get() and mirror firestore.rules:206-215. Needs a migration for existing objects.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: frRequest for new featurewebAngular implementation of Web UI

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions