-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(showcase): prevent arbitrary url evaluation
- Loading branch information
Showing
10 changed files
with
69 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.38 KB
(100%)
...e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/sdk-generator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
export * from './date-picker-input/index'; | ||
export * from './otter-picker/index'; | ||
export * from './copy-text/index'; | ||
export * from './date-picker-input/index'; | ||
export * from './date-picker-input-hebrew/index'; | ||
export * from './in-page-nav/index'; | ||
export * from './otter-picker/index'; | ||
export * from './scroll-back-top/index'; | ||
export * from './sidenav/index'; | ||
export * from './date-picker-input/index'; | ||
export * from './date-picker-input-hebrew/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './otter-icon-path.pipe'; | ||
export * from './otter-picker-pres.component'; | ||
|
15 changes: 15 additions & 0 deletions
15
apps/showcase/src/components/utilities/otter-picker/otter-icon-path.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { isOtterIcon, OTTER_ICONS } from './otter-icons'; | ||
|
||
@Pipe({ | ||
name: 'otterIconPath', | ||
standalone: true | ||
}) | ||
export class OtterIconPathPipe implements PipeTransform { | ||
private readonly BASE_URL = location.href.split('/#', 1)[0]; | ||
|
||
/** @inheritDoc */ | ||
public transform(value: string) { | ||
return `${this.BASE_URL}${isOtterIcon(value) ? value : OTTER_ICONS[0]}`; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
apps/showcase/src/components/utilities/otter-picker/otter-icons.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** List of icons proposed by the otter-picker */ | ||
export const OTTER_ICONS = [ | ||
'/assets/otter.svg', | ||
'/assets/mini-otters/astronotter.svg', | ||
'/assets/mini-otters/bonotter.svg', | ||
'/assets/mini-otters/c3potter.svg', | ||
'/assets/mini-otters/colombotter.svg', | ||
'/assets/mini-otters/djokotter.svg', | ||
'/assets/mini-otters/hallowtter.svg', | ||
'/assets/mini-otters/harry-otter.svg', | ||
'/assets/mini-otters/jack-sparrowtter.svg', | ||
'/assets/mini-otters/mandalotter.svg', | ||
'/assets/mini-otters/mariotter.svg', | ||
'/assets/mini-otters/neotter.svg', | ||
'/assets/mini-otters/pizzaiotter.svg', | ||
'/assets/mini-otters/ronaldotter.svg', | ||
'/assets/mini-otters/sombrerotter.svg' | ||
] as const; | ||
|
||
/** | ||
* Check if the given path corresponds to an icon proposed by the otter-picker | ||
* @param path | ||
*/ | ||
export const isOtterIcon = (path: string): path is typeof OTTER_ICONS[number] => { | ||
return OTTER_ICONS.includes(path as typeof OTTER_ICONS[number]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters