If you do not have CSPs configured, they do not interfere with botBrains. If you have some in place, you must update them when integrating botBrains. If you don’t know what CSPs are, you likely don’t have them configured.CSPs require deep browser understanding and configuring a single character wrong can trip you up. We are here to help-reach out to support@botbrains.io or via live chat on platform.botbrains.io.
What are CSPs?
Content Security Policies (CSPs) are security measures implemented by web browsers to prevent various types of attacks, particularly cross-site scripting (XSS) and data injection attacks. They work by allowing servers to specify exactly which sources of content browsers should consider trustworthy for loading resources like scripts, stylesheets, images, fonts, and more. CSPs are applied through HTTP response headers or HTML meta elements, creating a security layer that blocks potentially malicious content from executing.How do I know if we use CSPs?
Check if your server returns this header on the main HTML document served:Why do I need to change CSPs when integrating botBrains?
When integrating botBrains (via the HTML/JS snippet), your CSPs may block our functionality. Because we run in your domain context, strict CSPs can prevent script execution, API communications, or dynamic content generation. You must update your CSP directives to explicitly allow botBrains to operate correctly.Main Endpoints
While we bundle our dependencies with version pinning, some libraries communicate with their systems to load additional features such as Session Replay on demand. To ensure proper functionality, your CSP must allow communication with the following endpoints:botBrains - Assets, API and Open Graph Previews
https://api.botbrains.io- Primary API for backend communicationhttps://chat.botbrains.io- Used for chat functionality and script loadinghttps://*.botbrains-cdn.com- Used for assets loading and proxying 3rd party assetsdata:...- Used to load image and audio data
Error Monitoring
https://*.sentry.io- Ingestion API used for error reporting and logging
Analytics & User Behavior Tracking
https://*.i.posthog.com- API used for feature flags, analytics and event tracking
Recommended CSP Configuration
In addition to your current rules, add these directives:unsafe-inlinefor CSS cannot be changed currently. Reach out to support@botbrains.io if this is a deal-breaker.unsafe-inlineforscript-srccan be replaced by'nonce-{SERVER-GENERATED-NONCE}'if you add a nonce to the loader script:<script nonce='{SERVER-GENERATED-NONCE}'>$botbrains = []; ...</script>.
Explanation of Directives
The wildcard* matches multi-level domains. For example, *.example.com will NOT match example.com but will match any subdomain, including nested subdomains (e.g., two.one.example.com).
| Directive | Description |
|---|---|
default-src 'self' | Restricts all unspecified resource types to the current origin |
script-src | Allows scripts only from configured domains |
style-src | Permits loading styles from given domains / inline-mode |
img-src | Allows images from given domains |
font-src | Permits loading fonts from given domains |
connect-src | Enables communication with given domains. Note that protocols must be stated |
frame-src | Restricts iframe loading to given domains |
object-src 'none' | Prevents embedding objects (e.g., Flash, plugins) |
base-uri 'self' | Ensures forms cannot be hijacked by preventing changes to the document base URL |
form-action 'self' | Ensures forms are only submitted to the same origin |
upgrade-insecure-requests | Forces all HTTP requests to be upgraded to HTTPS |