Page MenuHomePhabricator

[lib] Modify link verification to call the proper keyserver
ClosedPublic

Authored by tomek on Dec 11 2023, 6:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 1:55 PM
Unknown Object (File)
Mon, Nov 18, 10:33 PM
Unknown Object (File)
Fri, Nov 8, 11:12 PM
Unknown Object (File)
Fri, Nov 8, 3:33 PM
Unknown Object (File)
Fri, Nov 8, 11:35 AM
Unknown Object (File)
Fri, Nov 8, 11:28 AM
Unknown Object (File)
Fri, Nov 8, 9:58 AM
Unknown Object (File)
Fri, Nov 8, 9:42 AM
Subscribers

Details

Summary

This diff allows calling any keyserver to check if a link is valid.

https://linear.app/comm/issue/ENG-5423/join-a-community-on-a-given-keyserver

Depends on D10206

Test Plan

Check if clicking an invite link opens a modal on web. Also checked if providing an explicit keyserver id works.

Diff Detail

Repository
rCOMM Comm
Branch
linki
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Dec 11 2023, 7:14 AM
Harbormaster failed remote builds in B24939: Diff 34474!

You forgot to add a hook wrapping the function. We don't want the calling code to include useKeyserverCall, we want this to be hidden away.

lib/actions/link-actions.js
27 ↗(On Diff #34474)

Wouldn't it be better if this was keyserverID?: string? What do we gain by having it be keyserverID: ?string, and then defaulting to ashoatKeyserverID inside the function, if the calling code has to provide this argument at all times?

This shouldn't work. You pass

keyserverInfos: {
        [keyserverOverride.keyserverURL]: {
          urlPrefix: keyserverOverride.keyserverURL,
        },
      },

into callKeyserverEndpoint, but then the request is keyed with keyserverID. So you will be trying to call keyserverID keyserver, for which you don't have an entry in your overridden keyserverInfos.

tomek requested review of this revision.Dec 11 2023, 9:37 AM
inka requested changes to this revision.Dec 11 2023, 10:14 AM
This revision now requires changes to proceed.Dec 11 2023, 10:14 AM

Use the correct key in overrides. Tested it by specifying keyserver override in web link
handler.

const validateLink = useVerifyInviteLink({
  keyserverID: ashoatKeyserverID,
  keyserverURL: 'http://localhost:3000/keyserver',
});

This calls the proper endpoint, but causes some other issues - e.g. invite link
verification assumes that a user is logged in, which isn't always true when using an invite
link. Going to fix this in the next diffs.

This revision is now accepted and ready to land.Dec 12 2023, 1:35 AM