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

Feat/security headers #4842

Merged
merged 8 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ const moduleExports = withBundleAnalyzer({
key: 'Access-Control-Allow-Headers',
value: 'X-Requested-With, content-type, Authorization',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'Content-Security-Policy',
value: "frame-ancestors 'self'",
},
],
},
];
Expand Down
12 changes: 11 additions & 1 deletion src/components/views/verification/EmailVerificationIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,20 @@ export default function EmailVerificationIndex() {
}

function Verified() {
const [querySlug, setQuerySlug] = useState<string | undefined>(undefined);
const router = useRouter();
const { slug } = router.query;
const { formatMessage } = useIntl();

// we must wait for the router to be ready to get the slug from the query
useEffect(() => {
if (router.isReady) {
if (typeof slug === 'string') {
setQuerySlug(slug);
}
}
}, [router.isReady, slug]);

return (
<>
<Image
Expand All @@ -99,7 +109,7 @@ function Verified() {
})}
</Lead>
<LinkHolder>
<Link href={slugToVerification(slug as string)}>
<Link href={slugToVerification(querySlug as string)}>
<ButtonLink
size='small'
label={
Expand Down
Loading