Check X-Amz-Content-Sha256
header #218
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#218
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is your feature request related to a problem? Please describe.
It is possible to pass invalid
X-Amz-Content-Sha256
as in Mint's test here.Describe the solution you'd like
Support signed payloads as it described in https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html, look for
Signed payload option
.If we want to support signed payloads, we must take into account that this can reduce performance, especially if the file size is quite large. This may happen due to the fact that we will have to read the payload twice (once to calculate the checksum of the payload for signing and subsequent verification, and once for transmission) or buffer them in memory.
frostfs-node already validates payload hash, which is also sha256, so we will receive an error.
2 things to think about:
As mentioned above, frost's-node already contains validation of the payload hash. However, if we want to use this, then there are several problems:
Client cut:
When using client cut, the payload hash is calculated in transformer from SDK . If we receive a request with a pre-signed URL, where the signed payload will be invalid (for example, as in mint test). Then when requesting a gate to put an object (with an invalid hash to the payload), the invalid hash will be overwritten in the SDK transformer and as a result we will not receive a hash validation error from frostfs-node.
Server cut:
When using server cut, we also won't be able to get an error from the frosts-node hash validator, since it won't execute.
@alexvanin @dkirillov
As we discussed with @r.loginov , @fyrchik , @dkirillov, in this issue we won't use any optimizations from storage side, because they require some fixes in transformer (see previous comment) and maybe some tweaks on storage side for server-side cutting. Also, these optimization work for non-split objects only (with the size of < than MaxObjectSize in the network configuration).
In this issue we will not cover all use-cases for
X-Amz-Content-Sha256
checking. It requires different approaches for encrypted and non-encrypted payload. So in this issue:X-Amz-Content-Sha256
format before accepting the requestX-Amz-Content-Sha256
for non-encrypted payload. Hash is calculated during object put operation. If value is not the same, then do a rollback by removing upload object. See md5 hashsum check rollback here.r.loginov referenced this issue2023-11-13 08:17:39 +00:00