Page MenuHomePhabricator

[native][web] Add AuthMetadata to Blob service upload actions
ClosedPublic

Authored by bartek on Feb 1 2024, 5:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:46 PM
Unknown Object (File)
Oct 3 2024, 11:45 PM
Unknown Object (File)
Sep 7 2024, 9:57 AM
Subscribers

Details

Summary

Final diff resolving ENG-6288, ENG-6290 and ENG-6291.
Modified Blob service multimedia upload calls to add AuthMetadata to the request.

It'd be difficult to split this into smaller parts because of required types for blob upload functions in lib.

Depends on D10912.

Test Plan

Extended test plan from previous diffs. Done on both web and native:

  • Enabled encrypted media and blob service, sent a multimedia message
  • Modified blob handlers the same way as in D10908 test plan
  • Opened chat on native - the multimedia loads correctly
  • (Web only) Also canceled message after the photo was preloaded - this caused "revoke holder" call on Blob service
  • Made sure Blob service logs for all endpoints (get, assign_holder, upload, revoke) contain auth metadata like this:
INFO get_blob{blob_hash=xn2ILjHR45XHsbjNf_wRalWNjusWtCNntiutX1eJn0w}: blob::http::handlers::blob: Get blob request auth=UserToken(UserIdentity { user_id: "foo", access_token: "baz", device_id: "9/Dk+21eU27n7fpvFDVWqNrouje2XKGW2jtLPC7vx+A" })
`

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.

Replace convenient hook with imperative calls

bartek published this revision for review.Feb 2 2024, 12:59 AM
tomek added inline comments.
native/input/input-state-container.react.js
841–845 ↗(On Diff #36577)

Why do we need to introduce this invariant?

847 ↗(On Diff #36577)

We don't need to await a return in an async function

974 ↗(On Diff #36577)

I guess we don't need this log

This revision is now accepted and ready to land.Feb 6 2024, 1:36 AM
web/input/input-state-container.react.js
918 ↗(On Diff #36577)

Can we create auth metadata here?

native/input/input-state-container.react.js
841–845 ↗(On Diff #36577)

When I introduced this IIFE, flow started complaining that processedMedia type is ambiguous

Simplified approach - moved identity context into useBlobServiceUpload hook