mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-02-14 00:42:10 +02:00
[#6313] enforced when_required for the new aws sdk request and response cheksum validations
This commit is contained in:
parent
2124b77a2a
commit
7da875be14
@ -17,6 +17,9 @@
|
|||||||
- Soft-deprecated `Record.GetUploadedFiles` in favour of `Record.GetUnsavedFiles` to minimize the ambiguities what the method do ([#6269](https://github.com/pocketbase/pocketbase/discussions/6269)).
|
- Soft-deprecated `Record.GetUploadedFiles` in favour of `Record.GetUnsavedFiles` to minimize the ambiguities what the method do ([#6269](https://github.com/pocketbase/pocketbase/discussions/6269)).
|
||||||
(@todo update docs to reflect the `:unsaved` getter change)
|
(@todo update docs to reflect the `:unsaved` getter change)
|
||||||
|
|
||||||
|
- Enforced `when_required` for the new AWS SDK request and response checksum validations to allow other non-AWS vendors to catch up with new AWS SDK changes (see [#6313](https://github.com/pocketbase/pocketbase/discussions/6313) and [aws/aws-sdk-go-v2#2960](https://github.com/aws/aws-sdk-go-v2/discussions/2960)).
|
||||||
|
_You can set the environment variables `AWS_REQUEST_CHECKSUM_CALCULATION` and `AWS_RESPONSE_CHECKSUM_VALIDATION` to `when_supported` if your S3 vendor supports the new [new default integrity protections](https://docs.aws.amazon.com/sdkref/latest/guide/feature-dataintegrity.html)._
|
||||||
|
|
||||||
|
|
||||||
## v0.24.4
|
## v0.24.4
|
||||||
|
|
||||||
|
@ -36,6 +36,27 @@ type System struct {
|
|||||||
bucket *blob.Bucket
|
bucket *blob.Bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
|
var requestChecksumCalculation = aws.RequestChecksumCalculationWhenRequired
|
||||||
|
var responseChecksumValidation = aws.ResponseChecksumValidationWhenRequired
|
||||||
|
|
||||||
|
// @todo consider removing after the other non-AWS vendors catched up with the new changes
|
||||||
|
// (https://github.com/aws/aws-sdk-go-v2/discussions/2960)
|
||||||
|
func init() {
|
||||||
|
reqEnv := os.Getenv("AWS_REQUEST_CHECKSUM_CALCULATION")
|
||||||
|
if reqEnv != "" && strings.EqualFold(reqEnv, "when_supported") {
|
||||||
|
requestChecksumCalculation = aws.RequestChecksumCalculationWhenSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
resEnv := os.Getenv("AWS_RESPONSE_CHECKSUM_VALIDATION")
|
||||||
|
if resEnv != "" && strings.EqualFold(resEnv, "when_supported") {
|
||||||
|
responseChecksumValidation = aws.ResponseChecksumValidationWhenSupported
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
// NewS3 initializes an S3 filesystem instance.
|
// NewS3 initializes an S3 filesystem instance.
|
||||||
//
|
//
|
||||||
// NB! Make sure to call `Close()` after you are done working with it.
|
// NB! Make sure to call `Close()` after you are done working with it.
|
||||||
@ -60,6 +81,9 @@ func NewS3(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.RequestChecksumCalculation = requestChecksumCalculation
|
||||||
|
cfg.ResponseChecksumValidation = responseChecksumValidation
|
||||||
|
|
||||||
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
|
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
|
||||||
// ensure that the endpoint has url scheme for
|
// ensure that the endpoint has url scheme for
|
||||||
// backward compatibility with v1 of the aws sdk
|
// backward compatibility with v1 of the aws sdk
|
||||||
|
Loading…
x
Reference in New Issue
Block a user