FEATURE: Make S3 presigned GET URL expiry configurable (#16912)

Previously we hardcoded the DOWNLOAD_URL_EXPIRES_AFTER_SECONDS const
inside S3Helper to be 5 minutes (300 seconds). For various reasons,
some hosted sites may need this to be longer for other integrations.

The maximum expiry time for presigned URLs is 1 week (which is
604800 seconds), so that has been added as a validation on the
setting as well. The setting is hidden because 99% of the time
it should not be changed.
This commit is contained in:
Martin Brennan
2022-05-26 09:53:01 +10:00
committed by GitHub
parent 08cd7a3849
commit 641c4e0b7a
9 changed files with 17 additions and 11 deletions

View File

@ -124,7 +124,7 @@ describe BackupRestore::S3BackupStore do
bucket = Regexp.escape(SiteSetting.s3_backup_bucket)
prefix = file_prefix(db_name, multisite)
filename = Regexp.escape(filename)
expires = S3Helper::DOWNLOAD_URL_EXPIRES_AFTER_SECONDS
expires = SiteSetting.s3_presigned_get_url_expires_after_seconds
/\Ahttps:\/\/#{bucket}.*#{prefix}\/#{filename}\?.*X-Amz-Expires=#{expires}.*X-Amz-Signature=.*\z/
end