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

API: check md5 before accepting uploaded file from the client #2788

Closed
pdurbin opened this issue Dec 1, 2015 · 1 comment
Closed

API: check md5 before accepting uploaded file from the client #2788

pdurbin opened this issue Dec 1, 2015 · 1 comment
Labels

Comments

@pdurbin
Copy link
Member

pdurbin commented Dec 1, 2015

@pameyer originally brought this up at #952 (comment) but it deserves its own issue.

The SWORDv2 spec says we "The server SHOULD verify the Content-MD5 header against the content. If the check fails, the server MUST respond with 412 Precondition Failed, and MAY return a SWORD Error document" at http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_addingcontent

SHOULD is defined in http://www.ietf.org/rfc/rfc2119.txt as "SHOULD This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course." So we probably should. :)

I just looked at the addResource method in MediaResourceManagerImpl and the MD5 is available (assuming the client sends it, which we haven't encouraged at all) from deposit.getMd5(). That is to say, it should be pretty straightforward to check. Of course, we currently require that all files uploaded via API (SWORD) be zip files (see #1612 about how people want non-zips).

At #1612 (comment) I opined that we should develop a "native" API endpoint for uploading files so we won't be constrained by SWORD (and we certainty still should) but in this case SWORD has it right. We might as well start by adding checksum verification in our SWORD API since the spec compels us to do so. Then we can encourage clients to start sending checksums. The spec says, "The client SHOULD supply a Content-MD5 header with the MD5 checksum hex encoded for the binary content."

@pdurbin
Copy link
Member Author

pdurbin commented Jun 28, 2017

No one seems to be asking for this part of the SWORD spec to be implemented. Closing.

@pdurbin pdurbin closed this as completed Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant