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)
Mar 6 2024, 12:10 PM
Unknown Object (File)
Mar 6 2024, 9:39 AM
Unknown Object (File)
Mar 6 2024, 9:39 AM
Unknown Object (File)
Mar 6 2024, 9:39 AM
Unknown Object (File)
Mar 6 2024, 9:39 AM
Unknown Object (File)
Mar 6 2024, 9:39 AM
Unknown Object (File)
Mar 6 2024, 9:39 AM
Unknown Object (File)
Mar 6 2024, 9:39 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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