Skip to main content
Chatbot Implementation Guide

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​

DirectiveHost / valuePurpose
script-srchttps://assets.ept.aiLoader and widget JavaScript
style-srchttps://assets.ept.aiWidget CSS (including bundled KaTeX styles)
style-srchttps://fonts.googleapis.comMontserrat CSS @import
font-srchttps://assets.ept.aiBundled KaTeX fonts
font-srchttps://fonts.gstatic.comGoogle Fonts files
connect-srchttps://assets.ept.aiVersion/track manifests
connect-srchttps://chat.ept.aiAccess-token HTTP API
connect-srcwss://ws.api.ept.aiChat WebSocket
connect-src'self'Your /api/ept-token (or equivalent)
img-srchttps: / data:CDN images plus customer botImage / userImage / headerIcon URLs

Why 'unsafe-inline'​

  • style-src: the widget uses inline style attributes in its markup.
  • script-src: an image headerIcon uses an inline onerror fallback. Prefer an emoji or text headerIcon if you must remove 'unsafe-inline' from script-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 current loader.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.
note

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:

  1. Handle errors — non-200 responses, missing access_token, JSON parse failures
  2. Cache the access token server-side until near JWT expiry (decode the payload locally; do not send tokens to third-party decoder sites)
  3. 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:

FieldTreated as
botImage, userImageImage URL (<img src>)
headerIconImage URL or text/emoji
introText, disclaimerText, botName, headerChatNameText inserted into the widget chrome
advancedWelcomeText.icon / .title / .descriptionIcon + 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.