Suppress self-analysis tracker false positives (fixes #3)#6
Open
adamXbot wants to merge 1 commit into
Open
Conversation
The SDK fingerprint database (tracker URLs like "app-measurement.com", symbols like "FIRApp") is compiled into privacycommand's own binary. When privacycommand statically analyzes itself, the binary string scanner matches those signatures and falsely reports trackers/analytics in our own app. Fix: in SDKFingerprintDetector.detect(in:extraSymbols:), when the bundle under inspection is privacycommand itself (bundle ID org.privacykey.privacycommand), suppress the string-derived signals (urlPatterns / domains / symbolPatterns). Those strings are detection DATA we ship, not trackers we use. Framework- and bundle-ID evidence is still honored because it requires a real linked dependency, so a genuine future tracker added to privacycommand would still surface. The fix is deliberately scoped to privacycommand's own CFBundleIdentifier; every other app is analyzed exactly as before. Tests (privacycommandCoreTests/SDKFingerprintDetectorTests): - self-analysis suppresses string-only tracker hits - the same artefacts in another app are still flagged - a genuinely linked tracker framework still surfaces under self-analysis, with no URL/string evidence Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (fixes #3)
SDKFingerprintDatabase— the tracker SDK signatures privacycommand ships (URLs likeapp-measurement.com, symbols likeFIRApp, domains likefirebaseio.com) — is compiled into privacycommand's own binary. So when privacycommand statically analyzes itself, the binary string scanner matches those signatures and falsely reports trackers/analytics in our own app.Root cause
The detector treats four signal sources as evidence of an SDK: linked frameworks, framework/helper bundle IDs, hard-coded URLs/domains, and binary symbols. The last two are string-table signals. For our own bundle, those strings are present only because they're the detection data we ship — not trackers we embed.
Fix
In
SDKFingerprintDetector.detect(in:extraSymbols:), computeisSelfAnalysis = report.bundle.bundleID == analyzerBundleID(whereanalyzerBundleID = "org.privacykey.privacycommand", privacycommand's ownCFBundleIdentifier). When analyzing ourselves, skip the string-derived evidence loops (urlPatterns/ domains /symbolPatterns).Framework- and bundle-ID evidence are left intact: those require a real linked dependency, so a genuine third-party tracker ever added to privacycommand would still be reported. The change is deliberately scoped to privacycommand's own bundle ID by design — every other app is analyzed exactly as before.
Tests
New
SDKFingerprintDetectorTests:testSelfAnalysisSuppressesStringOnlyTrackerHits— self-scan with Firebase URL/domain/symbol artefacts yields no hits.testOtherAppStillFlaggedFromSameArtefacts— the same artefacts in a third-party app still flagfirebase-analyticsand a tracker-like hit.testSelfAnalysisStillCatchesLinkedFramework— a genuinely linkedFirebaseAnalytics.frameworkstill surfaces under self-analysis, with no suppressed.url(...)evidence.TestFixtures.swiftis extended withbundle(bundleID:)andreport(bundle:frameworks:hardcodedURLs:hardcodedDomains:)parameters (existing call sites preserved via defaults).Verification
swift build+DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test— full suite green (12 tests, 0 failures).🤖 Generated with Claude Code