Skip to content

Commit e534d4c

Browse files
authored
Consider Firefox < 128 and != 115 as incompatible due to root CA expiration (#13502)
* Consider Firefox < 128 and != 115 as incompatible due to root CA expiration For now, this only applies to compatibility checks, so this will cause the add-on detail pages to show the "You need an updated version of Firefox" warning and button to show up instead of the install button for those users.
1 parent 6c3bb62 commit e534d4c

File tree

5 files changed

+134
-49
lines changed

5 files changed

+134
-49
lines changed

src/amo/constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ export const VISIBLE_ADDON_TYPES_MAPPING: {|
113113

114114
// Incompatibility codes for clients that can't install an add-on.
115115
export const INCOMPATIBLE_FIREFOX_FOR_IOS = 'INCOMPATIBLE_FIREFOX_FOR_IOS';
116+
export const INCOMPATIBLE_OLD_ROOT_CERT_VERSION =
117+
'INCOMPATIBLE_OLD_ROOT_CERT_VERSION';
116118
export const INCOMPATIBLE_OVER_MAX_VERSION = 'INCOMPATIBLE_OVER_MAX_VERSION';
117119
export const INCOMPATIBLE_NOT_FIREFOX = 'INCOMPATIBLE_NOT_FIREFOX';
118120
export const INCOMPATIBLE_UNDER_MIN_VERSION = 'INCOMPATIBLE_UNDER_MIN_VERSION';

src/amo/utils/compatibility.js

+24
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
INCOMPATIBLE_ANDROID_UNSUPPORTED,
1717
INCOMPATIBLE_FIREFOX_FOR_IOS,
1818
INCOMPATIBLE_NOT_FIREFOX,
19+
INCOMPATIBLE_OLD_ROOT_CERT_VERSION,
1920
INCOMPATIBLE_OVER_MAX_VERSION,
2021
INCOMPATIBLE_UNDER_MIN_VERSION,
2122
INCOMPATIBLE_UNSUPPORTED_PLATFORM,
@@ -77,6 +78,25 @@ export const isFirefox = ({
7778
return userAgentInfo.browser.name === 'Firefox';
7879
};
7980

81+
export const isFirefoxWithOldRootCerts = ({
82+
userAgentInfo,
83+
}: {|
84+
userAgentInfo: UserAgentInfoType,
85+
|}): boolean => {
86+
// If the userAgent is false there was likely a programming error.
87+
invariant(userAgentInfo, 'userAgentInfo is required');
88+
89+
const majorAppVersion = parseInt(userAgentInfo.browser?.version, 10);
90+
91+
return (
92+
isFirefox({ userAgentInfo }) &&
93+
// Firefox 128 and higher or latest Firefox ESR 115 have the updated root.
94+
// We can't single out ESR but excluding 115 entirely is good enough.
95+
majorAppVersion < 128 &&
96+
majorAppVersion !== 115
97+
);
98+
};
99+
80100
export const isDesktop = ({
81101
userAgentInfo,
82102
}: {|
@@ -173,6 +193,10 @@ export function isCompatibleWithUserAgent({
173193
};
174194
}
175195

196+
if (isFirefoxWithOldRootCerts({ userAgentInfo })) {
197+
return { compatible: false, reason: INCOMPATIBLE_OLD_ROOT_CERT_VERSION };
198+
}
199+
176200
// Do version checks, if this add-on has minimum or maximum version
177201
// requirements.
178202
// The addons-moz-compare API is quite strange; a result of

tests/unit/amo/test_searchUtils.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe(__filename, () => {
104104
describe('when clientApp is CLIENT_APP_ANDROID', () => {
105105
it('does not set promoted and does not override compatibleWithVersion when browser is Firefox for Android', () => {
106106
const { state } = dispatchClientMetadata({
107-
userAgent: userAgentsByPlatform.android.firefox70,
107+
userAgent: userAgentsByPlatform.android.firefox136,
108108
});
109109

110110
const newFilters = addVersionCompatibilityToFilters({
@@ -115,14 +115,14 @@ describe(__filename, () => {
115115
expect(newFilters).toEqual({
116116
addonType: ADDON_TYPE_EXTENSION,
117117
clientApp: CLIENT_APP_ANDROID,
118-
compatibleWithVersion: '70.0',
118+
compatibleWithVersion: '136.0',
119119
query: 'foo',
120120
});
121121
});
122122

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

0 commit comments

Comments
 (0)