-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add security headers to nextjs config to prevent XSS attacks and clickjacking #4841
Comments
@geleeroyale can you check do we have some default vercel headers serving Giveth app? thx |
@kkatusic the frontend config should be located in next-config.ts and we have CORS configured on the reverse proxy to access Apart from that I think we did not set any headers. Here is the CORS config we are using:
|
@geleeroyale ok and that's ok, but look at header that you get from giveth.io and look, what extra we defined inside next.config.js file: giveth-dapps-v2/next.config.js Line 156 in 66e0051
|
Yes - It looks like its not properly configured. Please take a deeper look into this. |
@geleeroyale can you test inside preview link these security headers: https://giveth-dapps-v2-git-feat-securityheaders-givethio.vercel.app/ |
Sorry - missed this. Will take a look. |
@kkatusic Sorry for taking so long - I reviewed your PR and it is a great improvement - specifically as requested X-Frame Options (disallows using giveth in iframes) and content security policy (prevents against cross site scripting attacks) have now been implemented. 1 - I did not use these testing sites before and we might want to try to reach A grade by implementing the rest of recommended security headers Edit: Results are taken from https://securityheaders.com - also a good resource is Mozilla Observatory for quick checks (https://developer.mozilla.org/en-US/observatory) |
Thx @geleeroyale for reply, can you check now with new ones added headers: https://giveth-dapps-v2-git-feat-securityheaders-givethio.vercel.app/ thx |
thx @geleeroyale. |
For QA people, I tested donation, checked values and seems that everything is working fine, maybe some external api url request can fail, just to notice here if it is blocked by newly added headers. |
We got some reports in the past that it is possible to run a "clickjacking" attack against giveth.io
(essentially people could embed the whole site in an iframe and display it on their site, changing some links in their portal to their own)
Now this is known and has been like that for a long time without being exploited (its also quite hard to do something useful) ... regardless, we should probably fix it.
https://dev.to/theinfosecguy/how-to-protect-your-nextjs-website-from-clickjacking-2jbg
https://nextjs.org/docs/pages/building-your-application/configuring/content-security-policy
The text was updated successfully, but these errors were encountered: