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

Add Content Security Policy (CSP) to enhance security #1118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

usernayeem
Copy link

@usernayeem usernayeem commented Aug 31, 2024

Description

This pull request introduces a Content Security Policy (CSP) to the devFind application. The CSP is designed to enhance the security of the application by restricting the sources from which content can be loaded. This helps to reduce the risk of cross-site scripting (XSS) and other injection attacks.

Related Issues

#1117

Changes Proposed

  • Added a CSP meta tag to the main HTML file with the following directives:
    • default-src 'none';: Disallows all content by default.
    • script-src 'self' 'unsafe-inline';: Allows scripts only from the same origin and inline scripts.
    • style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;: Permits styles from the same origin, inline styles, and Google Fonts.
    • font-src 'self' https://fonts.gstatic.com;: Restricts font loading to the same origin and Google Fonts.
    • img-src 'self' https://github.com/ https://avatars.githubusercontent.com/ https://pbs.twimg.com;: Allows images from the same origin, GitHub, and Twitter.
    • manifest-src 'self';: Restricts the web app manifest to the same origin.
    • connect-src 'self';: Limits network connections to the same origin.
    • base-uri 'self';: Ensures that the base URL is restricted to the same origin.
    • form-action 'self';: Restricts form submissions to the same origin.

Checklist

  • I have read and followed the Contribution Guidelines.
  • All new and existing tests passed.
  • I have updated the documentation to reflect the changes I've made.
  • My code follows the code style of this project.
  • The title of my pull request is a short description of the requested changes.

Screenshots

Screenshot

Note to reviewers

Please review the CSP configuration to ensure it does not inadvertently block legitimate content. Testing across various environments is recommended to verify that all functionality remains intact while enhancing security.

Copy link

vercel bot commented Aug 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dev-find ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 31, 2024 10:02am

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, @usernayeem! 🎉 Thank you for opening a pull request. Your contribution is valuable and we appreciate your efforts to improve our project.

Soon the maintainers/owner will review it and provide you with feedback/suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant