Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/codescan/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ func AllRules() []Rule {
fix: "Implement ATT prompt before any tracking. Add NSUserTrackingUsageDescription to Info.plist.",
languages: []string{"swift", "objc", "typescript", "javascript"},
patterns: []*regexp.Regexp{
regexp.MustCompile(`(?i)(firebase.*analytics|google.*analytics|facebook.*sdk|fbsdk|adjust.*sdk|appsflyer|amplitude|mixpanel)`),
regexp.MustCompile(`(?i)(firebase.*analytics|google.*analytics|facebook.*sdk|fbsdk|adjust.*sdk|appsflyer|mixpanel)`),
regexp.MustCompile(`(?i)(import\s+Amplitude|AmplitudeSwift|amplitude\.init|Amplitude\.instance|amplitude-js|@amplitude/)`),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore Objective-C Amplitude SDK matching

This pattern now only recognizes Swift/JS-specific forms (import Amplitude, Amplitude.instance, @amplitude/) and misses common Objective-C integrations such as #import <Amplitude/Amplitude.h> and [Amplitude instance]. In Objective-C apps, missing-att will no longer detect Amplitude usage, so the scanner can skip a real ATT compliance warning (5.1.2); this is a regression from the previous broader amplitude match, and the same narrowed pattern is also present in internal/privacy/scanner.go.

Useful? React with 👍 / 👎.

regexp.MustCompile(`(?i)(import.*@segment/|analytics-react-native|SegmentAnalytics|createClient.*writeKey)`),
},
antiPatterns: []*regexp.Regexp{
Expand Down Expand Up @@ -182,6 +183,9 @@ func AllRules() []Rule {
regexp.MustCompile("(?i)`[^`]*\\b(lorem ipsum|placeholder|coming soon|under construction|todo|tbd)\\b[^`]*`"),
regexp.MustCompile(`(?i)\b(lorem ipsum|placeholder|coming soon|under construction|todo|tbd)\b`), // bare text (JSX content)
},
ignorePatterns: []*regexp.Regexp{
regexp.MustCompile(`(?i)(func\s+placeholder\s*\(|\.placeholder\s*[:=]|placeholder\s*[:=]\s*[A-Z]|placeholder\s*\(in\s*context)`), // Swift/WidgetKit protocol methods and property assignments
},
},
&PatternRule{
id: "console-log",
Expand Down Expand Up @@ -225,6 +229,7 @@ func AllRules() []Rule {
},
ignorePatterns: []*regexp.Regexp{
regexp.MustCompile(`(?i)(localhost|127\.0\.0\.1|0\.0\.0\.0|http://example)`),
regexp.MustCompile(`(?i)(w3\.org|xmlns|DTD|doctype)`), // XML/SVG namespace URIs and DTD references are identifiers, not network requests
},
},
&PatternRule{
Expand Down
2 changes: 1 addition & 1 deletion internal/privacy/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var trackingSDKPatterns = []struct {
{regexp.MustCompile(`(?i)(fbsdk|facebook.*sdk)`), "Facebook SDK"},
{regexp.MustCompile(`(?i)adjust.*sdk`), "Adjust SDK"},
{regexp.MustCompile(`(?i)appsflyer`), "AppsFlyer"},
{regexp.MustCompile(`(?i)(amplitude)`), "Amplitude"},
{regexp.MustCompile(`(?i)(import\s+Amplitude|AmplitudeSwift|amplitude\.init|Amplitude\.instance|amplitude-js|@amplitude/)`), "Amplitude"},
{regexp.MustCompile(`(?i)(mixpanel)`), "Mixpanel"},
{regexp.MustCompile(`(?i)(@segment/|analytics-react-native)`), "Segment"},
{regexp.MustCompile(`(?i)(branch\.io|react-native-branch)`), "Branch"},
Expand Down