eclipse-hawkbit / hawkbit-extensions

Eclipse Public License 2.0
20 stars 30 forks source link

Don't retrieve MD5 hash via etag from S3 #73

Closed sebastian-firsching closed 3 years ago

sebastian-firsching commented 3 years ago

Currently, we retrieve the MD5 hash from etag in the method getArtifactBySha1. The official AWS documentation states that The ETag may or may not be an MD5 digest of the object data. In the S3 extension the etag is base64 decoded and afterwards base16 encoded. This leads to a wrong value, as the etag value coming from S3 is already base16 encoded. The created value will not have the expected 32 characters. However with this PR the MD5 hash coming from retrieved S3 objects will be written to database. When the MD5 digest is empty, the calculated hash will be written to database instead. As the encoded/decoded MD5 hash retrieved from etag has more than the expected 32 characters, this leads to a database constraint violation, and already existing artifacts can't be added to additional software modules. Therefore, the MD5 value is set to null with this PR, as the MD5 digest coming from the etag is not used at all.

Signed-off-by: Sebastian Firsching sebastian.firsching@bosch-si.com

hawkbit-bot commented 3 years ago

Can one of the admins verify this patch?