Skip to content

fix: add CSP security headers#111

Open
jeeva5655 wants to merge 1 commit into
NexGenStudioDev:masterfrom
jeeva5655:fix/security-headers
Open

fix: add CSP security headers#111
jeeva5655 wants to merge 1 commit into
NexGenStudioDev:masterfrom
jeeva5655:fix/security-headers

Conversation

@jeeva5655
Copy link
Copy Markdown

This PR adds Content-Security-Policy (CSP) headers to the Tauri configuration to prevent XSS attacks and securely isolate the application. Fixes #107

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Content Security Policy (CSP) in tauri.conf.json to define specific source restrictions. Feedback was provided regarding the script-src directive, noting that the use of 'unsafe-inline' and 'unsafe-eval' introduces security risks and should be removed if not strictly necessary.

Comment thread src-tauri/tauri.conf.json

"security": {
"csp": null
"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self' https://api.github.com;"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The script-src directive includes 'unsafe-inline' and 'unsafe-eval', which significantly weaken the Content Security Policy. These allow the execution of inline scripts and dynamic code evaluation (like eval()), making the application vulnerable to XSS attacks. Since the goal of this PR is to improve security and isolate the application, it is highly recommended to remove these unless they are strictly required by your frontend framework for production builds.

Suggested change
"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self' https://api.github.com;"
"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self' https://api.github.com;"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

[nsoc] Comprehensive Code Audit: 50 Bugs and 40 Architectural Features

2 participants