(Translated by https://www.hiragana.jp/)
Set outputLength correctly on open ended range requests to encryptedBlobStore by ptemarvelde · Pull Request #706 · gaul/s3proxy · GitHub
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

Set outputLength correctly on open ended range requests to encryptedBlobStore #706

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ptemarvelde
Copy link

@ptemarvelde ptemarvelde commented Oct 11, 2024

This resolves #698.

Open ended ranged requests to encrypted files resulted in incorrect Content-Length headers in the response because of a bug in the Decryption class.

In EncryptedBloBStore the length is set to -1 by default. On open-ended ranged GET requests this value is passed to the Decryption constructor, which in turn only sets outputLength if an offset is given without a length, but -1 is used to represent no length given. After this change the outputLength is set correctly in this constructor.

https://github.com/gaul/s3proxy/blob/master/src/main/java/org/gaul/s3proxy/EncryptedBlobStore.java#L375

@gaul The tests pass (locally) but I have not spend enough time with this codebase to reason about whether this change will break anything else (which is currently untested). Is this a reasonable solution for #698?

@gaul
Copy link
Owner

gaul commented Oct 11, 2024

Can you add a unit test that demonstrates this problem? I wonder how does encryption work for range requests? I would imagine that S3Proxy needs to decrypt either the entire object or at least whatever the encryption block size is. CC @FlorinPeter who wrote the original code.

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

Successfully merging this pull request may close these issues.

[Bug] Incorrect Content-Length in Response Headers for Range Requests on Encrypted Files
2 participants