The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.
Cra logs the secure DNS setting in effect and leaves Chromium's default, like Arc (#110) (#118)
Victor Kildahl6f626cc86739
diff --git a/Packages/CraCore/Sources/CraCore/SecureDNS.swift b/Packages/CraCore/Sources/CraCore/SecureDNS.swiftnew file mode 100644index 0000000..6019665--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/SecureDNS.swift@@ -0,0 +1,37 @@+import Foundation++/// Chromium's secure DNS setting (chrome://settings/security), one value for the whole app in+/// Local State. Cra leaves it on Chromium's default as Arc does: "automatic" with no provider,+/// which is the system resolver, encrypted only when that resolver is a known DoH server. So a+/// work network's own DNS keeps resolving its internal names (#110). The log and Export+/// Diagnostics say what is in effect.+public struct SecureDNS: Equatable, Sendable {+ /// dns_over_https.mode: "off", "automatic" or "secure"; empty when nothing set it.+ public var mode: String+ /// The DoH servers' hosts, from dns_over_https.templates. Only hosts: a custom template's+ /// path can carry the user's own resolver profile (NextDNS puts an id there).+ public var servers: [String]++ public init(mode: String, templates: String) {+ self.mode = mode+ var hosts: [String] = []+ for template in templates.split(whereSeparator: \.isWhitespace) {+ // "{?dns}" and other RFC 6570 parts aren't valid in a URL.+ let base = template.prefix { $0 != "{" }+ let host = URLComponents(string: String(base))?.host.flatMap { $0.isEmpty ? nil : $0.lowercased() } ?? "a custom server"+ if !hosts.contains(host) { hosts.append(host) }+ }+ servers = hosts+ }++ /// "automatic, no provider (system resolver)", "secure via dns.google", "off"+ public var line: String {+ switch mode {+ case "off": return "off"+ case "": return "unset"+ default:+ if servers.isEmpty { return "\(mode), no provider\(mode == "automatic" ? " (system resolver)" : "")" }+ return "\(mode) via \(servers.joined(separator: ", "))"+ }+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/SecureDNSTests.swift b/Packages/CraCore/Tests/CraCoreTests/SecureDNSTests.swiftnew file mode 100644index 0000000..f906327--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/SecureDNSTests.swift@@ -0,0 +1,34 @@+import CraCore+import Testing++/// Chromium's secure DNS setting as the log and Export Diagnostics show it (#110).+struct SecureDNSTests {+ @Test(arguments: [+ // Chromium's default, and Arc's: no provider, so the system resolver.+ ("automatic", "", "automatic, no provider (system resolver)"),+ // What Chromium writes when Google is picked in chrome://settings/security.+ ("secure", "https://dns.google/dns-query{?dns}", "secure via dns.google"),+ ("automatic", "https://chrome.cloudflare-dns.com/dns-query", "automatic via chrome.cloudflare-dns.com"),+ ("secure", "", "secure, no provider"),+ ("off", "https://dns.google/dns-query{?dns}", "off"),+ ("", "", "unset"),+ ])+ func line(mode: String, templates: String, line: String) {+ #expect(SecureDNS(mode: mode, templates: templates).line == line)+ }++ @Test func customTemplatesKeepOnlyTheirHost() {+ let dns = SecureDNS(mode: "secure", templates: "https://dns.nextdns.io/a1b2c3/MacBook")+ #expect(dns.servers == ["dns.nextdns.io"])+ #expect(!dns.line.contains("a1b2c3"))+ }++ @Test func severalTemplatesAreOneServerEach() {+ let dns = SecureDNS(mode: "secure", templates: "https://dns.google/dns-query{?dns}\nhttps://DNS.google/resolve https://dns.quad9.net/dns-query")+ #expect(dns.servers == ["dns.google", "dns.quad9.net"])+ }++ @Test func aTemplateWithoutAHostIsNamedButNotShown() {+ #expect(SecureDNS(mode: "secure", templates: "not a url/secret").line == "secure via a custom server")+ }+}diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex 631d7b6..3aebd7c 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -162,6 +162,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {}observeContentBlocking()observeHttpsOnly()+ logSecureDNS()}/// A sidebar whose links disagree (SidebarIntegrity) says so in the log, one fault a problem.@@ -180,6 +181,17 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {observeChanges(of: { [store] in store.settings.httpsOnly }, apply: CraCEFRuntime.setHttpsOnlyModeEnabled)}+ /// Chromium's secure DNS setting (chrome://settings/security), left on Chromium's default+ /// like Arc: the log says what is in effect at launch and after each change (#110).+ private func logSecureDNS() {+ var last: String?+ CraCEFRuntime.setSecureDNSChangeHandler {+ guard let mode = CraCEFRuntime.secureDNSMode() else { return }+ let line = SecureDNS(mode: mode, templates: CraCEFRuntime.secureDNSTemplates() ?? "").line+ if line != last { last = line; CraLog.note("secure dns: " + line) }+ }+ }+private func observeContentBlocking() {observeChanges(of: { [store] in store.settings.blockAdsAndTrackers }, apply: CraCEFRuntime.setContentBlockingEnabled)}diff --git a/Sources/Cra/Services/Diagnostics.swift b/Sources/Cra/Services/Diagnostics.swiftindex 4ffe8e2..c0734b5 100644--- a/Sources/Cra/Services/Diagnostics.swift+++ b/Sources/Cra/Services/Diagnostics.swift@@ -165,6 +165,7 @@ enum Diagnostics {"Running from: \(Bundle.main.bundlePath)","Up for: \(Int(ProcessInfo.processInfo.systemUptime / 60)) min (Mac), \(Int(-(NSRunningApplication.current.launchDate ?? Date()).timeIntervalSinceNow / 60)) min (Cra)","Embedded pages: \(EmbeddedPages.isEnabled), Chrome-style hosting: \(CraCEFRuntime.chromeHosting())",+ "Secure DNS: \(CraCEFRuntime.secureDNSMode().map { SecureDNS(mode: $0, templates: CraCEFRuntime.secureDNSTemplates() ?? "").line } ?? "unknown")","","Spaces: \(store.spaces.count), profiles: \(store.profiles.count), tabs: \(store.allTabs().count)",]diff --git a/Sources/CraCEF/CraCEF.mm b/Sources/CraCEF/CraCEF.mmindex b6e54a5..eb6e331 100644--- a/Sources/CraCEF/CraCEF.mm+++ b/Sources/CraCEF/CraCEF.mm@@ -448,6 +448,45 @@ static void ObserveExtensionSettings(CefRefPtr<CefRequestContext> context) {}}+// Secure DNS lives in Local State, the global preference manager, not in a profile (#110).+// Picking a provider changes mode and templates one after the other: one call for both.+static void (^g_secureDNSHandler)(void) = nil;+static bool g_secureDNSChangePending = false;+static std::vector<CefRefPtr<CefRegistration>> g_secureDNSObservers;++static void NotifySecureDNS() {+ if (!g_secureDNSHandler || g_secureDNSChangePending || g_quitting) return;+ g_secureDNSChangePending = true;+ dispatch_async(dispatch_get_main_queue(), ^{+ g_secureDNSChangePending = false;+ if (g_secureDNSHandler && !g_quitting) g_secureDNSHandler();+ });+}++class SecureDNSObserver : public CefPreferenceObserver {+public:+ void OnPreferenceChanged(const CefString& name) override { NotifySecureDNS(); }+private:+ IMPLEMENT_REFCOUNTING(SecureDNSObserver);+};++static void ObserveSecureDNS() {+ CefRefPtr<CefPreferenceManager> local = CefPreferenceManager::GetGlobalPreferenceManager();+ if (!local) return;+ CefRefPtr<SecureDNSObserver> observer = new SecureDNSObserver();+ for (const char* name : {"dns_over_https.mode", "dns_over_https.templates"}) {+ if (CefRefPtr<CefRegistration> r = local->AddPreferenceObserver(name, observer)) g_secureDNSObservers.push_back(r);+ }+}++static NSString* SecureDNSPreference(const char* name) {+ if (!g_contextInitialized || g_quitting) return nil;+ CefRefPtr<CefPreferenceManager> local = CefPreferenceManager::GetGlobalPreferenceManager();+ CefRefPtr<CefValue> value = local ? local->GetPreference(name) : nullptr;+ if (!value || value->GetType() != VTYPE_STRING) return nil;+ return NSStringFromCef(value->GetString());+}+/// Profiles other than the global Default one get the same preferences once they load,/// then create the browsers that waited for them.class ProfileContextHandler : public CefRequestContextHandler {@@ -605,7 +644,9 @@ public:CEF_REQUIRE_UI_THREAD();ApplyProfilePreferences(CefRequestContext::GetGlobalContext());ObserveExtensionSettings(CefRequestContext::GetGlobalContext());+ ObserveSecureDNS();g_contextInitialized = true;+ NotifySecureDNS();NSArray<CraBrowser*>* pending = [g_pendingCreation copy];[g_pendingCreation removeAllObjects];for (CraBrowser* b in pending) {@@ -2401,6 +2442,7 @@ static void MarkProfileExitedCleanly(NSString* profileDir) {g_incognitoContext = nullptr;g_profileContexts.clear();g_extensionSettingsObservers.clear();+ g_secureDNSObservers.clear();g_waitingForProfile = nil;CefShutdown();}@@ -2440,6 +2482,12 @@ static void MarkProfileExitedCleanly(NSString* profileDir) {+ (void)setExtensionSettingsChangeHandler:(void (^)(void))handler {g_extensionSettingsHandler = [handler copy];}++ (NSString*)secureDNSMode { return SecureDNSPreference("dns_over_https.mode"); }++ (NSString*)secureDNSTemplates { return SecureDNSPreference("dns_over_https.templates"); }++ (void)setSecureDNSChangeHandler:(void (^)(void))handler {+ g_secureDNSHandler = [handler copy];+ if (g_contextInitialized) NotifySecureDNS();+}+ (void)sendBrowserDevToolsMethod:(NSString*)method params:(NSString*)paramscompletion:(void (^)(NSString* _Nullable, NSString* _Nullable))completion {[self sendBrowserDevToolsMethod:method params:params sessionID:nil completion:completion];diff --git a/Sources/CraCEF/include/CraCEF.h b/Sources/CraCEF/include/CraCEF.hindex 744161a..fe92eb1 100644--- a/Sources/CraCEF/include/CraCEF.h+++ b/Sources/CraCEF/include/CraCEF.h@@ -230,6 +230,14 @@ typedef NS_ENUM(NSInteger, CraDownloadState) {/// http:// navigations are upgraded, and a site without HTTPS shows Chrome's warning/// page before it loads. Profiles that load later get it too. Off until enabled.+ (void)setHttpsOnlyModeEnabled:(BOOL)enabled;+/// Chromium's secure DNS setting (chrome://settings/security), app-wide in Local State:+/// `dns_over_https.mode` and `dns_over_https.templates` as Chromium holds them now. nil+/// before Chromium is ready and once quitting starts.++ (nullable NSString *)secureDNSMode;++ (nullable NSString *)secureDNSTemplates;+/// Called on the main queue once Chromium is ready (at once if it already is) and after the+/// secure DNS setting changes.++ (void)setSecureDNSChangeHandler:(nullable void (^)(void))handler;/// Replaces the blocked list (bare domains; a domain also covers its subdomains).+ (void)setBlockedDomains:(NSArray<NSString *> *)domains;/// Reads and installs a list file off the main thread: one domain per line ordiff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 1bad293..89b00e6 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -2233,3 +2233,17 @@ was frontmost, 1x region captures and 100 fps recordings; test tabs archived aftdots. A folder without a peek opens as usual. Arc's window state then has no entry for it. So a click on aclosed folder that keeps tabs in sight means "close", keeping only the open tab (as the 29 Oct folder-peeknotes found). Cra: FolderPeek.clickOpens.++## Secure DNS (Arc 1.171, 2 Nov 2026, issue #110, live net log)+- [O] Arc leaves Chromium's default. Victor's Arc `Local State` has no `dns_over_https` key, and a net log of Arc+ started with `--log-net-log` (in the background, no clicks) shows `secure_dns_mode: 1` (automatic) with+ `doh_config.servers: []` in every DNS config event: the system resolver, encrypted only when it is a known DoH+ server. No Arc policy is installed. The binary's `dns.google` templates are Chromium's own provider list.+- [O] An Arc with `"mode": "secure"` and `https://dns.google/dns-query{?dns}` (the #110 report) is what Chromium+ writes when Google is picked in arc://settings/security, not something Arc seeds.+- Cra: no change to the default, so a work network's own DNS keeps resolving its internal names. CEF builds the+ same provider list as Chrome (OS default, custom, DNS4EU, Cloudflare, CleanBrowsing, OpenDNS, Google) in+ chrome://settings/security; a choice persists in Cra's `Chromium/Local State` across restarts. `cra.log` says+ what is in effect at launch and after each change (`secure dns: automatic, no provider (system resolver)`, `secure+ via dns.google`, `off`), and Export Diagnostics' summary has a `Secure DNS:` line (`SecureDNS` in CraCore, hosts+ only).