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
F3373274: D12779.diff
Tue, Nov 26, 8:43 AM
Unknown Object (File)
Sat, Nov 23, 9:16 AM
Unknown Object (File)
Sat, Nov 23, 6:41 AM
Unknown Object (File)
Sat, Nov 23, 6:21 AM
Unknown Object (File)
Sat, Nov 23, 6:18 AM
Unknown Object (File)
Sat, Nov 23, 3:24 AM
Unknown Object (File)
Fri, Nov 8, 7:15 AM
Unknown Object (File)
Fri, Nov 8, 6:13 AM
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
No Lint Coverage
Unit
No Test Coverage

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