Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Firefox < 128 and != 115 as incompatible due to root CA expiration #13502

Merged
merged 4 commits into from
Mar 19, 2025
Merged
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
2 changes: 2 additions & 0 deletions src/amo/constants.js
Original file line number Diff line number Diff line change
@@ -113,6 +113,8 @@ export const VISIBLE_ADDON_TYPES_MAPPING: {|

// Incompatibility codes for clients that can't install an add-on.
export const INCOMPATIBLE_FIREFOX_FOR_IOS = 'INCOMPATIBLE_FIREFOX_FOR_IOS';
export const INCOMPATIBLE_OLD_ROOT_CERT_VERSION =
'INCOMPATIBLE_OLD_ROOT_CERT_VERSION';
export const INCOMPATIBLE_OVER_MAX_VERSION = 'INCOMPATIBLE_OVER_MAX_VERSION';
export const INCOMPATIBLE_NOT_FIREFOX = 'INCOMPATIBLE_NOT_FIREFOX';
export const INCOMPATIBLE_UNDER_MIN_VERSION = 'INCOMPATIBLE_UNDER_MIN_VERSION';
24 changes: 24 additions & 0 deletions src/amo/utils/compatibility.js
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ import {
INCOMPATIBLE_ANDROID_UNSUPPORTED,
INCOMPATIBLE_FIREFOX_FOR_IOS,
INCOMPATIBLE_NOT_FIREFOX,
INCOMPATIBLE_OLD_ROOT_CERT_VERSION,
INCOMPATIBLE_OVER_MAX_VERSION,
INCOMPATIBLE_UNDER_MIN_VERSION,
INCOMPATIBLE_UNSUPPORTED_PLATFORM,
@@ -77,6 +78,25 @@ export const isFirefox = ({
return userAgentInfo.browser.name === 'Firefox';
};

export const isFirefoxWithOldRootCerts = ({
userAgentInfo,
}: {|
userAgentInfo: UserAgentInfoType,
|}): boolean => {
// If the userAgent is false there was likely a programming error.
invariant(userAgentInfo, 'userAgentInfo is required');

const majorAppVersion = parseInt(userAgentInfo.browser?.version, 10);

return (
isFirefox({ userAgentInfo }) &&
// Firefox 128 and higher or latest Firefox ESR 115 have the updated root.
// We can't single out ESR but excluding 115 entirely is good enough.
majorAppVersion < 128 &&
majorAppVersion !== 115
);
};

export const isDesktop = ({
userAgentInfo,
}: {|
@@ -173,6 +193,10 @@ export function isCompatibleWithUserAgent({
};
}

if (isFirefoxWithOldRootCerts({ userAgentInfo })) {
return { compatible: false, reason: INCOMPATIBLE_OLD_ROOT_CERT_VERSION };
}

// Do version checks, if this add-on has minimum or maximum version
// requirements.
// The addons-moz-compare API is quite strange; a result of
6 changes: 3 additions & 3 deletions tests/unit/amo/test_searchUtils.js
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ describe(__filename, () => {
describe('when clientApp is CLIENT_APP_ANDROID', () => {
it('does not set promoted and does not override compatibleWithVersion when browser is Firefox for Android', () => {
const { state } = dispatchClientMetadata({
userAgent: userAgentsByPlatform.android.firefox70,
userAgent: userAgentsByPlatform.android.firefox136,
});

const newFilters = addVersionCompatibilityToFilters({
@@ -115,14 +115,14 @@ describe(__filename, () => {
expect(newFilters).toEqual({
addonType: ADDON_TYPE_EXTENSION,
clientApp: CLIENT_APP_ANDROID,
compatibleWithVersion: '70.0',
compatibleWithVersion: '136.0',
query: 'foo',
});
});

it.each([
// This works because it is Firefox Desktop.
userAgentsByPlatform.windows.firefox40,
userAgentsByPlatform.windows.firefox115,
userAgentsByPlatform.mac.chrome41,
])(
'does not set promoted but overrides compatibleWithVersion when browser is not Firefox for Android - userAgent: %s',
Loading