Skip to content

Fixed false-positive Mobile Safari detection for AppleCoreMedia/1.0.0… - #8369

Open
ionut-slaveanu wants to merge 4 commits into
matomo-org:masterfrom
ionut-slaveanu:master
Open

Fixed false-positive Mobile Safari detection for AppleCoreMedia/1.0.0…#8369
ionut-slaveanu wants to merge 4 commits into
matomo-org:masterfrom
ionut-slaveanu:master

Conversation

@ionut-slaveanu

Copy link
Copy Markdown

AppleCoreMedia/1.0.0.18G82 (iPhone; U; CPU OS 14_7_1 like Mac OS X; es_xl)

Description

Fix detection of AppleCoreMedia user agents that are incorrectly identified as Mobile Safari.

User agents such as:

  • AppleCoreMedia/1.0.0.18G82 (iPhone; U; CPU OS 14_7_1 like Mac OS X; es_xl)

contain iPhone, causing them to match the Mobile Safari browser regex even though the user agent represents an iOS application using AppleCoreMedia/1.0.0 framewiork.

The

  • AppleCoreMedia/1.0.0.18G82 (iPhone; U; CPU OS 14_7_1 like Mac OS X; es_xl)

user agent should match the following regex from regexes/client/libraries.yml:

  • regex: 'AppleCoreMedia/1.0.0'
    name: 'iOS Application'
    version: ''

Instead, it currently matches the Mobile Safari regex from regexes/client/browsers.yml:

  • regex: '(?!^AppleCoreMedia/1.0.0)(?:iPod|(?<!Apple TV; U; CPU )iPhone|iPad)'
    name: 'Mobile Safari'
    version: ''
    engine:

Expected behavior
AppleCoreMedia/1.0.0 (iPhone; ...) → iOS Application

Checklist

  • [✔/✖/NA] I have understood, reviewed, and tested all AI outputs before use
  • [✔/✖/NA] All AI instructions respect security, IP, and privacy rules

Review

@liviuconcioiu

Copy link
Copy Markdown
Collaborator

@ionut-slaveanu you need to move the test to /Tests/Parser/Client/fixtures/library.yml, since client is a library.

-
  user_agent: AppleCoreMedia/1.0.0.18G82 (iPhone; U; CPU OS 14_7_1 like Mac OS X; es_xl)
  client:
    type: library
    name: iOS Application
    version: ""

@ionut-slaveanu

Copy link
Copy Markdown
Author

@ionut-slaveanu you need to move the test to /Tests/Parser/Client/fixtures/library.yml, since client is a library.

-
  user_agent: AppleCoreMedia/1.0.0.18G82 (iPhone; U; CPU OS 14_7_1 like Mac OS X; es_xl)
  client:
    type: library
    name: iOS Application
    version: ""

Done!

@liviuconcioiu liviuconcioiu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I made some code suggestions that can be merged.

You need to also replace lines:

- regex: 'AppleCoreMedia/1\.0\.0'
name: 'iOS Application'

with:

- regex: 'AppleCoreMedia'
  name: 'Apple Core Media'

Line:

- regex: 'Macintosh'

with:

- regex: '^(?!AppleCoreMedia).*?\bMacintosh'

After you make the changes, run ./vendor/bin/phpunit and fix all tests.

Comment thread regexes/client/browsers.yml Outdated
Comment thread Tests/Parser/Client/fixtures/library.yml Outdated
ionut-slaveanu and others added 2 commits August 18, 2026 21:10
Co-authored-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
@ionut-slaveanu

ionut-slaveanu commented Aug 18, 2026

Copy link
Copy Markdown
Author

I made some code suggestions that can be merged.

You need to also replace lines:

- regex: 'AppleCoreMedia/1\.0\.0'
name: 'iOS Application'

with:

- regex: 'AppleCoreMedia'
  name: 'Apple Core Media'

Line:

- regex: 'Macintosh'

with:

- regex: '^(?!AppleCoreMedia).*?\bMacintosh'

After you make the changes, run ./vendor/bin/phpunit and fix all tests.

Done!

@liviuconcioiu

Copy link
Copy Markdown
Collaborator

This should close #5869. AppleCoreMedia is used by other podcast apps too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants