Chatbot Embedding Security
Content Security Policy, pinned loader with SRI, token hardening, and config trust guidance for embedding the ept AI chat widget.
Chatbot Embedding Security
Security guidance for teams embedding the ept AI chat widget on customer-facing sites (including semis and OEMs). Use this page together with Integrating the Chatbot.
Content Security Policy
The widget loads assets from the ept CDN, connects to the chat API and WebSocket, and uses Google Fonts for typography. Apply a CSP that allows those hosts.
Sample policy
Content-Security-Policy:
default-src 'self';
script-src 'self' https://assets.ept.ai 'unsafe-inline';
style-src 'self' https://assets.ept.ai https://fonts.googleapis.com 'unsafe-inline';
font-src 'self' https://assets.ept.ai https://fonts.gstatic.com data:;
img-src 'self' https://assets.ept.ai https: data:;
connect-src 'self' https://assets.ept.ai https://chat.ept.ai wss://ws.api.ept.ai;
frame-src 'none';
object-src 'none';
base-uri 'self';
As a single meta tag (for local testing):
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' https://assets.ept.ai 'unsafe-inline'; style-src 'self' https://assets.ept.ai https://fonts.googleapis.com 'unsafe-inline'; font-src 'self' https://assets.ept.ai https://fonts.gstatic.com data:; img-src 'self' https://assets.ept.ai https: data:; connect-src 'self' https://assets.ept.ai https://chat.ept.ai wss://ws.api.ept.ai; frame-src 'none'; object-src 'none'; base-uri 'self';"
/>
What each host is for
| Directive | Host / value | Purpose |
|---|---|---|
script-src | https://assets.ept.ai | Loader and widget JavaScript |
style-src | https://assets.ept.ai | Widget CSS (including bundled KaTeX styles) |
style-src | https://fonts.googleapis.com | Montserrat CSS @import |
font-src | https://assets.ept.ai | Bundled KaTeX fonts |
font-src | https://fonts.gstatic.com | Google Fonts files |
connect-src | https://assets.ept.ai | Version/track manifests |
connect-src | https://chat.ept.ai | Access-token HTTP API |
connect-src | wss://ws.api.ept.ai | Chat WebSocket |
connect-src | 'self' | Your /api/ept-token (or equivalent) |
img-src | https: / data: | CDN images plus customer botImage / userImage / headerIcon URLs |
Why 'unsafe-inline'
style-src: the widget uses inlinestyleattributes in its markup.script-src: an imageheaderIconuses an inlineonerrorfallback. Prefer an emoji or textheaderIconif you must remove'unsafe-inline'fromscript-src.
File upload
If you enable enableFileUpload, add the HTTPS hosts used for your presigned upload URLs to connect-src (and img-src if previews load from those hosts).
Pinned loader with Subresource Integrity (SRI)
Track-based embeds (data-track="stable") always pull the latest approved build on that track. Security-minded teams can pin an exact widget version and verify the loader bytes with SRI.
<script
src="https://assets.ept.ai/chatbot/loader.js"
integrity="sha384-HP/hwp5tHPgL3EFaUavUJ4zwdIZShNNWf355hX/PAneoUERSiBripTjz3oQCQDhp"
crossorigin="anonymous"
data-version="2.0.50"
async>
</script>
integrity— SHA-384 hash of the currentloader.js. The browser refuses to run the script if the CDN file does not match.crossorigin="anonymous"— required for SRI checks on cross-origin scripts.data-version— loads immutable versioned app JS/CSS from the CDN; the loader applies SRI from the version manifest to those assets.
loader.js itself lives at a fixed URL and is updated only when the loader is redeployed. After you approve a new loader build, recompute the hash and update integrity in your pages.
Recompute the loader hash
curl -sS https://assets.ept.ai/chatbot/loader.js \
| openssl dgst -sha384 -binary \
| openssl base64 -A
Prefix the result with sha384- for the integrity attribute.
Token endpoint hardening
Keep client_id on the server. Your /api/ept-token endpoint should:
- Handle errors — non-200 responses, missing
access_token, JSON parse failures - Cache the access token server-side until near JWT expiry (decode the payload locally; do not send tokens to third-party decoder sites)
- Rate limit callers to reduce abuse
See the Express, PHP, and FastAPI samples on Integrating the Chatbot.
Decoding access tokens locally
Access tokens are JWTs. Decode the payload on your server (or in a controlled local tool) to read exp for caching. Do not paste live access tokens into public JWT debugger websites.
Node example (payload only; does not verify the signature — verification is performed by ept AI services):
function decodeJwtPayload(token) {
const part = token.split('.')[1];
const json = Buffer.from(part, 'base64url').toString('utf8');
return JSON.parse(json);
}
Config value trust model
These window.eptAIConfig fields are host-controlled configuration. Treat them as trusted strings and URLs that you set in your own page — not as a place to inject end-user or untrusted HTML:
| Field | Treated as |
|---|---|
botImage, userImage | Image URL (<img src>) |
headerIcon | Image URL or text/emoji |
introText, disclaimerText, botName, headerChatName | Text inserted into the widget chrome |
advancedWelcomeText.icon / .title / .description | Icon + text for the welcome panel |
Do not pass untrusted user input into these fields. Bot message HTML from the model is sanitized separately before render; that path does not make config fields a general HTML sanitizer.