[Bug]: DnsPinMiddleware.php uses wrong concept of handling failed DNS responses
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
If in DnsPinMiddleware.php in private function dnsResolve() retrieving the SOA record works and for some reason, for example because of packet loss, dnsResolve() doesn't return IP addresses with the second run the DNS record is negatively cached for the time of the minimum ttl of the SOA record.
The current implementation protects against missing IP addresses, i.e. missing DNS responses, with the minimum TTL of the SOA record. This implementation isn't correct.
Steps to reproduce
- Try an update of apps or installation of apps.
- Have missing DNS responses by accident.
- Now you are not able to do updates or installation of apps for 24 hours for example with Github sources.
Expected behavior
DNS pinning should protect against modified IP addresses with a user configurable TTL.
Nextcloud Server version
29
Operating system
Debian/Ubuntu
PHP engine version
None
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Updated from a MINOR version (ex. 28.0.1 to 28.0.2)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in DnsPinMiddleware.php and read the private dnsResolve() function, focusing on how SOA and IP responses are handled across repeated lookups. Trace the DNS caching behavior and the configurable DNS-pinning TTL. Done means transient missing responses do not impose the SOA minimum-TTL negative cache while modified IP addresses remain protected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- networking, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100