Skip to content

Conversation

@kesselb
Copy link
Contributor

@kesselb kesselb commented Jul 5, 2021

No description provided.

@kesselb kesselb added enhancement 3. to review Waiting for reviews labels Jul 5, 2021
@kesselb kesselb added this to the Nextcloud 22 milestone Jul 5, 2021
$dnsResponses = dns_get_record($target, $dnsType);
$canHaveCnameRecord = true;
if (count($dnsResponses) > 0) {
foreach ($dnsResponses as $key => $dnsResponse) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code cleanup: As $key is unused and may overwrite $key from the outer loop.

foreach ($dnsTypes as $key => $dnsType) {
foreach ($dnsTypes as $dnsType) {
if ($this->negativeDnsCache->isNegativeCached($target, $dnsType)) {
unset($dnsTypes[$key]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As $dnsTypes is not used it's fine to not unset the value and just continue.

$second = array_pop($labels);

$hostname = $second . '.' . $top;
return dns_get_record($hostname, DNS_SOA);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ host -t SOA www.nextcloud.com
www.nextcloud.com has no SOA record
$ host -t SOA nextcloud.com
nextcloud.com has SOA record ns.inwx.de. hostmaster.inwx.de. 2021033001 10800 3600 604800 3600

@LukasReschke
Copy link
Member

phpcs is complaining

@LukasReschke
Copy link
Member

/backport to stable22

@kesselb kesselb force-pushed the enh/noid/hardening-dns-pin-middleware branch from a513014 to 1903ced Compare July 5, 2021 09:53
@blizzz blizzz mentioned this pull request Jul 5, 2021
1 task
$dnsNegativeTtl = null;
}
$soaDnsEntry = $this->soaRecord($target);
$dnsNegativeTtl = $soaDnsEntry[0]['minimum-ttl'] ?? null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the php doc $soaDnsEntry can be false. Perhaps you can turn false to null and add it as return type hint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb kesselb force-pushed the enh/noid/hardening-dns-pin-middleware branch from b24e105 to b6530e5 Compare July 5, 2021 18:29
@skjnldsv skjnldsv modified the milestones: Nextcloud 22, Nextcloud 23 Jul 5, 2021
@kesselb kesselb merged commit 9f04a7c into master Jul 6, 2021
@kesselb kesselb deleted the enh/noid/hardening-dns-pin-middleware branch July 6, 2021 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants