-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support SHA1 rather than MD5 as a checksum on a per file basis #3354
A dependency for rsync support (#3145) is the ability to persist SHA-1 checksums for files rather than MD5 checksums. A new installation-wide configuration setting called ":FileFixityChecksumAlgorithm" has been added which can be set to "SHA-1" to have Dataverse calculate and show SHA-1 checksums rather than MD5 checksums. In order to run this branch you must run the provided SQL upgrade script: scripts/database/upgrades/3354-alt-checksum.sql In addition, the Solr schema should be updated to the version in this branch.
- Loading branch information
Showing
37 changed files
with
567 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ALTER TABLE datafile ADD COLUMN checksumtype character varying(255); | ||
ALTER TABLE datafile ALTER COLUMN checksumtype SET NOT NULL; | ||
UPDATE datafile SET checksumtype = 'MD5'; | ||
-- alternate statement for sbgrid.org and others interested in SHA-1 support | ||
-- note that in the database we use "SHA1" (no hyphen) but the GUI will show "SHA-1" | ||
--UPDATE datafile SET checksumtype = 'SHA1'; | ||
ALTER TABLE datafile RENAME md5 TO checksumvalue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
# existing, works, no files, commenting out | ||
#curl -s -X POST -H "Content-type:application/json" -d @scripts/search/tests/data/dataset-finch1.json "http://localhost:8080/api/dataverses/root/datasets/?key=$API_TOKEN" | ||
# new, has files | ||
curl -s -X POST -H "Content-type:application/json" -d @scripts/issues/3354/datasetWithSha1Files.json "http://localhost:8080/api/dataverses/root/datasets/?key=$API_TOKEN" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"datasetVersion": { | ||
"files": [ | ||
{ | ||
"label": "foo.txt", | ||
"dataFile": { | ||
"filename": "foo.txt", | ||
"contentType": "text/plain", | ||
"storageIdentifier": "157484f9d6c-c36006fa39e5", | ||
"originalFormatLabel": "UNKNOWN", | ||
"checksum": { | ||
"type": "SHA-1", | ||
"value": "f1d2d2f924e986ac86fdf7b36c94bcdf32beec15" | ||
} | ||
} | ||
} | ||
], | ||
"metadataBlocks": { | ||
"citation": { | ||
"fields": [ | ||
{ | ||
"value": "Dataset with SHA-1 files", | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "title" | ||
}, | ||
{ | ||
"value": [ | ||
{ | ||
"authorName": { | ||
"value": "Finch, Fiona", | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "authorName" | ||
}, | ||
"authorAffiliation": { | ||
"value": "Birds Inc.", | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "authorAffiliation" | ||
} | ||
} | ||
], | ||
"typeClass": "compound", | ||
"multiple": true, | ||
"typeName": "author" | ||
}, | ||
{ | ||
"value": [ | ||
{ "datasetContactEmail" : { | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "datasetContactEmail", | ||
"value" : "finch@mailinator.com" | ||
} | ||
}], | ||
"typeClass": "compound", | ||
"multiple": true, | ||
"typeName": "datasetContact" | ||
}, | ||
{ | ||
"value": [ { | ||
"dsDescriptionValue":{ | ||
"value": "Some people prefer SHA-1 to MD5 for file fixity.", | ||
"multiple":false, | ||
"typeClass": "primitive", | ||
"typeName": "dsDescriptionValue" | ||
}}], | ||
"typeClass": "compound", | ||
"multiple": true, | ||
"typeName": "dsDescription" | ||
}, | ||
{ | ||
"value": [ | ||
"Other" | ||
], | ||
"typeClass": "controlledVocabulary", | ||
"multiple": true, | ||
"typeName": "subject" | ||
} | ||
], | ||
"displayName": "Citation Metadata" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
# FIXME: Make this into a REST Assured test. | ||
curl -s "http://localhost:8080/api/mydata/retrieve?key=$API_TOKEN&role_ids=1&dvobject_types=DataFile&published_states=Published&published_states=Unpublished&published_states=Draft&published_states=In+Review&published_states=Deaccessioned" | jq .data.items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/bin/sh | ||
if [ -z "$1" ]; then | ||
curl -s 'http://localhost:8080/api/search?q=*' | ||
curl -H "X-Dataverse-key: $API_TOKEN" -s 'http://localhost:8080/api/search?q=*' | ||
#curl -s 'http://localhost:8080/api/search?q=*&key=pete' | ||
else | ||
# i.e. ./search 'q=*&fq=filetype_s:"image"&fq=dvtype:files' | ||
# i.e. ./search 'q=*&start=10' | ||
# i.e. ./search 'q=*&sort=name_sort&order=asc' | ||
# i.e. ./search 'q=*&sort=name_sort&order=asc' | jq '.itemsJson[] | {name_sort}' | ||
curl -s "http://localhost:8080/api/search?$1" | ||
curl -H "X-Dataverse-key: $API_TOKEN" -s "http://localhost:8080/api/search?$1" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.