quadratic-funding / mpc-phase2-suite

The MPC suite of tools for conducting zkSNARK Phase 2 Trusted Setup ceremonies
MIT License
16 stars 6 forks source link

generatePreSignedURL should restrict access to ceremonies buckets only #309

Closed ctrlc03 closed 1 year ago

ctrlc03 commented 1 year ago

Currently, the generatePreSignedURL cloud function allows to generate a pre-signed URL for any bucket/object combination.

Buckets are used to store ceremonies data only, and are named:

A possible solution could be to use the bucket name (passed in as parameter to the cloud function) to retrieve the ceremony prefix (this requires the postfix to be added in the .env of the backend package). With the ceremony prefix we can query the ceremonies collection to see if any ceremony is in the db with this prefix. If there is a match, then we generate the pre-signed URL. No checks on the object key is done as any object stored inside the bucket should not be sensitive (circuits data, zkeys, etc.).

This prevents users to get pre-signed URLs for any bucket/object combination within the coordinator AWS account, if any.