Merge pull request #2047 from internetee/2033-adding-unsupported-dnskey-alg-response

fixed dnskey invalid alg response
This commit is contained in:
Timo Võhmar 2021-06-21 15:52:04 +03:00 committed by GitHub
commit 33bbc0ed42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 4 deletions

View file

@ -34,9 +34,12 @@ class Dnskey < ApplicationRecord
def epp_code_map
{
'2005' => [
[:alg, :invalid, { value: { obj: 'alg', val: alg }, values: ALGORITHMS.join(', ') }],
[:protocol, :invalid, { value: { obj: 'protocol', val: protocol }, values: PROTOCOLS.join(', ') }],
[:flags, :invalid, { value: { obj: 'flags', val: flags }, values: FLAGS.join(', ') }]
[:alg, :invalid, { value: { obj: 'alg', val: alg },
values: "Valid algorithms are: #{ALGORITHMS.join(', ')}" }],
[:protocol, :invalid, { value: { obj: 'protocol', val: protocol },
values: "Valid protocols are: #{PROTOCOLS.join(', ')}" }],
[:flags, :invalid, { value: { obj: 'flags', val: flags },
values: "Valid protocols are: #{PROTOCOLS.join(', ')}" }],
],
'2302' => [
[:public_key, :taken, { value: { obj: 'pubKey', val: public_key } }]

View file

@ -123,7 +123,7 @@ en:
dnskey:
attributes:
alg:
invalid: 'Valid algorithms are: %{values}'
invalid: '%{values}'
blank: 'Algorithm is missing'
protocol:
invalid: 'Valid protocols are: %{values}'

View file

@ -17,6 +17,37 @@ class EppDomainUpdateBaseTest < EppTestCase
@original_registrant_change_verification
end
def test_update_dnskey_with_invalid_alg
request_xml = <<~XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:update>
</update>
<extension>
<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
<secDNS:add><secDNS:keyData>
<secDNS:flags>257</secDNS:flags>
<secDNS:protocol>3</secDNS:protocol>
<secDNS:alg>666</secDNS:alg>
<secDNS:pubKey>P25MwGXr2sTbxdOIKRNbSC8bUO2CObo4/T8kMFoKcgs=</secDNS:pubKey>
</secDNS:keyData></secDNS:add>
</secDNS:update>
</extension>
</command>
</epp>
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_syntax_error
end
def test_update_domain
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>