Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC2931: Allow widgets to navigate with matrix.to URIs #2931

Open
wants to merge 3 commits into
base: old_master
Choose a base branch
from

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Dec 29, 2020

@turt2live turt2live changed the title Allow widgets to navigate with matrix.to URIs MSC2931: Allow widgets to navigate with matrix.to URIs Dec 29, 2020
@turt2live turt2live marked this pull request as ready for review December 29, 2020 18:32
@turt2live turt2live added proposal A matrix spec change proposal proposal-in-review widgets anything to do with widgets kind:feature MSC for not-core and not-maintenance stuff labels Dec 29, 2020
turt2live added a commit to matrix-org/matrix-widget-api that referenced this pull request Dec 29, 2020
MSC: matrix-org/matrix-spec-proposals#2931

This experiments with a new way of handling unstable features from MSCs by using `@deprecated` on the entry points into the system.
@HenkKalkwater
Copy link

One of the precautions that could be taken against malicious widgets is to only allow the navigation to happen if it is a result of direct user input, like a mouse click, just as modern browsers do with requesting full screen access. In my opinion, it would be unwanted to have a widget that is able to navigate the user away from the room without any user input at all and it may lead to confusion by some users why their chat app is suddenly in another chat.

@t3chguy
Copy link
Member

t3chguy commented Jan 19, 2021

I'm pretty certain you can't detect a click happening inside an iframe except from inside that iframe. That would be awful for clickjacking. The iframe is sandboxed and we can do nothing with it except the PostMessage API.

@HenkKalkwater
Copy link

HenkKalkwater commented Jan 22, 2021

I kinda looked into it, but I couldn't find a way either by just using JavaScript and without trusting the nested frame. But for any applications not running within a web environment themselves, it might be a possibility if they are able to examine the call stack which lead towards the method getting invoked.

}
```

As with all capabilities, clients SHOULD prompt the user to approve the widget's use of the navigate
Copy link
Contributor

@Half-Shot Half-Shot Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about this a bit on #3662, but it would be good to have an intention included with the action. E.g. For userIds, I might want to direct the client to either invite the user to my current room OR start a new chat with the user.

I'd slightly be more in favor of a key intent or similar which describes the intention of the widget, but we could also append something to the uri.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actions are described by the URL format already in the spec - this MSC doesn't change that.

Copy link
Contributor

@Half-Shot Half-Shot Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where? (I had a look, couldn't spot them)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://spec.matrix.org/unstable/appendices/#uris - they are formally specified on matrix: uris, but do technically exist for matrix.to as well. This MSC is intended to be compatible with both.


## Proposal

A new capability, `m.navigate`, is introduced to gate a `navigate` request/response over the widget API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation feels a bit too tightly defined here, there are more use cases than navigation for sharing a matrix URI with the client. This could be made more generic (and therefore more useful) to simply have this API be a URI sharing mechanism ("action":"share") and then include the intent of navigate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This MSC is intended to instruct the client to do something with the uri, not to just be a permalink handler. "Handle" and "route" felt far too generic, so navigate was chosen similar to how the browser navigates to a URL which might result in a desktop application being opened instead.


A new capability, `m.navigate`, is introduced to gate a `navigate` request/response over the widget API.
The `navigate` action takes one parameter, `uri`, in its `data` - this is the matrix.to (or in future
Matrix URI scheme) URI the client should honour. The request is acknowledged with an empty response body.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matrix URIs are already in the spec and the navigation in question is specifically for Matrix clients - I don't see a reason why Matrix URIs should not be the recommended form now, not in the future (and yes that means that Element Web should finally catch up and parse them).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This MSC was last updated over a year ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal widgets anything to do with widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants