-
Notifications
You must be signed in to change notification settings - Fork 134
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
XML submission checksum #1122
Conversation
Store the checksum of a submission XML and use it to compare when checking for changes/edits in the data.
6f728bb
to
180c4b9
Compare
There was a problem hiding this 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
onadata/libs/utils/logger_tools.py
Outdated
@@ -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() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
onadata/libs/utils/logger_tools.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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
No description provided.