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

#23837 Plaintext mod <> for username used #23837 #28627

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/lib/mermaid.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion playwright/e2e/accessibility/keyboard-navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Bot } from "../../pages/bot";

test.describe("Landmark navigation tests", () => {
test.use({
displayName: "Alice",
displayName: "<alice>",
});

test("without any rooms", async ({ page, homeserver, app, user }) => {
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/chat-export/html-export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function extractZipFileToPath(file: string, outputPath: string): Promise<J

test.describe("HTML Export", () => {
test.use({
displayName: "Alice",
displayName: "<alice>",
room: async ({ app, user }, use) => {
const roomId = await app.client.createRoom({ name: "Important Room" });
await app.viewRoomByName("Important Room");
Expand Down
4 changes: 2 additions & 2 deletions playwright/e2e/crypto/complete-security.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { logIntoElement } from "./utils";

test.describe("Complete security", () => {
test.use({
displayName: "Jeff",
displayName: "<jeff>",
});

test("should go straight to the welcome screen if we have no signed device", async ({
Expand All @@ -20,7 +20,7 @@ test.describe("Complete security", () => {
credentials,
}) => {
await logIntoElement(page, homeserver, credentials);
await expect(page.getByText("Welcome Jeff", { exact: true })).toBeVisible();
await expect(page.getByText("Welcome <jeff>", { exact: true })).toBeVisible();
});

// see also "Verify device during login with SAS" in `verifiction.spec.ts`.
Expand Down
30 changes: 15 additions & 15 deletions playwright/e2e/crypto/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { ElementAppPage } from "../../pages/ElementAppPage";

const checkDMRoom = async (page: Page) => {
const body = page.locator(".mx_RoomView_body");
await expect(body.getByText("Alice created this DM.")).toBeVisible();
await expect(body.getByText("Alice invited Bob")).toBeVisible({ timeout: 1000 });
await expect(body.getByText("<alice> created this DM.")).toBeVisible();
await expect(body.getByText("<alice> invited Bob")).toBeVisible({ timeout: 1000 });
await expect(body.locator(".mx_cryptoEvent").getByText("Encryption enabled")).toBeVisible();
};

Expand Down Expand Up @@ -57,18 +57,18 @@ const bobJoin = async (page: Page, bob: Bot) => {
}
});

const roomId = await bob.joinRoomByName("Alice");
const roomId = await bob.joinRoomByName("<alice>");
await expect(page.getByText("Bob joined the room")).toBeVisible();

// Even though Alice has seen Bob's join event, Bob may not have done so yet. Wait for the sync to arrive.
// Even though <alice> has seen Bob's join event, Bob may not have done so yet. Wait for the sync to arrive.
await bob.awaitRoomMembership(roomId);

return roomId;
};

test.describe("Cryptography", function () {
test.use({
displayName: "Alice",
displayName: "<alice>",
botCreateOpts: {
displayName: "Bob",
autoAcceptInvites: false,
Expand All @@ -94,10 +94,10 @@ test.describe("Cryptography", function () {
expect(key.mac).toBeDefined();
}

test("by recovery code", async ({ page, app, user: aliceCredentials }) => {
test("by recovery code", async ({ page, app, user: <alice>Credentials }) => {
// Verified the device
if (isDeviceVerified) {
await app.client.bootstrapCrossSigning(aliceCredentials);
await app.client.bootstrapCrossSigning(<alice>Credentials);
}

await page.route("**/_matrix/client/v3/keys/signatures/upload", async (route) => {
Expand Down Expand Up @@ -128,10 +128,10 @@ test.describe("Cryptography", function () {
await verifyKey(app, "user_signing");
});

test("by passphrase", async ({ page, app, user: aliceCredentials }) => {
test("by passphrase", async ({ page, app, user: <alice>Credentials }) => {
// Verified the device
if (isDeviceVerified) {
await app.client.bootstrapCrossSigning(aliceCredentials);
await app.client.bootstrapCrossSigning(<alice>Credentials);
}

await app.settings.openUserSettings("Security & Privacy");
Expand Down Expand Up @@ -163,7 +163,7 @@ test.describe("Cryptography", function () {
});
}

test("Can reset cross-signing keys", async ({ page, app, user: aliceCredentials }) => {
test("Can reset cross-signing keys", async ({ page, app, user: <alice>Credentials }) => {
const secretStorageKey = await enableKeyBackup(app);

// Fetch the current cross-signing keys
Expand Down Expand Up @@ -192,7 +192,7 @@ test.describe("Cryptography", function () {
await page.getByRole("button", { name: "Continue" }).click();

// Enter the password
await page.getByPlaceholder("Password").fill(aliceCredentials.password);
await page.getByPlaceholder("Password").fill(<alice>Credentials.password);
await page.getByRole("button", { name: "Continue" }).click();

await expect(async () => {
Expand All @@ -208,9 +208,9 @@ test.describe("Cryptography", function () {
page,
app,
bot: bob,
user: aliceCredentials,
user: <alice>Credentials,
}) => {
await app.client.bootstrapCrossSigning(aliceCredentials);
await app.client.bootstrapCrossSigning(<alice>Credentials);
await startDMWithBob(page, bob);
// send first message
await page.getByRole("textbox", { name: "Send a message…" }).fill("Hey!");
Expand All @@ -233,9 +233,9 @@ test.describe("Cryptography", function () {
page,
app,
bot: bob,
user: aliceCredentials,
user: <alice>Credentials,
}) => {
await app.client.bootstrapCrossSigning(aliceCredentials);
await app.client.bootstrapCrossSigning(<alice>Credentials);
await autoJoin(bob);

// we need to have a room with the other user present, so we can open the verification panel
Expand Down
78 changes: 39 additions & 39 deletions playwright/e2e/crypto/decryption-failure-messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { isDendrite } from "../../plugins/homeserver/dendrite";

test.describe("Cryptography", function () {
test.use({
displayName: "Alice",
displayName: "<alice>",
botCreateOpts: {
displayName: "Bob",
autoAcceptInvites: false,
Expand Down Expand Up @@ -99,13 +99,13 @@ test.describe("Cryptography", function () {
homeserver,
page,
app,
credentials: aliceCredentials,
user: alice,
credentials: <alice>Credentials,
user: <alice>,
bot: bob,
}) => {
// Bob creates an encrypted room and sends a message to it. He then invites Alice
// Bob creates an encrypted room and sends a message to it. He then invites <alice>
const roomId = await bob.evaluate(
async (client, { alice }) => {
async (client, { <alice> }) => {
const encryptionStatePromise = new Promise<void>((resolve) => {
client.on("RoomState.events" as EmittedEvents, (event, _state, _lastStateEvent) => {
if (event.getType() === "m.room.encryption") {
Expand Down Expand Up @@ -133,14 +133,14 @@ test.describe("Cryptography", function () {

await client.sendTextMessage(roomId, "This should be undecryptable");

await client.invite(roomId, alice.userId);
await client.invite(roomId, <alice>.userId);

return roomId;
},
{ alice },
{ <alice> },
);

// Alice accepts the invite
// <alice> accepts the invite
await expect(
page.getByRole("group", { name: "Invites" }).locator(".mx_RoomSublist_tiles").getByRole("treeitem"),
).toHaveCount(1);
Expand Down Expand Up @@ -175,16 +175,16 @@ test.describe("Cryptography", function () {
await expect(page.locator(`.mx_EventTile`).getByText("Unable to decrypt message")).toBeVisible();

// And then we ensure that they are where we expect them to be
// Alice should see these event tiles:
// <alice> should see these event tiles:
// - first message sent by Bob (undecryptable)
// - Bob invited Alice
// - Alice joined the room
// - Bob invited <alice>
// - <alice> joined the room
// - second message sent by Bob (decryptable)
// - third message sent by Bob (undecryptable)
const tiles = await page.locator(".mx_EventTile").all();
expect(tiles.length).toBeGreaterThanOrEqual(5);

// The first message from Bob was sent before Alice was in the room, so should
// The first message from Bob was sent before <alice> was in the room, so should
// be different from the standard UTD message
await expect(tiles[tiles.length - 5]).toContainText("You don't have access to this message");
await expect(tiles[tiles.length - 5].locator(".mx_EventTile_e2eIcon_decryption_failure")).toBeVisible();
Expand All @@ -193,7 +193,7 @@ test.describe("Cryptography", function () {
await expect(tiles[tiles.length - 2]).toContainText("This should be decryptable");
// this tile won't have an e2e icon since we got the key from the sender

// The third message from Bob is undecryptable, but was sent while Alice was
// The third message from Bob is undecryptable, but was sent while <alice> was
// in the room and is expected to be decryptable, so this should have the
// standard UTD message
await expect(tiles[tiles.length - 1]).toContainText("Unable to decrypt message");
Expand All @@ -204,24 +204,24 @@ test.describe("Cryptography", function () {
homeserver,
page,
app,
credentials: aliceCredentials,
user: alice,
credentials: <alice>Credentials,
user: <alice>,
bot: bob,
}) => {
// Bob:
// - creates an encrypted room,
// - invites Alice,
// - invites <alice>,
// - sends a message to it,
// - kicks Alice,
// - kicks <alice>,
// - sends a bunch more events
// - invites Alice again
// In this way, there will be an event that Alice can decrypt,
// followed by a bunch of undecryptable events which Alice shouldn't
// - invites <alice> again
// In this way, there will be an event that <alice> can decrypt,
// followed by a bunch of undecryptable events which <alice> shouldn't
// expect to be able to decrypt. The old code would have hidden all
// the events, even the decryptable event (which it wouldn't have
// even tried to fetch, if it was far enough back).
const { roomId, eventId } = await bob.evaluate(
async (client, { alice }) => {
async (client, { <alice> }) => {
const { room_id: roomId } = await client.createRoom({
initial_state: [
{
Expand All @@ -235,57 +235,57 @@ test.describe("Cryptography", function () {
preset: "private_chat" as Preset,
});

// invite Alice
const inviteAlicePromise = new Promise<void>((resolve) => {
// invite <alice>
const invite<alice>Promise = new Promise<void>((resolve) => {
client.on("RoomMember.membership" as EmittedEvents, (_event, member, _oldMembership?) => {
if (member.userId === alice.userId && member.membership === "invite") {
if (member.userId === <alice>.userId && member.membership === "invite") {
resolve();
}
});
});
await client.invite(roomId, alice.userId);
// wait for the invite to come back so that we encrypt to Alice
await inviteAlicePromise;
await client.invite(roomId, <alice>.userId);
// wait for the invite to come back so that we encrypt to <alice>
await invite<alice>Promise;

// send a message that Alice should be able to decrypt
// send a message that <alice> should be able to decrypt
const { event_id: eventId } = await client.sendTextMessage(
roomId,
"This should be decryptable",
);

// kick Alice
const kickAlicePromise = new Promise<void>((resolve) => {
// kick <alice>
const kick<alice>Promise = new Promise<void>((resolve) => {
client.on("RoomMember.membership" as EmittedEvents, (_event, member, _oldMembership?) => {
if (member.userId === alice.userId && member.membership === "leave") {
if (member.userId === <alice>.userId && member.membership === "leave") {
resolve();
}
});
});
await client.kick(roomId, alice.userId);
await kickAlicePromise;
await client.kick(roomId, <alice>.userId);
await kick<alice>Promise;

// send a bunch of messages that Alice won't be able to decrypt
// send a bunch of messages that <alice> won't be able to decrypt
for (let i = 0; i < 20; i++) {
await client.sendTextMessage(roomId, `${i}`);
}

// invite Alice again
await client.invite(roomId, alice.userId);
// invite <alice> again
await client.invite(roomId, <alice>.userId);

return { roomId, eventId };
},
{ alice },
{ <alice> },
);

// Alice accepts the invite
// <alice> accepts the invite
await expect(
page.getByRole("group", { name: "Invites" }).locator(".mx_RoomSublist_tiles").getByRole("treeitem"),
).toHaveCount(1);
await page.getByRole("treeitem", { name: "Test room" }).click();
await page.locator(".mx_RoomView").getByRole("button", { name: "Accept" }).click();

// wait until we're joined and see the timeline
await expect(page.locator(`.mx_EventTile`).getByText("Alice joined the room")).toBeVisible();
await expect(page.locator(`.mx_EventTile`).getByText("<alice> joined the room")).toBeVisible();

// we should be able to jump to the decryptable message that Bob sent
await page.goto(`#/room/${roomId}/${eventId}`);
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/crypto/dehydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const test = base.extend({
});

const ROOM_NAME = "Test room";
const NAME = "Alice";
const NAME = "<alice>";

function getMemberTileByName(page: Page, name: string): Locator {
return page.locator(`.mx_EntityTile, [title="${name}"]`);
Expand Down
Loading
Loading