Skip to content

fix(apple): flush dns cache on resource updates - #10224

Merged
jamilbk merged 2 commits into
mainfrom
fix/dns-flushcache
Aug 19, 2025
Merged

jamilbk merged 2 commits into
mainfrom
fix/dns-flushcache

Conversation

@jamilbk

@jamilbk jamilbk commented Aug 19, 2025

Copy link
Copy Markdown
Member

In the following sequence of events, a user will be unable to connect to the DNS resource for a few seconds because macOS is caching the queries, preventing connlib from seeing them.

  1. User signs in
  2. User has no access to DNS Resource A
  3. User queries for DNS Resource A - NXDOMAIN -> macOS caches this
  4. Admin grants access to DNS Resource A
  5. User tries query again -> connlib never sees the query -> cache hit -> NXDOMAIN

To fix this, we call networkSettings.apply() whenever the resource list has changed. This has been tested to trigger a DNS cache flush on macOS.

Copilot AI review requested due to automatic review settings August 19, 2025 03:58
@vercel

vercel Bot commented Aug 19, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
firezone Ready Ready Preview Comment Aug 19, 2025 4:02am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a DNS caching issue on macOS where users cannot connect to newly granted DNS resources due to cached NXDOMAIN responses. The fix applies network settings to flush the DNS cache whenever the resource list changes.

  • Flush DNS cache by calling networkSettings.apply() when resources are updated
  • Add conditional check to only apply settings when resource list actually changes
  • Include logging to track when DNS cache flushing occurs

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


// Update resource List. We don't care what's inside.
resourceListJSON = resourceList
if resourceListJSON != resourceList, let networkSettings = self.networkSettings {

Copilot AI Aug 19, 2025

Copy link

Choose a reason for hiding this comment

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

The condition checks if resourceListJSON != resourceList but resourceListJSON is assigned to resourceList on line 377, which means this comparison happens before the assignment. This could lead to unexpected behavior if the intention is to check for changes after assignment.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The intention is to check if they're different before assignment.

@jamilbk
jamilbk added this pull request to the merge queue Aug 19, 2025
Merged via the queue into main with commit 9696d00 Aug 19, 2025

This branch was successfully deployed

1 active deployment
Preview — ab4b0b66 Deployed Aug 19, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants