Conversation
Since 2.0.23, validatePublicUrl() throws UrlError when a hostname fails to resolve, and the callers that catch UrlError logged every such error as a policy rejection. A dead instance or a flaky resolver therefore showed up as "Disallowed private URL" or a similar message, pointing operators at an SSRF attempt or a misconfigured allowPrivateAddress when the name simply did not resolve. On a busy server these error-level logs pile up from routine document loading and WebFinger lookups. The callers now check UrlError.reason, added in fedify-dev#1060, and log DNS failures as "DNS lookup failed for {url}" with the original error attached. Each one uses the level it already uses for other network failures: debug for the two document loaders and lookupWebFinger(), error for getNodeInfo(). Disallowed URLs keep their existing messages, and control flow is unchanged. A comment in lookupWebFinger() notes that 2.3-maintenance and later return an outcome object there instead of null, for the forward merge. Fixes fedify-dev#1062 Assisted-by: Claude Code:claude-opus-5-5 Assisted-by: Codex:gpt-6-astra Assisted-by: Claude Code:claude-fable-5-1
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughDNS resolution failures now receive distinct log messages from disallowed URLs across Fedify, vocab-runtime, and WebFinger. Existing return and throw behavior remains unchanged. Tests cover lookup failures, empty DNS results, and private-address results. ChangesDNS failure logging
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to DNS failures should now be logged accurately without changing how callers handle them. No merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex review |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Fixes #1062. A hostname that doesn't resolve currently shows up in the logs as a blocked private address. The four callers of
validatePublicUrl()that catchUrlErrornow branch onUrlError.reasonfrom #1060 and log"dns"failures asDNS lookup failed for {url}, with the original error attached:getAuthenticatedDocumentLoader()in packages/fedify/src/utils/docloader.tsgetDocumentLoader()in packages/vocab-runtime/src/docloader.tslookupWebFinger()in packages/webfinger/src/lookup.tsgetNodeInfo()in packages/fedify/src/nodeinfo/client.tsDisallowed URLs keep their existing messages, and control flow doesn't change.
Log levels
Each caller logs DNS failures at the level it already uses for an ordinary
fetch()failure. The two document loaders don't log those at all andlookupWebFinger()logs them at debug, so these three log DNS failures at debug.getNodeInfo()logs network failures at error, so its DNS failures stay at error. Error level in the loaders would keep the noise the issue complains about, since they run constantly on a busy server.Tests
Each caller's new test stubs
dns.lookup()the way #1060 did and captures LogTape records for three cases: a lookup that throws, one that returns no addresses, and one that resolves to a private address. All four fail without this fix.In packages/vocab-runtime/ and packages/webfinger/, the Deno
netpermission check runs inside the test callback because those packages also build their tests as CommonJS, which rejects top-levelawait.Merging forward
This needs
UrlError.reason, so it has to reach 2.1-maintenance together with #1060.{ resource: null, result: "network_error", remoteHost }instead ofnull. A TODO at the new branch says to keep that value for both reasons.node:dns/promisesimport. 2.1-maintenance through main still useimport { lookup }, so keep the default import when resolving the Fix DNS failures bypassing during inbox validation #1060 conflict.CLI lookup hints are left to #1063 and #1064.