Target `.` in SRV records is returned as empty string instead
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- php
- Ambito
- networking
Direzione di ricerca
Start by tracing resolveAll() with Message::TYPE_SRV through the SRV response parsing path and compare handling of a target of "." with a normal hostname. Add a regression test for the _test2-style record and verify that the returned target is "." rather than an empty string.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hey all,
Opening this ticket following the suggestion of a maintainer of movim in https://github.com/movim/movim/issues/1408, which uses this lib. I'm not very good at PHP so please bear with me 😅
I believe there might be something wrong the way react dns returns data from SRV records. I have set up two test SRV records as follows:
_test1._tcp.nadia.moe. 300 IN SRV 1 1 6969 nadia.moe.
_test2._tcp.nadia.moe. 300 IN SRV 1 1 0 .
They should return the expected when querying it:
22:43:36 ~/Staging/react-dns-repro $> dig +short SRV _test1._tcp.nadia.moe
1 1 6969 nadia.moe.
22:44:14 ~/Staging/react-dns-repro $> dig +short SRV _test2._tcp.nadia.moe
1 1 0 .
Note the literal . when resolving _test2._tcp.nadia.moe. This . character is not present in the response from React/DNS:
<?php
use React\Dns\Config\Config;
use React\Dns\Resolver\Factory;
use React\Dns\Model\Message;
require __DIR__ . '/vendor/autoload.php';
$config = Config::loadSystemConfigBlocking();
if (!$config->nameservers) {
$config->nameservers[] = '8.8.8.8';
}
$factory = new Factory();
$resolver = $factory->create($config);
$name='_test1._tcp.nadia.moe';
$resolver->resolveAll($name, Message::TYPE_SRV)->then(function (array $ips) use ($name) {
var_dump($ips);
}, function (Exception $e) use ($name) {
echo 'No IPv4 addresses for ' . $name . ': ' . $e->getMessage() . PHP_EOL;
});
$name='_test2._tcp.nadia.moe';
$resolver->resolveAll($name, Message::TYPE_SRV)->then(function (array $ips) use ($name) {
var_dump($ips);
}, function (Exception $e) use ($name) {
echo 'No IPv4 addresses for ' . $name . ': ' . $e->getMessage() . PHP_EOL;
});
array(1) {
[0]=>
array(4) {
["priority"]=>
int(1)
["weight"]=>
int(1)
["port"]=>
int(6969)
["target"]=>
string(9) "nadia.moe"
}
}
array(1) {
[0]=>
array(4) {
["priority"]=>
int(1)
["weight"]=>
int(1)
["port"]=>
int(0)
["target"]=>
string(0) ""
}
}
In the response above, one would expect target to be . instead of the empty string.
This is somewhat relevant because . has a special meaning for SRV records: As per https://datatracker.ietf.org/doc/html/rfc2782, clients must check for this value specified as a target, and understand by it that the service is not provided and should not attempt connection. In the case of movim, it is doing that in https://github.com/movim/movim/blob/5aaacc6b2e05f89fa41007cf7378a4568f648dde/linker.php#L144, but this check is failing as react dns does not return ., but an empty string.
I'm not entirely sure wheter this is expected behavior, but in case it was, perhaps it is worth stating somewhere.
- Lingua principale
- PHP
- Stelle
- 542
- Fork
- 62
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di reactphp/dns
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug new feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Roadmap to reactphp/dns v3 Apertamaintenance
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
help wanted new feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Support extended DNS (EDNS0) Apertahelp wanted new feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 32/100
Tutte le issue di reactphp/dns
Issue simili
-
jira-created
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
nunomaduro/phpinsights#745 ·
-
status/awaiting_triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
WordPress/plugin-check#1486 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
az-digital/az_quickstart#6019 ·