Skip to content

Commit 2e8d3a7

Browse files
kochj23claude
andcommitted
fix(low-info): Resolve 8 LOW/INFO audit findings
- Remove stale TODO in ScanSettingsView (already using correct method) - Document hostname resolution skip rationale in IntegratedDashboardViewV3 - Document disabled auto-start toggle in ShadowAIMonitorView - Document certificate auto-trust security implications in UniFiController - Remove unused reverseIPAddress() call in CustomDNSResolver - Add send() error handling in ServiceVersionScanner - Add MARK section comments for Xcode navigation in SecurityDashboardView - Remove outdated TODO in SettingsView Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 62909f1 commit 2e8d3a7

8 files changed

Lines changed: 18 additions & 13 deletions

NMAPScanner/CustomDNSResolver.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class CustomDNSResolver: ObservableObject {
6868

6969
/// Query a specific DNS server for PTR record (reverse DNS)
7070
private func queryDNS(ipAddress: String, dnsServer: String) async -> String? {
71-
// Convert IP to reverse DNS format (e.g., 192.168.1.1 -> 1.1.168.192.in-addr.arpa)
72-
let _ = reverseIPAddress(ipAddress)
71+
// The dig command with -x handles reverse DNS formatting internally
7372

7473
// Use dig command for custom DNS query
7574
let task = Process()

NMAPScanner/IntegratedDashboardViewV3.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,9 +1527,10 @@ class IntegratedScannerV3: ObservableObject {
15271527
print("🔧 createBasicDevice: Attempting hostname resolution via custom DNS")
15281528
var hostname: String? = nil
15291529

1530-
// DNS resolution must be done synchronously here, but we'll do it async later
1531-
// For now, skip to avoid blocking
1532-
// TODO: Refactor to async hostname resolution during device creation
1530+
// NOTE: Hostname resolution is skipped here to avoid blocking the main thread.
1531+
// The legacy resolveHostname() used DispatchSemaphore which deadlocks on MainActor.
1532+
// Future optimization: resolve hostnames in a background TaskGroup after device
1533+
// creation completes, then update devices with resolved names asynchronously.
15331534
// hostname = await dnsResolver.resolveHostname(for: host)
15341535

15351536
// Get manufacturer from MAC address

NMAPScanner/ScanSettingsView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ struct ScanSettingsView: View {
104104

105105
private func startScan() {
106106
Task {
107-
// TODO: Update to use correct scanning method
108107
await scanner.scanPingSweep(subnet: subnet)
109108
dismiss()
110109
}

NMAPScanner/SecurityDashboardView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct SecurityDashboardView: View {
4646
var body: some View {
4747
ScrollView {
4848
VStack(alignment: .leading, spacing: 30) {
49-
// Header
49+
// MARK: - Header & Controls
5050
HStack {
5151
VStack(alignment: .leading, spacing: 4) {
5252
Text("Security & Traffic Dashboard")
@@ -509,6 +509,7 @@ struct SecurityDashboardView: View {
509509
.padding(.horizontal, 40)
510510
*/
511511

512+
// MARK: - Placeholder
512513
// Placeholder for advanced visualizations
513514
Text("Advanced security visualizations coming soon!")
514515
.font(.title2)
@@ -525,6 +526,7 @@ struct SecurityDashboardView: View {
525526
.onDisappear {
526527
stopMonitoring()
527528
}
529+
// MARK: - Sheet Presentations
528530
.sheet(isPresented: $showProtocolDetails) {
529531
if let protocolName = selectedProtocol {
530532
ProtocolDetailsView(

NMAPScanner/ServiceVersionScanner.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ class ServiceVersionScanner {
7676

7777
// Send probes for specific services
7878
if let probe = self.getProbeForPort(port) {
79-
let _ = send(sockfd, probe, probe.count, 0)
79+
let bytesSent = send(sockfd, probe, probe.count, 0)
80+
if bytesSent < 0 {
81+
continuation.resume(returning: nil)
82+
return
83+
}
8084
}
8185

8286
// Read response

NMAPScanner/SettingsView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ struct SettingsView: View {
263263
// New Features Section
264264
SettingsSection(title: "Advanced Features") {
265265
VStack(alignment: .leading, spacing: 24) {
266-
// TODO: Implement these views in future updates
267-
268266
// Notifications Link
269267
NavigationLink(destination: NotificationSettingsView()) {
270268
HStack {

NMAPScanner/ShadowAIMonitorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ struct ShadowAISettingsView: View {
862862
}
863863

864864
Toggle("Auto-start monitoring on launch", isOn: .constant(false))
865-
.disabled(true) // TODO: Implement
865+
.disabled(true) // Disabled: requires persistent launch-agent configuration to auto-start Shadow AI monitoring
866866
}
867867

868868
Section("Notifications") {

NMAPScanner/UniFiController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,10 @@ class UniFiController: ObservableObject {
578578

579579
SecureLogger.log("Certificate trust prompt for \(host): CN=\(commonName), FP=\(fingerprint)", level: .warning)
580580

581-
// TODO: Show actual user prompt in UI
582-
// For now, auto-accept but log it
581+
// SECURITY: Auto-trusting certificates bypasses TLS verification.
582+
// A proper implementation should present a SwiftUI confirmation dialog showing
583+
// the certificate common name and fingerprint, allowing the user to accept or reject.
584+
// Until that UI is built, all UniFi controller certificates are auto-trusted.
583585
SecurityAuditLog.log(event: .certificateTrusted, details: "Auto-trusted certificate for \(host) (pending UI implementation)", level: .security)
584586

585587
return true // Auto-trust for now (better than blind trust)

0 commit comments

Comments
 (0)