Skip to content

Commit 5fa9725

Browse files
authored
Highlight dangerous scopes when consenting to them (#5180)
2 parents 0d27c34 + 820b1d7 commit 5fa9725

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

frontend/src/components/SessionDetail/SessionInfo.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
44
// Please see LICENSE files in the repository root for full details.
55

6+
import IconAdmin from "@vector-im/compound-design-tokens/assets/web/icons/admin";
67
import IconChat from "@vector-im/compound-design-tokens/assets/web/icons/chat";
78
import IconComputer from "@vector-im/compound-design-tokens/assets/web/icons/computer";
8-
import IconErrorSolid from "@vector-im/compound-design-tokens/assets/web/icons/error-solid";
99
import IconInfo from "@vector-im/compound-design-tokens/assets/web/icons/info";
10+
import IconRoom from "@vector-im/compound-design-tokens/assets/web/icons/room";
1011
import IconSend from "@vector-im/compound-design-tokens/assets/web/icons/send";
1112
import IconUserProfile from "@vector-im/compound-design-tokens/assets/web/icons/user-profile";
1213
import {
@@ -68,7 +69,7 @@ export const ScopeSendMessages: React.FC = () => {
6869
const ScopeSynapseAdmin: React.FC = () => {
6970
const { t } = useTranslation();
7071
return (
71-
<VisualListItem Icon={IconErrorSolid}>
72+
<VisualListItem Icon={IconRoom} destructive>
7273
{t("mas.scope.synapse_admin")}
7374
</VisualListItem>
7475
);
@@ -77,7 +78,7 @@ const ScopeSynapseAdmin: React.FC = () => {
7778
const ScopeMasAdmin: React.FC = () => {
7879
const { t } = useTranslation();
7980
return (
80-
<VisualListItem Icon={IconErrorSolid}>
81+
<VisualListItem Icon={IconAdmin} destructive>
8182
{t("mas.scope.mas_admin")}
8283
</VisualListItem>
8384
);

frontend/src/templates.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@
117117
width: var(--cpd-space-6x);
118118
color: var(--cpd-color-icon-quaternary);
119119
}
120+
121+
&.dangerous {
122+
border: 1px solid var(--cpd-color-border-critical-subtle);
123+
background-color: var(--cpd-color-bg-critical-subtle);
124+
font: var(--cpd-font-body-md-medium);
125+
color: var(--cpd-color-text-critical-primary);
126+
127+
& > svg {
128+
color: var(--cpd-color-icon-critical-primary);
129+
}
130+
}
120131
}
121132
}
122133
}

templates/components/scope.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
<li>{{ icon.chat() }}<p>{{ _("mas.scope.view_messages") }}</p></li>
1919
<li>{{ icon.send() }}<p>{{ _("mas.scope.send_messages") }}</p></li>
2020
{% elif scope == "urn:synapse:admin:*" %}
21-
<li>{{ icon.error_solid() }}<p>{{ _("mas.scope.synapse_admin") }}</p></li>
21+
<li class="dangerous">{{ icon.room() }}<p>{{ _("mas.scope.synapse_admin") }}</p></li>
2222
{% elif scope == "urn:mas:admin" %}
23-
<li>{{ icon.error_solid() }}<p>{{ _("mas.scope.mas_admin") }}</p></li>
23+
<li class="dangerous">{{ icon.admin() }}<p>{{ _("mas.scope.mas_admin") }}</p></li>
2424
{% elif scope is startingwith("urn:matrix:client:device:") or scope is startingwith("urn:matrix:org.matrix.msc2967.client:device:") %}
2525
{# We hide this scope #}
2626
{% else %}

translations/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@
666666
},
667667
"mas_admin": "Administer any user on the matrix-authentication-service",
668668
"@mas_admin": {
669-
"context": "components/scope.html:23:42-66",
669+
"context": "components/scope.html:23:54-78",
670670
"description": "Displayed when the 'urn:mas:admin' scope is requested"
671671
},
672672
"send_messages": "Send new messages on your behalf",
@@ -675,7 +675,7 @@
675675
},
676676
"synapse_admin": "Administer the Synapse homeserver",
677677
"@synapse_admin": {
678-
"context": "components/scope.html:21:42-70",
678+
"context": "components/scope.html:21:53-81",
679679
"description": "Displayed when the 'urn:synapse:admin:*' scope is requested"
680680
},
681681
"view_messages": "View your existing messages and data",

0 commit comments

Comments
 (0)