Add functionality for verifying tarball signatures to automated ingestion scripts#208
Conversation
|
The staging PR for the test tarball was opened: https://github.com/EESSI/staging/pull/2544. Before merging that PR, I've manually changed the signature of the metadata file to verify that the ingestion would fail, and it did: Right now it only prints this in the log file, and continues. It should also open an issue in the staging repo, I'll have to add that. |
|
It now opens an issue if the verification fails, see https://github.com/EESSI/staging/issues/2545. |
|
Another test: I've uploaded a tarball and metadata file without signatures, and set |
trz42
left a comment
There was a problem hiding this comment.
Looks good.
- A few suggestions for naming attributes/variables. (if done would require renaming across the whole script.)
- A tiny typo.
- Question about logic when to return False (two places).
| (self.object, self.local_path, self.object_sig, self.local_sig_path), | ||
| (self.metadata_file, self.local_metadata_path, self.metadata_sig_file, self.local_metadata_sig_path), |
There was a problem hiding this comment.
Maybe worth to rename elements to clearly notify what they refer to and have the naming consistent? For example,
(self.object_remote_path, self.object_local_path, self.object_sig_remote_path, self.object_sig_local_path),
(self.metadata_remote_path, self.metadata_local_path, self.metadata_sig_remote_path, self.metadata_sig_local_path),There was a problem hiding this comment.
This originated from the object terminology used by the boto client, but I agree that it would be more clear to use the names like you proposed. Is it okay to do that in a follow-up PR, as it would require changes across the entire script?
There was a problem hiding this comment.
Yes, perfectly fine to do it in a follow-up PR.
| (self.metadata_file, self.local_metadata_path, self.metadata_sig_file, self.local_metadata_sig_path), | ||
| ] | ||
| skip = False | ||
| for (object, local_file, sig_object, local_sig_file) in files: |
There was a problem hiding this comment.
Possibly synchronise naming with potential changes in files array, e.g.,
for (remote_path, local_path, sig_remote_path, sig_local_path) in files:
Still testing it, but first tests look good. I'm running a separate instance/fork of the automated ingestion on the Stratum 0, configured to use a test bucket and non-existing target repo. This successfully picked up the tarball+metadata file and their signatures from the test bucket (uploaded by @trz42 in EESSI/software-layer#968):
The log shows that the signatures were successfully verified:
We should do the same for a non-valid signature (and make sure they fail), and for tarballs without a signature file (this should succeed if
signatures_required = no).