Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range queries for undefined start or end bytes fails due to regex #182

Open
tbaeg opened this issue Feb 1, 2024 · 3 comments
Open

Range queries for undefined start or end bytes fails due to regex #182

tbaeg opened this issue Feb 1, 2024 · 3 comments

Comments

@tbaeg
Copy link

tbaeg commented Feb 1, 2024

Problem:

Range queries without a start or end byte range fail due to https://github.com/aws/amazon-s3-encryption-client-java/blob/main/src/main/java/software/amazon/encryption/s3/legacy/internal/RangedGetUtils.java#L21.

Solution:

Adjust the regex to allow for start or end byte range to not exist.

@tbaeg
Copy link
Author

tbaeg commented Feb 1, 2024

This will likely need adjustments to the lower/upper bound calls to support ranges without a start or end.

@imabhichow
Copy link
Contributor

Hello @tbaeg,

We've released a fix on 3.1.2 which allows the range to specify only the starting bytes without ending range

However, adding a feature to S3EC for range queries that only specify an end range, such as retrieving the last 20 bytes of a file, is difficult due to how encryption works. The S3EC supports decryption of objects encrypted using either AES-CBC or AES-GCM for content encryption. For GCM objects, an authentication tag is appended to the object. The content type is pulled from the object metadata, so it is not possible for the client to determine which algorithm is used before adjusting the range from the plaintext range to ciphertext range. It is possible to, for example, pull down additional bytes assuming GCM encryption, then discard the extra bytes if the algorithm is actually CBC. However, this is not trivial to implement, and will need be prioritized against other work. Currently, this feature is not on our immediate roadmap.

@tbaeg
Copy link
Author

tbaeg commented Mar 30, 2024

Thank you for the work and the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants