Skip to content

Commit 7de900a

Browse files
bradh352RafaelGSS
authored andcommitted
test: fix dns test case failures after c-ares update to 1.21.0+
c-ares has made intentional changes to the behavior of TXT records to comply with RFC 7208, which concatenates multiple strings for the same TXT record into a single string. Multiple TXT records are not concatenated. Also, response handling has changed, such that a response which is completely invalid in formatting is thrown away as a malicious forged/spoofed packet rather than returning EBADRESP. This is one step toward RFC 9018 (EDNS COOKIES) which will require the message to at least be structurally valid to validate against spoofed records. Fix By: Brad House (@bradh352) PR-URL: #50743 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Fixes: #50741 Refs: #50444
1 parent b1b6c44 commit 7de900a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

test/parallel/test-dns-resolveany-bad-ancount.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ server.bind(0, common.mustCall(async () => {
3030
dnsPromises.resolveAny('example.org')
3131
.then(common.mustNotCall())
3232
.catch(common.expectsError({
33-
code: 'EBADRESP',
33+
// May return EBADRESP or ETIMEOUT
34+
code: /^(?:EBADRESP|ETIMEOUT)$/,
3435
syscall: 'queryAny',
3536
hostname: 'example.org'
3637
}));
3738

3839
dns.resolveAny('example.org', common.mustCall((err) => {
39-
assert.strictEqual(err.code, 'EBADRESP');
40+
assert.notStrictEqual(err.code, 'SUCCESS');
4041
assert.strictEqual(err.syscall, 'queryAny');
4142
assert.strictEqual(err.hostname, 'example.org');
4243
const descriptor = Object.getOwnPropertyDescriptor(err, 'message');

test/parallel/test-dns-resolveany.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const answers = [
1111
{ type: 'AAAA', address: '::42', ttl: 123 },
1212
{ type: 'MX', priority: 42, exchange: 'foobar.com', ttl: 124 },
1313
{ type: 'NS', value: 'foobar.org', ttl: 457 },
14-
{ type: 'TXT', entries: [ 'v=spf1 ~all', 'xyz\0foo' ] },
14+
{ type: 'TXT', entries: [ 'v=spf1 ~all xyz\0foo' ] },
1515
{ type: 'PTR', value: 'baz.org', ttl: 987 },
1616
{
1717
type: 'SOA',

0 commit comments

Comments
 (0)