Commit b4a2270a authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

webauthn: add test for oversized credential IDs (take two).

Gerrit threw a 500 when uploading the final version of [1] and I didn't
notice. Then the CQ landed the wrong version.

This change includes the final set of code-review replies.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/982634

TBR=engedy

Change-Id: I400c713dedadb2bfac5629994a048a775c0c14b8
Reviewed-on: https://chromium-review.googlesource.com/998184Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Commit-Queue: Adam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548566}
parent 34810df0
......@@ -656,13 +656,14 @@ TEST_F(AuthenticatorImplTest, TestGetAssertionTimeout) {
}
TEST_F(AuthenticatorImplTest, OversizedCredentialId) {
device::test::ScopedVirtualFidoDevice virtual_device_;
TestServiceManagerContext smc_;
device::test::ScopedVirtualFidoDevice scoped_virtual_device;
TestServiceManagerContext service_manager_context;
// 255 is the maximum size of a U2F credential ID. We also test one greater
// (256) to ensure that nothing untoward happens.
const std::vector<size_t> kSizes = {255, 256};
for (size_t size : kSizes) {
for (const size_t size : kSizes) {
SCOPED_TRACE(size);
SimulateNavigation(GURL(kTestOrigin1));
......@@ -675,7 +676,7 @@ TEST_F(AuthenticatorImplTest, OversizedCredentialId) {
const bool should_be_valid = size < 256;
if (should_be_valid) {
ASSERT_TRUE(virtual_device_.mutable_state()->InjectRegistration(
ASSERT_TRUE(scoped_virtual_device.mutable_state()->InjectRegistration(
credential->id, kTestRelyingPartyId));
}
......
......@@ -69,7 +69,7 @@ class COMPONENT_EXPORT(DEVICE_FIDO) VirtualFidoDevice : public FidoDevice {
// typically be a domain, e.g. "example.com").
//
// Returns true on success. Will fail if there already exists a credential
// with the given ID.
// with the given ID or if private-key generation fails.
bool InjectRegistration(const std::vector<uint8_t>& credential_id,
const std::string& relying_party_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment