Page MenuHomePhabricator

[keyserver] Strip `member.permissions` for `FUTURE_CODE_VERSION` clients
ClosedPublic

Authored by atul on Jul 16 2024, 2:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 3, 8:49 PM
Unknown Object (File)
Tue, Sep 3, 5:03 AM
Unknown Object (File)
Mon, Sep 2, 11:31 PM
Unknown Object (File)
Mon, Sep 2, 4:57 PM
Unknown Object (File)
Sun, Sep 1, 12:07 AM
Unknown Object (File)
Sat, Aug 31, 8:57 AM
Unknown Object (File)
Thu, Aug 29, 1:46 PM
Unknown Object (File)
Wed, Aug 28, 2:50 PM
Subscribers
None

Details

Summary

Add stripMemberPermissions option to rawThreadInfoFromServerThreadInfo to strip member permissions for new clients.


Depends on D12763

Test Plan

Did some basic testing where I hardcoded stripMemberPermissions being passed to rawThreadInfoFromServerThreadInfo and set breakpoints to check output.

Will do additional testing with validators + after getting basic client migration working.

With stripMemberPermissions=false:

9dfcd0.png (1×2 px, 558 KB)

(can observe that each of the two members have permissions field set to string)

With stripMemberPermissions=true:

aac4a5.png (1×2 px, 411 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Jul 16 2024, 2:49 PM
atul added inline comments.
lib/shared/thread-utils.js
897–906 ↗(On Diff #42361)

Wanted to specify exact type of object before "crossing boundary" and making call to stripMemberPermissionsFromRawThreadInfo. The output of rawThreadInfoFromServerThreadInfo is "enforced" at runtime via validators which makes this a "safe" any-cast IMO.

ashoat requested changes to this revision.Jul 17 2024, 12:29 PM
ashoat added inline comments.
keyserver/src/fetchers/thread-fetchers.js
311–314 ↗(On Diff #42361)

Isn't this backwards? Don't we want to strip member permissions for newer clients, not for older clients?

lib/shared/thread-utils.js
875 ↗(On Diff #42361)

It looks like this will be true for modern clients:

const specialRoleFieldSupported = hasMinCodeVersion(viewer.platformDetails, {
  native: 336,
  web: 79,
});

Doesn't that mean we'll never strip the member permissions?

This revision now requires changes to proceed.Jul 17 2024, 12:29 PM

rebase after addressing feedback in previous diffs in stack, still need to fix this diff up

atul planned changes to this revision.Jul 17 2024, 2:25 PM

Lot of things that need to be fixed up here.

keyserver/src/fetchers/thread-fetchers.js
311–314 ↗(On Diff #42361)

Yeah, will flip.

lib/shared/thread-utils.js
875 ↗(On Diff #42361)

Yeah this came up pretty immediately during testing, will update

fix logic, still need to do more testing

Updated test plan after some more testing.

ashoat added inline comments.
lib/shared/thread-utils.js
869 ↗(On Diff #42418)

Is the "deprecated" name really appropriate here? It seems like it's deprecated on the client, but will always be necessary in keyserver to go from a ServerThreadInfo to a type that works on clients (minimally-encoded)

This revision is now accepted and ready to land.Jul 18 2024, 10:29 AM
lib/shared/thread-utils.js
869 ↗(On Diff #42418)

That's fair, wanted to avoid "Legacy" but something like minimallyEncodeRawThreadInfoSansMemberPermissions or something might work.

869 ↗(On Diff #42418)

*minimallyEncodeRawThreadInfoWithMemberPermissions

lib/shared/thread-utils.js
869 ↗(On Diff #42418)

Doing this in a followup diff rn to avoid cluttering this one up with rename

This revision was landed with ongoing or failed builds.Jul 18 2024, 2:45 PM
This revision was automatically updated to reflect the committed changes.

Here's the followup diff I promised: D12799