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

Malicious site protection - iOS Ship review feedback #1443

Merged
merged 7 commits into from
Feb 4, 2025
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
4 changes: 2 additions & 2 deletions special-pages/pages/special-error/app/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ function PageTitle() {
useEffect(() => {
switch (kind) {
case 'malware':
document.title = t('malwarePageHeading');
document.title = t('malwareTabTitle');
break;
case 'phishing':
document.title = t('phishingPageHeading');
document.title = t('phishingTabTitle');
break;
default:
document.title = t('sslPageHeading');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ body {
top: 0;
left: 0;


@media (max-height: 400px) {
padding-top: var(--sp-10);
align-items: flex-start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ export function WarningHeading() {
return (
<header className={classNames(styles.heading, styles[kind])}>
<i className={styles.icon} aria-hidden="true" />
<Text as="h1" variant={platformName === 'macos' ? 'title-2-emphasis' : 'title-2'} strictSpacing={platformName !== 'macos'}>
<Text
as="h1"
variant={platformName === 'macos' ? 'title-2-emphasis' : 'title-2'}
strictSpacing={platformName !== 'macos'}
className={styles.title}
>
{heading}
</Text>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

& .content {
text-align: center;
white-space: pre-line; /* Preserve line breaks on all screen sizes */
}

& .buttonContainer {
Expand Down Expand Up @@ -117,12 +118,26 @@
}

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

/* Inserts line break before an inline element. Used for the Learn More link in the Warning text */
& [data-line-break]::before {
content: ' ';
display: block;
/* Preserves line breaks on smaller screens to avoid orfan words.
This is a fallback for browsers that don't support text-wrap: balance */
& .title {
white-space: pre-line;

@media (min-width: 600px) {
white-space: normal;
}
}
}

@supports (text-wrap: balance) {
/* Balanced line breaks on title for browsers that support it */
[data-platform-name="ios"] {
& .title {
text-wrap: balance;
white-space: normal;
}
}
}
11 changes: 6 additions & 5 deletions special-pages/pages/special-error/app/hooks/ErrorStrings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const sanitizeURL = (urlString) => {
*/

const helpPageAnchorTagParams = {
'data-line-break': true,
href: phishingMalwareHelpPageURL,
target: '_blank',
};
Expand Down Expand Up @@ -62,11 +61,11 @@ export function useWarningHeading() {
const { kind } = useErrorData();

if (kind === 'phishing') {
return t('phishingPageHeading');
return t('phishingPageHeading').replace('{newline}', '\n');
}

if (kind === 'malware') {
return t('malwarePageHeading');
return t('malwarePageHeading').replace('{newline}', '\n');
}

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

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

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

if (kind === 'ssl') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@

async showsExpiredPage() {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: This site may be insecure');

Check failure on line 155 in special-pages/pages/special-error/integration-tests/special-error.js

View workflow job for this annotation

GitHub Actions / integration

[macos] › pages/special-error/integration-tests/special-error.spec.js:21:5 › special-error › shows SSL expired cert error

1) [macos] › pages/special-error/integration-tests/special-error.spec.js:21:5 › special-error › shows SSL expired cert error Error: expect(received).toBe(expected) // Object.is equality Expected: "Warning: This site may be insecure" Received: "Error" at pages/special-error/integration-tests/special-error.js:155 153 | 154 | const title = await page.locator('title').textContent(); > 155 | expect(title).toBe('Warning: This site may be insecure'); | ^ 156 | 157 | await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); 158 | await expect( at SpecialErrorPage.showsExpiredPage (/home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.js:155:23) at /home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.spec.js:24:9

await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
await expect(
page.getByText(
Expand All @@ -174,6 +178,10 @@

async showsInvalidPage() {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: This site may be insecure');

Check failure on line 183 in special-pages/pages/special-error/integration-tests/special-error.js

View workflow job for this annotation

GitHub Actions / integration

[macos] › pages/special-error/integration-tests/special-error.spec.js:33:5 › special-error › shows SSL invalid cert error

2) [macos] › pages/special-error/integration-tests/special-error.spec.js:33:5 › special-error › shows SSL invalid cert error Error: expect(received).toBe(expected) // Object.is equality Expected: "Warning: This site may be insecure" Received: "Error" at pages/special-error/integration-tests/special-error.js:183 181 | 182 | const title = await page.locator('title').textContent(); > 183 | expect(title).toBe('Warning: This site may be insecure'); | ^ 184 | 185 | await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); 186 | await expect( at SpecialErrorPage.showsInvalidPage (/home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.js:183:23) at /home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.spec.js:36:9

await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
await expect(
page.getByText(
Expand All @@ -193,6 +201,10 @@

async showsSelfSignedPage() {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: This site may be insecure');

Check failure on line 206 in special-pages/pages/special-error/integration-tests/special-error.js

View workflow job for this annotation

GitHub Actions / integration

[macos] › pages/special-error/integration-tests/special-error.spec.js:39:5 › special-error › shows SSL self signed cert error

3) [macos] › pages/special-error/integration-tests/special-error.spec.js:39:5 › special-error › shows SSL self signed cert error Error: expect(received).toBe(expected) // Object.is equality Expected: "Warning: This site may be insecure" Received: "Error" at pages/special-error/integration-tests/special-error.js:206 204 | 205 | const title = await page.locator('title').textContent(); > 206 | expect(title).toBe('Warning: This site may be insecure'); | ^ 207 | 208 | await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); 209 | await expect( at SpecialErrorPage.showsSelfSignedPage (/home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.js:206:23) at /home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.spec.js:42:9

await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
await expect(
page.getByText(
Expand All @@ -212,6 +224,10 @@

async showsWrongHostPage() {
const { page } = this;

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: This site may be insecure');

Check failure on line 229 in special-pages/pages/special-error/integration-tests/special-error.js

View workflow job for this annotation

GitHub Actions / integration

[macos] › pages/special-error/integration-tests/special-error.spec.js:45:5 › special-error › shows SSL wrong host error

4) [macos] › pages/special-error/integration-tests/special-error.spec.js:45:5 › special-error › shows SSL wrong host error Error: expect(received).toBe(expected) // Object.is equality Expected: "Warning: This site may be insecure" Received: "Error" at pages/special-error/integration-tests/special-error.js:229 227 | 228 | const title = await page.locator('title').textContent(); > 229 | expect(title).toBe('Warning: This site may be insecure'); | ^ 230 | 231 | await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); 232 | await expect( at SpecialErrorPage.showsWrongHostPage (/home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.js:229:23) at /home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.spec.js:48:9

await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible();
await expect(
page.getByText(
Expand All @@ -231,7 +247,11 @@

async showsPhishingPage() {
const { page } = this;
await expect(page.getByText('Warning: This site may put your personal information at risk', { exact: true })).toBeVisible();

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: Security Risk');

Check failure on line 252 in special-pages/pages/special-error/integration-tests/special-error.js

View workflow job for this annotation

GitHub Actions / integration

[macos] › pages/special-error/integration-tests/special-error.spec.js:51:5 › special-error › shows phishing warning

5) [macos] › pages/special-error/integration-tests/special-error.spec.js:51:5 › special-error › shows phishing warning Error: expect(received).toBe(expected) // Object.is equality Expected: "Warning: Security Risk" Received: "Error" at pages/special-error/integration-tests/special-error.js:252 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(); 255 | await expect( at SpecialErrorPage.showsPhishingPage (/home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.js:252:23) at /home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.spec.js:54:9

await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible();
await expect(
page.getByText(
'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',
Expand All @@ -249,7 +269,11 @@

async showsMalwarePage() {
const { page } = this;
await expect(page.getByText('Warning: This site may put your personal information at risk', { exact: true })).toBeVisible();

const title = await page.locator('title').textContent();
expect(title).toBe('Warning: Security Risk');

Check failure on line 274 in special-pages/pages/special-error/integration-tests/special-error.js

View workflow job for this annotation

GitHub Actions / integration

[macos] › pages/special-error/integration-tests/special-error.spec.js:57:5 › special-error › shows malware warning

6) [macos] › pages/special-error/integration-tests/special-error.spec.js:57:5 › special-error › shows malware warning Error: expect(received).toBe(expected) // Object.is equality Expected: "Warning: Security Risk" Received: "Error" at pages/special-error/integration-tests/special-error.js:274 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(); 277 | await expect( at SpecialErrorPage.showsMalwarePage (/home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.js:274:23) at /home/runner/work/content-scope-scripts/content-scope-scripts/special-pages/pages/special-error/integration-tests/special-error.spec.js:60:9

await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible();
await expect(
page.getByText(
'DuckDuckGo blocked this page because it may be distributing malware designed to compromise your device or steal your personal information. Learn more',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,32 @@
"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."
},
"malwarePageHeading" : {
"title" : "Предупреждение: Този сайт може да изложи личната ви информация на риск",
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution"
"title" : "Предупреждение: Този сайт може да представлява{newline}риск за сигурността",
"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"
},
"malwareTabTitle" : {
"title" : "Предупреждение: Риск за сигурността",
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to malware"
},
"malwareWarningText" : {
"title" : "DuckDuckGo блокира тази страница, защото тя може да разпространява зловреден софтуер, който да компрометира устройството ви или да открадне личната ви информация. <a>Научете повече</a>",
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution."
"title" : "DuckDuckGo блокира тази страница, защото тя може да разпространява зловреден софтуер, който да компрометира устройството ви или да открадне личната ви информация.{newline}<a>Научете повече</a>",
"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."
},
"malwareAdvancedInfoHeading" : {
"title" : "Ако смятате, че този уебсайт е безопасен, можете да <a>съобщите за грешка</a>. Все пак можете да посетите уебсайта на свой собствен риск.",
"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."
},
"phishingPageHeading" : {
"title" : "Предупреждение: Този сайт може да изложи личната ви информация на риск",
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues"
"title" : "Предупреждение: Този сайт може да представлява{newline}риск за сигурността",
"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"
},
"phishingTabTitle" : {
"title" : "Предупреждение: Риск за сигурността",
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to phishing"
},
"phishingWarningText" : {
"title" : "Този уебсайт може да имитира легитимен сайт, за да ви подмами да предоставите лична информация, като например пароли или номера на кредитни карти. <a>Научете повече</a>",
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."
"title" : "Този уебсайт може да имитира легитимен сайт, за да ви подмами да предоставите лична информация, като например пароли или номера на кредитни карти.{newline}<a>Научете повече</a>",
"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."
},
"phishingAdvancedInfoHeading" : {
"title" : "Ако смятате, че този уебсайт е безопасен, можете да <a>съобщите за грешка</a>. Все пак можете да посетите уебсайта на свой собствен риск.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,32 @@
"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."
},
"malwarePageHeading" : {
"title" : "Pozor: Tahle stránka může vystavit tvoje osobní údaje riziku",
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution"
"title" : "Pozor: Tahle stránka může představovat{newline}bezpečnostní riziko",
"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"
},
"malwareTabTitle" : {
"title" : "Pozor: Bezpečnostní riziko",
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to malware"
},
"malwareWarningText" : {
"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>.",
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution."
"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>",
"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."
},
"malwareAdvancedInfoHeading" : {
"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čí.",
"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."
},
"phishingPageHeading" : {
"title" : "Pozor: Tahle stránka může vystavit tvoje osobní údaje riziku",
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues"
"title" : "Pozor: Tahle stránka může představovat{newline}bezpečnostní riziko",
"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"
},
"phishingTabTitle" : {
"title" : "Pozor: Bezpečnostní riziko",
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to phishing"
},
"phishingWarningText" : {
"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>",
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."
"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>",
"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."
},
"phishingAdvancedInfoHeading" : {
"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čí.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,32 @@
"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."
},
"malwarePageHeading" : {
"title" : "Advarsel: Denne side kan udgøre en risiko for dine personlige oplysninger",
"note" : "Title shown in an error page that warn users of security risks on a website due to malware distribution"
"title" : "Advarsel: Dette websted kan udgøre en{newline}sikkerhedsrisiko",
"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"
},
"malwareTabTitle" : {
"title" : "Advarsel: Sikkerhedsrisiko",
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to malware"
},
"malwareWarningText" : {
"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>",
"note" : "Error description shown in an error page that warns users of security risks on a website due to malware distribution."
"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>",
"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."
},
"malwareAdvancedInfoHeading" : {
"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.",
"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."
},
"phishingPageHeading" : {
"title" : "Advarsel: Denne side kan udgøre en risiko for dine personlige oplysninger",
"note" : "Title shown in an error page that warn users of security risks on a website due to Phishing issues"
"title" : "Advarsel: Dette websted kan udgøre en{newline}sikkerhedsrisiko",
"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"
},
"phishingTabTitle" : {
"title" : "Advarsel: Sikkerhedsrisiko",
"note" : "Title shown in the browser window or tab when the current page may be a security risk due to phishing"
},
"phishingWarningText" : {
"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>",
"note" : "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."
"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>",
"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."
},
"phishingAdvancedInfoHeading" : {
"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.",
Expand Down
Loading
Loading