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
F3357669: D10913.id36668.diff
Sun, Nov 24, 12:57 AM
F3357122: D10913.diff
Sat, Nov 23, 10:33 PM
Unknown Object (File)
Fri, Nov 8, 10:03 PM
Unknown Object (File)
Fri, Nov 8, 7:15 PM
Unknown Object (File)
Fri, Nov 8, 7:15 PM
Unknown Object (File)
Fri, Nov 8, 7:15 PM
Unknown Object (File)
Fri, Nov 8, 7:15 PM
Unknown Object (File)
Fri, Nov 8, 7:15 PM
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