Skip to content

Commit 3c2d2fa

Browse files
authored
Merge pull request #342 from cedarcode/braulio_fix_acceptable_attestation_types_inclusion_for_none
Fix: validate acceptable attestation type inclusion when attestation statement is None
2 parents 844c973 + f9b89f6 commit 3c2d2fa

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/webauthn/attestation_statement/none.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ module WebAuthn
66
module AttestationStatement
77
class None < Base
88
def valid?(*_args)
9-
if statement == {}
9+
if statement == {} && trustworthy?
1010
[WebAuthn::AttestationStatement::ATTESTATION_TYPE_NONE, nil]
1111
else
1212
false
1313
end
1414
end
15+
16+
private
17+
18+
def attestation_type
19+
WebAuthn::AttestationStatement::ATTESTATION_TYPE_NONE
20+
end
1521
end
1622
end
1723
end

spec/webauthn/attestation_statement/none_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,11 @@
3131
expect(WebAuthn::AttestationStatement::None.new([]).valid?(authenticator_data, nil)).to be_falsy
3232
expect(WebAuthn::AttestationStatement::None.new("a" => "b").valid?(authenticator_data, nil)).to be_falsy
3333
end
34+
35+
it "returns false if None is not among the acceptable attestation types" do
36+
WebAuthn.configuration.acceptable_attestation_types = ['AttCA']
37+
38+
expect(WebAuthn::AttestationStatement::None.new({}).valid?(authenticator_data, nil)).to be_falsy
39+
end
3440
end
3541
end

0 commit comments

Comments
 (0)