Skip to content

Commit 16f46f6

Browse files
authored
Malicious site protection - iOS Ship review feedback (#1443)
1 parent 30215b3 commit 16f46f6

32 files changed

+475
-216
lines changed

special-pages/pages/special-error/app/components/App.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ function PageTitle() {
3434
useEffect(() => {
3535
switch (kind) {
3636
case 'malware':
37-
document.title = t('malwarePageHeading');
37+
document.title = t('malwareTabTitle');
3838
break;
3939
case 'phishing':
40-
document.title = t('phishingPageHeading');
40+
document.title = t('phishingTabTitle');
4141
break;
4242
default:
4343
document.title = t('sslPageHeading');

special-pages/pages/special-error/app/components/App.module.css

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ body {
1414
top: 0;
1515
left: 0;
1616

17-
1817
@media (max-height: 400px) {
1918
padding-top: var(--sp-10);
2019
align-items: flex-start;

special-pages/pages/special-error/app/components/Warning.jsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ export function WarningHeading() {
5353
return (
5454
<header className={classNames(styles.heading, styles[kind])}>
5555
<i className={styles.icon} aria-hidden="true" />
56-
<Text as="h1" variant={platformName === 'macos' ? 'title-2-emphasis' : 'title-2'} strictSpacing={platformName !== 'macos'}>
56+
<Text
57+
as="h1"
58+
variant={platformName === 'macos' ? 'title-2-emphasis' : 'title-2'}
59+
strictSpacing={platformName !== 'macos'}
60+
className={styles.title}
61+
>
5762
{heading}
5863
</Text>
5964
</header>

special-pages/pages/special-error/app/components/Warning.module.css

+20-5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787

8888
& .content {
8989
text-align: center;
90+
white-space: pre-line; /* Preserve line breaks on all screen sizes */
9091
}
9192

9293
& .buttonContainer {
@@ -117,12 +118,26 @@
117118
}
118119

119120
& .phishing .icon, & .malware .icon {
120-
background-image: url(../../../../shared/assets/img/icons/Malware-Site-96.svg);
121+
background-image: url(../../../../shared/assets/img/icons/Malware-Site-128.svg);
121122
}
122123

123-
/* Inserts line break before an inline element. Used for the Learn More link in the Warning text */
124-
& [data-line-break]::before {
125-
content: ' ';
126-
display: block;
124+
/* Preserves line breaks on smaller screens to avoid orfan words.
125+
This is a fallback for browsers that don't support text-wrap: balance */
126+
& .title {
127+
white-space: pre-line;
128+
129+
@media (min-width: 600px) {
130+
white-space: normal;
131+
}
132+
}
133+
}
134+
135+
@supports (text-wrap: balance) {
136+
/* Balanced line breaks on title for browsers that support it */
137+
[data-platform-name="ios"] {
138+
& .title {
139+
text-wrap: balance;
140+
white-space: normal;
141+
}
127142
}
128143
}

special-pages/pages/special-error/app/hooks/ErrorStrings.jsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const sanitizeURL = (urlString) => {
2727
*/
2828

2929
const helpPageAnchorTagParams = {
30-
'data-line-break': true,
3130
href: phishingMalwareHelpPageURL,
3231
target: '_blank',
3332
};
@@ -62,11 +61,11 @@ export function useWarningHeading() {
6261
const { kind } = useErrorData();
6362

6463
if (kind === 'phishing') {
65-
return t('phishingPageHeading');
64+
return t('phishingPageHeading').replace('{newline}', '\n');
6665
}
6766

6867
if (kind === 'malware') {
69-
return t('malwarePageHeading');
68+
return t('malwarePageHeading').replace('{newline}', '\n');
7069
}
7170

7271
if (kind === 'ssl') {
@@ -85,11 +84,13 @@ export function useWarningContent() {
8584
const { kind } = useErrorData();
8685

8786
if (kind === 'phishing') {
88-
return [<Trans str={t('phishingWarningText')} values={{ a: helpPageAnchorTagParams }} />];
87+
const text = t('phishingWarningText').replace('{newline}', '\n');
88+
return [<Trans str={text} values={{ a: helpPageAnchorTagParams }} />];
8989
}
9090

9191
if (kind === 'malware') {
92-
return [<Trans str={t('malwareWarningText')} values={{ a: helpPageAnchorTagParams }} />];
92+
const text = t('malwareWarningText').replace('{newline}', '\n');
93+
return [<Trans str={text} values={{ a: helpPageAnchorTagParams }} />];
9394
}
9495

9596
if (kind === 'ssl') {

special-pages/pages/special-error/integration-tests/special-error.js

+26-2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ export class SpecialErrorPage {
150150

151151
async showsExpiredPage() {
152152
const { page } = this;
153+
154+
const title = await page.locator('title').textContent();
155+
expect(title).toBe('Warning: This site may be insecure');
156+
153157
await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
154158
await expect(
155159
page.getByText(
@@ -174,6 +178,10 @@ export class SpecialErrorPage {
174178

175179
async showsInvalidPage() {
176180
const { page } = this;
181+
182+
const title = await page.locator('title').textContent();
183+
expect(title).toBe('Warning: This site may be insecure');
184+
177185
await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
178186
await expect(
179187
page.getByText(
@@ -193,6 +201,10 @@ export class SpecialErrorPage {
193201

194202
async showsSelfSignedPage() {
195203
const { page } = this;
204+
205+
const title = await page.locator('title').textContent();
206+
expect(title).toBe('Warning: This site may be insecure');
207+
196208
await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
197209
await expect(
198210
page.getByText(
@@ -212,6 +224,10 @@ export class SpecialErrorPage {
212224

213225
async showsWrongHostPage() {
214226
const { page } = this;
227+
228+
const title = await page.locator('title').textContent();
229+
expect(title).toBe('Warning: This site may be insecure');
230+
215231
await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
216232
await expect(
217233
page.getByText(
@@ -231,7 +247,11 @@ export class SpecialErrorPage {
231247

232248
async showsPhishingPage() {
233249
const { page } = this;
234-
await expect(page.getByText('Warning: This site may put your personal information at risk', { exact: true })).toBeVisible();
250+
251+
const title = await page.locator('title').textContent();
252+
expect(title).toBe('Warning: Security Risk');
253+
254+
await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible();
235255
await expect(
236256
page.getByText(
237257
'This website may be impersonating a legitimate site in order to trick you into providing personal information, such as passwords or credit card numbers. Learn more',
@@ -249,7 +269,11 @@ export class SpecialErrorPage {
249269

250270
async showsMalwarePage() {
251271
const { page } = this;
252-
await expect(page.getByText('Warning: This site may put your personal information at risk', { exact: true })).toBeVisible();
272+
273+
const title = await page.locator('title').textContent();
274+
expect(title).toBe('Warning: Security Risk');
275+
276+
await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible();
253277
await expect(
254278
page.getByText(
255279
'DuckDuckGo blocked this page because it may be distributing malware designed to compromise your device or steal your personal information. Learn more',

special-pages/pages/special-error/public/locales/bg/special-error.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,32 @@
2525
"note" : "Button shown in an error page that warns users of security risks on a website due to Phishing or Malware issues. The buttons allows the user to visit the website anyway despite the risks."
2626
},
2727
"malwarePageHeading" : {
28-
"title" : "Предупреждение: Този сайт може да изложи личната ви информация на риск",
29-
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution"
28+
"title" : "Предупреждение: Този сайт може да представлява{newline}риск за сигурността",
29+
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution. The {newline} tag should not be translated. It should be placed within the sentence to avoid having a single word hanging on the last line"
30+
},
31+
"malwareTabTitle" : {
32+
"title" : "Предупреждение: Риск за сигурността",
33+
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to malware"
3034
},
3135
"malwareWarningText" : {
32-
"title" : "DuckDuckGo блокира тази страница, защото тя може да разпространява зловреден софтуер, който да компрометира устройството ви или да открадне личната ви информация. <a>Научете повече</a>",
33-
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution."
36+
"title" : "DuckDuckGo блокира тази страница, защото тя може да разпространява зловреден софтуер, който да компрометира устройството ви или да открадне личната ви информация.{newline}<a>Научете повече</a>",
37+
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution. The {newline} tag should not be translated. It should be placed before the translated <a>Learn More</a> text."
3438
},
3539
"malwareAdvancedInfoHeading" : {
3640
"title" : "Ако смятате, че този уебсайт е безопасен, можете да <a>съобщите за грешка</a>. Все пак можете да посетите уебсайта на свой собствен риск.",
3741
"note" : "Title of the Advanced info section shown in an error page that warns users of security risks on a website due to malware distribution."
3842
},
3943
"phishingPageHeading" : {
40-
"title" : "Предупреждение: Този сайт може да изложи личната ви информация на риск",
41-
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues"
44+
"title" : "Предупреждение: Този сайт може да представлява{newline}риск за сигурността",
45+
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues. The {newline} tag should not be translated. It should be placed within the sentence to avoid having a single word hanging on the last line"
46+
},
47+
"phishingTabTitle" : {
48+
"title" : "Предупреждение: Риск за сигурността",
49+
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to phishing"
4250
},
4351
"phishingWarningText" : {
44-
"title" : "Този уебсайт може да имитира легитимен сайт, за да ви подмами да предоставите лична информация, като например пароли или номера на кредитни карти. <a>Научете повече</a>",
45-
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."
52+
"title" : "Този уебсайт може да имитира легитимен сайт, за да ви подмами да предоставите лична информация, като например пароли или номера на кредитни карти.{newline}<a>Научете повече</a>",
53+
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues. The {newline} tag should not be translated. It should be placed before the translated <a>Learn More</a> text."
4654
},
4755
"phishingAdvancedInfoHeading" : {
4856
"title" : "Ако смятате, че този уебсайт е безопасен, можете да <a>съобщите за грешка</a>. Все пак можете да посетите уебсайта на свой собствен риск.",

special-pages/pages/special-error/public/locales/cs/special-error.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,32 @@
2525
"note" : "Button shown in an error page that warns users of security risks on a website due to Phishing or Malware issues. The buttons allows the user to visit the website anyway despite the risks."
2626
},
2727
"malwarePageHeading" : {
28-
"title" : "Pozor: Tahle stránka může vystavit tvoje osobní údaje riziku",
29-
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution"
28+
"title" : "Pozor: Tahle stránka může představovat{newline}bezpečnostní riziko",
29+
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution. The {newline} tag should not be translated. It should be placed within the sentence to avoid having a single word hanging on the last line"
30+
},
31+
"malwareTabTitle" : {
32+
"title" : "Pozor: Bezpečnostní riziko",
33+
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to malware"
3034
},
3135
"malwareWarningText" : {
32-
"title" : "Služba DuckDuckGo tuhle stránku zablokovala, protože může šířit malware, jehož cílem je narušit zabezpečení zařízení nebo odcizit osobní údaje. <a>Přečti si další informace</a>.",
33-
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution."
36+
"title" : "Služba DuckDuckGo tuhle stránku zablokovala, protože může šířit malware, jehož cílem je narušit zabezpečení zařízení nebo odcizit osobní údaje.{newline}<a>Přečti si další informace.</a>",
37+
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution. The {newline} tag should not be translated. It should be placed before the translated <a>Learn More</a> text."
3438
},
3539
"malwareAdvancedInfoHeading" : {
3640
"title" : "Pokud věříš, že je tahle stránka bezpečná, můžeš <a>nahlásit chybu</a>. Můžeš taky stránku navštívit na vlastní nebezpečí.",
3741
"note" : "Title of the Advanced info section shown in an error page that warns users of security risks on a website due to malware distribution."
3842
},
3943
"phishingPageHeading" : {
40-
"title" : "Pozor: Tahle stránka může vystavit tvoje osobní údaje riziku",
41-
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues"
44+
"title" : "Pozor: Tahle stránka může představovat{newline}bezpečnostní riziko",
45+
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues. The {newline} tag should not be translated. It should be placed within the sentence to avoid having a single word hanging on the last line"
46+
},
47+
"phishingTabTitle" : {
48+
"title" : "Pozor: Bezpečnostní riziko",
49+
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to phishing"
4250
},
4351
"phishingWarningText" : {
44-
"title" : "Tahle webová stránka se může vydávat za legitimní web, aby tě přiměla k poskytnutí osobních údajů, jako jsou hesla nebo čísla kreditních karet. <a>Přečti si další informace</a>",
45-
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."
52+
"title" : "Tahle webová stránka se může vydávat za legitimní web, aby tě přiměla k poskytnutí osobních údajů, jako jsou hesla nebo čísla platebních karet.{newline}<a>Přečti si další informace.</a>",
53+
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues. The {newline} tag should not be translated. It should be placed before the translated <a>Learn More</a> text."
4654
},
4755
"phishingAdvancedInfoHeading" : {
4856
"title" : "Pokud věříš, že je tahle stránka bezpečná, můžeš <a>nahlásit chybu</a>. Můžeš taky stránku navštívit na vlastní nebezpečí.",

special-pages/pages/special-error/public/locales/da/special-error.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,32 @@
2525
"note" : "Button shown in an error page that warns users of security risks on a website due to Phishing or Malware issues. The buttons allows the user to visit the website anyway despite the risks."
2626
},
2727
"malwarePageHeading" : {
28-
"title" : "Advarsel: Denne side kan udgøre en risiko for dine personlige oplysninger",
29-
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution"
28+
"title" : "Advarsel: Dette websted kan udgøre en{newline}sikkerhedsrisiko",
29+
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution. The {newline} tag should not be translated. It should be placed within the sentence to avoid having a single word hanging on the last line"
30+
},
31+
"malwareTabTitle" : {
32+
"title" : "Advarsel: Sikkerhedsrisiko",
33+
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to malware"
3034
},
3135
"malwareWarningText" : {
32-
"title" : "DuckDuckGo har blokeret denne side, fordi den muligvis distribuerer malware, der er designet til at kompromittere din enhed eller stjæle dine personlige oplysninger. <a>Få mere at vide</a>",
33-
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution."
36+
"title" : "DuckDuckGo har blokeret denne side, fordi den muligvis distribuerer malware, der er designet til at kompromittere din enhed eller stjæle dine personlige oplysninger.{newline}<a>Få mere at vide</a>",
37+
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution. The {newline} tag should not be translated. It should be placed before the translated <a>Learn More</a> text."
3438
},
3539
"malwareAdvancedInfoHeading" : {
3640
"title" : "Hvis du mener, at dette websted er sikkert, kan du <a>anmelde en fejl</a>. Du kan stadig besøge webstedet på eget ansvar.",
3741
"note" : "Title of the Advanced info section shown in an error page that warns users of security risks on a website due to malware distribution."
3842
},
3943
"phishingPageHeading" : {
40-
"title" : "Advarsel: Denne side kan udgøre en risiko for dine personlige oplysninger",
41-
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues"
44+
"title" : "Advarsel: Dette websted kan udgøre en{newline}sikkerhedsrisiko",
45+
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues. The {newline} tag should not be translated. It should be placed within the sentence to avoid having a single word hanging on the last line"
46+
},
47+
"phishingTabTitle" : {
48+
"title" : "Advarsel: Sikkerhedsrisiko",
49+
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to phishing"
4250
},
4351
"phishingWarningText" : {
44-
"title" : "Dette websted efterligner muligvis et legitimt websted for at narre dig til at give personlige oplysninger, såsom adgangskoder eller kreditkortnumre. <a>Få mere at vide</a>",
45-
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."
52+
"title" : "Dette websted efterligner muligvis et legitimt websted for at narre dig til at give personlige oplysninger, såsom adgangskoder eller kreditkortnumre.{newline}<a>Få mere at vide</a>",
53+
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues. The {newline} tag should not be translated. It should be placed before the translated <a>Learn More</a> text."
4654
},
4755
"phishingAdvancedInfoHeading" : {
4856
"title" : "Hvis du mener, at dette websted er sikkert, kan du <a>anmelde en fejl</a>. Du kan stadig besøge webstedet på eget ansvar.",

0 commit comments

Comments
 (0)