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

Update tests to allow x-signing key upload without UIA #1383

Merged
merged 3 commits into from
Jun 14, 2024
Merged
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
73 changes: 22 additions & 51 deletions tests/41end-to-end-keys/08-cross-signing.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
my $user_id = $user->user_id;

matrix_set_cross_signing_key( $user, {
"auth" => {
type => "m.login.password",
identifier => {
type => "m.id.user",
user => $user->user_id,
},
password => $user->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -52,23 +44,37 @@
});
};

test "Fails to upload self-signing keys with no auth",
test "Fails to replace cross-signing keys with no auth",
requires => [ local_user_fixture(), qw( can_upload_self_signing_keys ) ],

do => sub {
my ( $user ) = @_;
my $user_id = $user->user_id;

# Initial upload does not require UIA
matrix_set_cross_signing_key( $user, {
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
"usage" => ["master"],
"keys" => {
"master_key" => {
# private key: HvQBbU+hc2Zr+JP1sE0XwBe1pfZZEYtJNPJLZJtS+F8
"user_id" => $user_id,
"usage" => ["master"],
"keys" => {
"ed25519:EmkqvokUn8p+vQAGZitOk4PWjp7Ukp3txV2TbMPEiBQ"
=> "EmkqvokUn8p+vQAGZitOk4PWjp7Ukp3txV2TbMPEiBQ",
},
},
})->then( sub {
# Replacing the key with no auth should be rejected
matrix_set_cross_signing_key( $user, {
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
"usage" => ["master"],
"keys" => {
"ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"
=> "nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk",
},
},
},
},
});
})->main::expect_http_401;
};

Expand All @@ -80,11 +86,6 @@
my $user_id = $user->user_id;

matrix_set_cross_signing_key( $user, {
"auth" => {
"type" => "m.login.password",
"user" => $user_id,
"password" => $user->password,
},
"self_signing_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -134,11 +135,6 @@
origin => $user_id, key_id => "ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"
);
matrix_set_cross_signing_key( $user1, {
"auth" => {
"type" => "m.login.password",
"user" => $user_id,
"password" => $user1->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -285,11 +281,6 @@
origin => $user_id, key_id => "ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"
);
matrix_set_cross_signing_key( $user1, {
"auth" => {
"type" => "m.login.password",
"user" => $user_id,
"password" => $user1->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -329,11 +320,6 @@
});
})->then( sub {
matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: OMkooTr76ega06xNvXIGPbgvvxAOzmQncN8VObS7aBA
"user_id" => $user2_id,
Expand Down Expand Up @@ -436,11 +422,6 @@
);

matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user2_id,
Expand Down Expand Up @@ -532,11 +513,6 @@
sync_until_user_in_device_list( $user1, $user2 );
})->then( sub {
matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user2_id,
Expand Down Expand Up @@ -621,11 +597,6 @@

matrix_put_e2e_keys( $user2, device_keys => $device)->then( sub {
matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user2_id,
Expand Down
Loading