Page MenuHomePhabricator

[keyserver] Use blob hash to create blob URIs
ClosedPublic

Authored by bartek on Jun 26 2023, 9:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 23 2024, 1:15 PM
Unknown Object (File)
Nov 23 2024, 1:15 PM
Unknown Object (File)
Nov 23 2024, 7:07 AM
Unknown Object (File)
Nov 23 2024, 7:07 AM
Unknown Object (File)
Nov 17 2024, 6:41 AM
Unknown Object (File)
Nov 10 2024, 12:33 PM
Unknown Object (File)
Nov 9 2024, 4:19 AM
Unknown Object (File)
Nov 8 2024, 8:03 AM
Subscribers

Details

Summary

Linear task: ENG-3974.
We need to modify blob URI format to be blob-service://BLOB_HASH

This change is breaking, but I think nobody except me had any blob-service stored multimedia.

Depends on D8320

Test Plan

With D8206 applied, and blob service messages enabled in input-state-container, I was able to upload multimedia and then view it. Used redux-devtools and console.log to ensure that messages contain the correct format in the holder/thumbnailHolder field.

Tested both web and native, both image and video

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek edited the test plan for this revision. (Show Details)
bartek published this revision for review.Jun 26 2023, 11:47 PM

This change is breaking, but I think nobody except me had any blob-service stored multimedia.

Should we add team members who might have blob-services stored multimedia as blocking?

In D8321#246311, @atul wrote:

This change is breaking, but I think nobody except me had any blob-service stored multimedia.

Should we add team members who might have blob-services stored multimedia as blocking?

I don't know who could it be 😅 I'll ask on Comm Dev Team

We need to modify blob URI format to be blob-service://BLOB_HASH

Might be an ignorant question, but...

If two pieces of identical media are uploaded to the blob service, will they have the same blob hash?

It looks like blobHash comes from sha256Hash which is computed by commUtilsModule.sha256 which wraps olm_sha256.

It looks like that function is deterministic, are we including a counter or something in the bytes that we hash?

I'm guessing this is accounted for somewhere, just wondering where/how

This revision is now accepted and ready to land.Jun 28 2023, 11:31 AM
In D8321#246316, @atul wrote:

We need to modify blob URI format to be blob-service://BLOB_HASH

Might be an ignorant question, but...

If two pieces of identical media are uploaded to the blob service, will they have the same blob hash?

It looks like blobHash comes from sha256Hash which is computed by commUtilsModule.sha256 which wraps olm_sha256.

It looks like that function is deterministic, are we including a counter or something in the bytes that we hash?

I'm guessing this is accounted for somewhere, just wondering where/how

Or I guess eg the image bytes are already "encrypted" before being hashed so two images wouldn't lead to the same hash?

In D8321#246316, @atul wrote:

We need to modify blob URI format to be blob-service://BLOB_HASH

Might be an ignorant question, but...

If two pieces of identical media are uploaded to the blob service, will they have the same blob hash?

It looks like blobHash comes from sha256Hash which is computed by commUtilsModule.sha256 which wraps olm_sha256.

It looks like that function is deterministic, are we including a counter or something in the bytes that we hash?

I'm guessing this is accounted for somewhere, just wondering where/how

Two identical files will have the same SHA-256 hash (the same way as CRC checksums / MD5 works). If the blob with given sha256 hash already exists, the media wouldn't be re-uploaded, but only another holder will be assigned to existing blob.
However, in context of encrypted media, it isn't the case because each time a media is uploaded, a different encryption key is generated and thus the file's checksum also changes.