-
Notifications
You must be signed in to change notification settings - Fork 9
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
[webapp] Ensure webapp integrity #6
Comments
I've done a PoC here: aguinet/mattermost-webapp@04e50ef The overall idea assumes that we have a Page Integrity-like plugin who verifies that, for a given domain, only signed/known pages are rendered in the browser (something Page Integrity doesn't do AFAIK, but should be doable). This allows for:
With this in mind, we do two things in the aforementioned commit to have a complete verification of the mattermost webapp:
This solution has interesting advantages:
The main drawbacks is that plugin developers that want to try their develop plugins would have troubles. This means two versions of the webapp should be built: one for developers, one for production (potentially a non acceptable burden). There might be another solution that would make this drawback disappear: if the Mattermost webapp includes by default the Webpack SRI plugin (and nothing else), then a dedicated Mattermost webapp integrity browser plugin could do the plugin-specific integrity attribute injection. |
Page Integrity doesn't provide this, or anything else particularly useful really. It might be doable but you should be aware of the pitfalls, like service worker caches.
I suppose this assumes you can just sign the
Because of the above, this will break things in unexpected ways unless server development is carefully aligned with e2ee plugin development.
This only applies to
This is assuming plugins only have client-side code in the bundle declared in the manifest and nowhere else. That's not the case for a lot of plugins. For example, many plugins provide integrations with third-party applications and authorize the user via an OAuth flow. OAuth flows often use additional stand-alone HTML pages to avoid unloading the main Mattermost chat tab. And those HTML pages obviously cannot be secured using SRI; there would have to be a mechanism to handle them in the browser extension. Some plugins also load JavaScript in the main app dynamically in a way that wouldn't be covered by SRI. For example the Jitsi plugin, one of the plugins you already included in the PoC repo, needs to load a Jitsi API from a separate file. And even though that could be covered with a custom SRI setup, there's also a "compatibility mode" where the API is actually loaded from the external Jitsi server.
It's not super clear to me what you mean by "transparent" here. If it's an essential property, maybe you can elaborate a little?
This is a non-issue. Mattermost already has a developer mode where it relaxes some security guarantees similar to what's needed here. The existing developer mode could be easily extended to support this use-case. The biggest open question here is the design and implementation of the integrity extension. There are a lot of potential pitfalls, and it's not obvious to me that a secure implementation is necessarily even possible. There are questions around of how signatures are calculated and distributed, how signing keys are distributed and verified to be trustworthy, how the blocking is done technically, who maintains and distributes the plugin etc. Page Integrity provides some ideas but nothing that could be used as-is since it's terribly insecure itself. |
Thanks for your answer! Comments below:
We could make a less "strong" model, that would be: if the page isn't signed, it is rendered but with javascript disabled?
True. If these pages doesn't really need javascript, maybe we could be fine (see above).
Indeed I assumed plugins were fairly self contained. What we could say here is that plugins could have, as a hint, something like an "sri" boolean in their manifest, stating that every loaded resources is properly validated thanks to sri. Then an administrator that want their users to be able to authenticate the mattermost webapp would only use these plugins. Coupled with a browser plugin that would enforce only loading signed pages with SRI-enabled resources, it could do the job (at least in our case).
I meant the overhead for users is zero (they won't see the difference). Mattermost administrators would only have to take of loading "SRI-enabled" plugins.
Good to know, thanks!
Mostly agree on this part. Using Github as a "root of trust" could be good enough for a lot of use cases, with the plugins gathering signatures from the various release pages (as I did in the PoC for plugins). That's one idea, there are tons of others :) |
There is an extension API to disable JavaScript ( |
The NoScript Firefox plugin manages to do this on a per (sub)domain basis, so I'd say that should be doable? |
Ticket to track ideas/advances on that known limitation.
The text was updated successfully, but these errors were encountered: