Repository navigation
feat: Implement presigned URL generation for S3 and native cloud storage - #4806
mathis6787 wants to merge 1 commit into
Conversation
|
Hi @mathis6787 Generating temporary download URLs for private files is a reasonable feature request. However, this PR has several issues that would need to be addressed:
Before we invest more time on the API design here - what's your concrete use case? |
@mathis6787 Following @nielsenko question, the best workflow here following the contributing guidelines is to first open an issue with the request, describing your use case, so we can discuss on the best approach for a solution. This prevents a lot of back-and-forth during implementation. |
|
You're right I did the pr very quickly and I haven't review it before pushing it , I will rework that as soon as I can |
feat: Add
getPresignedUrltoCloudStorageinterface and implementationsDescription
Adds a
getPresignedUrlmethod to theCloudStorageabstract interface and implements it across all storage backends. Presigned URLs allow temporary authenticated access to files without requiring the client to have direct credentials — useful for secure file downloads, browser-direct uploads, and short-lived sharing links.Changes
Core (
packages/serverpod)getPresignedUrltoCloudStorageDatabaseCloudStoragethrowsUnsupportedError(database storage has no concept of signed URLs)StorageAccess(onSession) exposesgetPresignedUrlandgetPresignedUrlsfor bulk lookupsS3-compatible (
integrations/serverpod_cloud_storage_s3_compat)getPresignedUrl()toS3Clientusing AWS SigV4 query-string signing withUNSIGNED-PAYLOADS3CompatCloudStoragedelegates toS3Client— covers AWS S3, GCP (HMAC), Cloudflare R2, MinIO, LocalStack with a single implementationGCP native (
integrations/serverpod_cloud_storage_gcp)NativeGoogleCloudStorageimplementsgetPresignedUrlusing the existing GOOG4-RSA-SHA256 signing pathTesting
S3Client.getPresignedUrl(query params, expiration, methods, determinism, custom hosts)S3CompatCloudStorage.getPresignedUrl(file exists → URL returned, file missing →null)DatabaseCloudStorage.getPresignedUrl(throwsUnsupportedErrorwith correct message)Pre-launch Checklist
dart format .on all changed filesdart analyze --fatal-infoswith no issuesBreaking changes
None. This is an additive change only.