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

XML submission checksum #1122

Merged
merged 3 commits into from
Sep 12, 2017
Merged

XML submission checksum #1122

merged 3 commits into from
Sep 12, 2017

Conversation

ukanga
Copy link
Member

@ukanga ukanga commented Sep 10, 2017

No description provided.

@ukanga ukanga requested review from pld and moshthepitt September 10, 2017 02:28
Store the checksum of a submission XML and use it to compare when
checking for changes/edits in the data.
@ukanga ukanga force-pushed the hash-xml-submission-check branch from 6f728bb to 180c4b9 Compare September 10, 2017 06:05
Copy link
Member

@pld pld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite awesome

@@ -279,10 +285,11 @@ def create_instance(username,
xml = xml_file.read()
xform = get_xform_from_submission(xml, username, uuid)
check_submission_permissions(request, xform)
checksum = md5(xml).hexdigest()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use sha256 here? I know we're not using it for something were collisions are a big deal right now, but since it's possible to construct collisions intentionally in md5 I'd prefer we do not use it anywhere

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the functionality we want, sha256 might be an overkill, the collision will be limited to the single form when it does occur.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there's a big performance penalty, it's worth it to reduce the chance of collisions and because it's concerning that someone can intentionally create a colliding document if we use md5

@@ -297,7 +304,7 @@ def create_instance(username,
# has already been submitted for that user.
return DuplicateInstance()

# get new and depracated uuid's
# get new and deprecated uuid's
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we're at it, UUIDs instead of uuid's, this is not a possessive

@ukanga ukanga merged commit 1bbedb3 into master Sep 12, 2017
@ukanga ukanga deleted the hash-xml-submission-check branch September 12, 2017 02:05
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.

3 participants