-
Notifications
You must be signed in to change notification settings - Fork 84
csp policy fix for worker #1926
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
Conversation
WalkthroughThe Content Security Policy (CSP) configuration was updated across multiple modules to include a new Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
kairon/actions/server.py
(1 hunks)kairon/api/app/main.py
(1 hunks)kairon/async_callback/main.py
(1 hunks)kairon/chat/server.py
(1 hunks)kairon/evaluator/main.py
(1 hunks)kairon/events/server.py
(1 hunks)kairon/history/main.py
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Python CI
- GitHub Check: Analyze (python)
🔇 Additional comments (6)
kairon/events/server.py (1)
35-35
: Content Security Policy updated to support web workers.Added
worker_src
directive to allow loading web workers from the same origin and blob URLs, which is necessary for proper operation of web workers in modern browsers.kairon/history/main.py (1)
38-38
: Content Security Policy enhanced for web worker support.Added
worker_src
directive with appropriate sources ('self'
and"blob:"
) to enable proper web worker functionality.kairon/chat/server.py (1)
50-50
: Web worker security configuration added.The CSP configuration has been properly updated to include the
worker_src
directive, maintaining consistent security policies across the application.kairon/api/app/main.py (1)
47-47
: Added web worker source directive to CSP.This change aligns the CSP configuration with modern security best practices by explicitly defining allowed sources for web workers.
kairon/actions/server.py (1)
61-61
: Content Security Policy updated for web worker compatibility.The addition of
worker_src
directive completes the consistent implementation of web worker support across all server modules.kairon/evaluator/main.py (1)
28-28
: Approve CSPworker-src
directive addition
The addition of.worker_src("'self'", "blob:")
correctly extends the allowed sources for web workers in the FastAPI secure headers.
@@ -49,6 +49,7 @@ async def shutdown(app: Application): | |||
.connect_src("'self' api.spam.com") | |||
.frame_src("'self'") | |||
.img_src("'self'", "static.spam.com") | |||
.worker_src("'self'", "blob:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure CSP builder and manual config are in sync with worker-src
The worker_src("'self'", "blob:")
directive was added to the CSP builder chain, but the csp_config
used by generate_csp_header
lacks a corresponding "worker-src"
entry. Add "worker-src": ["'self'", "blob:"]
to csp_config
to maintain consistency.
Summary by CodeRabbit