Skip to content

Commit

Permalink
Prevent client-side cross-site scripting via user defined image src
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed Jan 13, 2025
1 parent b185938 commit ffe44c7
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useControllerTheme } from "@/hooks/theme";
import { cn, IconProps } from "@cartridge/ui-next";

export type BannerProps = {
Expand Down Expand Up @@ -55,8 +54,6 @@ function HeaderIcon({
Icon,
icon,
}: Pick<BannerProps, "variant" | "Icon" | "icon">) {
const theme = useControllerTheme();

return (
<IconWrapper variant={variant}>
{(() => {
Expand All @@ -69,11 +66,7 @@ function HeaderIcon({
}

return (
<img
src={theme.icon}
className="size-full rounded"
alt="Controller Header Icon"
/>
<div className="size-full rounded bg-[image:var(--theme-icon-url)] bg-cover bg-center" />
);
})()}
</IconWrapper>
Expand Down

0 comments on commit ffe44c7

Please sign in to comment.