Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 1c3e122

Browse files
fix: directly check if the hostname is the expected hostname instead of just starting with the hostname (#1223)
For security's sake the entire hostname should be checked against, not just that it starts with the hostname, otherwise another domain could just include this as a subdomain
1 parent e744102 commit 1c3e122

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ jobs:
8484
<<: *job_defaults
8585
steps:
8686
- checkout
87-
- browser-tools/install-chrome
8887
- restore_cache:
8988
key: *cache_key
9089
- *yarn_install

src/app/pages/homepage/homepage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Homepage implements OnInit {
4040
@HostBinding('class.main-content') readonly mainContentClass = true;
4141
@HostBinding('class.animations-disabled') readonly animationsDisabled: boolean;
4242

43-
isNextVersion = location.hostname.startsWith('next.material.angular.io');
43+
isNextVersion = location.hostname === 'next.material.angular.io';
4444

4545
constructor(
4646
public _componentPageTitle: ComponentPageTitle,

src/app/shared/footer/footer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {VERSION} from '@angular/material/core';
88
standalone: true
99
})
1010
export class Footer {
11-
isNextVersion = location.hostname.startsWith('next.material.angular.io');
11+
isNextVersion = location.hostname === 'next.material.angular.io';
1212
version = VERSION.full;
1313
year = new Date().getFullYear();
1414
}

src/app/shared/navbar/navbar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const SECTIONS_KEYS = Object.keys(SECTIONS);
2020
})
2121
export class NavBar implements OnDestroy {
2222
private subscriptions = new Subscription();
23-
isNextVersion = location.hostname.startsWith('next.material.angular.io');
23+
isNextVersion = location.hostname === 'next.material.angular.io';
2424
skipLinkHref: string | null | undefined;
2525
skipLinkHidden = true;
2626

0 commit comments

Comments
 (0)