Security
What stays on the server, what the public team key can and can't do, how visitors are kept apart, and how the widget handles content safely.
TeamShelf is designed so you can paste a script tag into a public page without exposing secrets. This page explains the model, and its limits.
Keys stay on the server
- Your OpenAI key is stored on TeamShelf’s servers, encrypted. The widget never talks to OpenAI directly, and the key is never sent to a browser — the portal only shows whether one is connected.
- Your identity secret, used to identify signed-in users, is stored encrypted and shown only once, when you create it.
- Team credentials that TeamShelf uses behind the scenes are encrypted at rest with a server secret.
- The portal uses its own sign-in with an HTTP-only,
SameSite=Strictsession cookie, markedSecureover HTTPS.
The team key is public
The data-team key in your HTML is a public identifier, not a secret. Anyone who can see your page can see it.
What protects it is the team’s allowed origins: browsers on other sites are refused, with CORS headers only sent to allowed origins and 403 for anything else.
Visitors are kept apart
Each visitor has their own conversations with every bot, their own read and live status, and their own bot memory. When the lead delegates, the handoff stays in that visitor’s conversations. Nothing crosses between visitors:
- A visitor only sees their own conversations and statuses.
- The event stream only carries that visitor’s events.
- Clearing a conversation clears only that visitor’s conversation.
- Uploaded files are private to the visitor who uploaded them.
Bots running for a visitor have a deliberately small set of tools. They can message their teammates, ask that visitor questions, remember things about that visitor, and read the web. They can’t use file, computer, shell, browser or connector tools.
Sessions
Before it does anything else, the widget starts a session. The session token is:
- Signed by TeamShelf’s server, so it can’t be forged or edited in the browser.
- Bound to one team and one visitor. It can’t read another team’s or another visitor’s data.
- Short-lived. It expires after 12 hours, and the widget starts a new one.
Starting sessions is rate limited: one address can start at most 30 sessions a minute per team.
Signed-in users
By default, a visitor is an anonymous browser, known only by a random id. If you identify signed-in users, your backend vouches for who the user is:
- Your backend signs a JWT with HS256 using your team’s identity secret. TeamShelf rejects any other algorithm, a bad signature, or a token without
subandexp. - Tokens can last at most 24 hours. Keep them short — an hour is plenty — since anyone holding a token can act as that user until it expires.
- The identity secret stays on your server. Never put it in browser code. Creating a new secret revokes the old one immediately; removing it turns signed-in users off.
- Pseudonymous ids. TeamShelf never sends your user ids to the engine that runs your bots. It uses a keyed hash of your team and the user’s
sub, so the engine only sees a pseudonymous id. The optionalnameclaim is shown to the bots.
Anonymous conversations aren’t merged into a user’s conversations when they sign in. When a user signs out, TeamShelf.logout() starts a fresh anonymous visitor, so the next person on a shared computer doesn’t see the previous visitor’s chats.
Data retention and deletion
- Anonymous visitors who have been idle longer than your team’s retention period are deleted, with their conversations, bot memory and uploaded files. Set the period in the portal under Setup → Visitor data: 1 to 3650 days, 30 by default. TeamShelf checks hourly.
- Clearing a conversation in the widget empties that visitor’s conversation with the bot.
- Deleting a team removes its configuration and stored keys.
Secrets aren’t typed into the widget
Sometimes a bot asks for a secret — a password or an API key. The widget won’t collect it: instead of an input, the card explains that secrets can’t be entered on the page and asks the user to get your team’s admin to provide it. That keeps secrets out of third-party pages and out of conversations.
Shadow DOM isolation
The shelf renders inside a shadow root under a single <div id="teamshelf-root">. Your page’s CSS can’t restyle it and its CSS can’t leak into your page. Shadow DOM is a styling boundary, not a security one — scripts on your page can still reach it, as they can anything else on the page.
Content handling
Bot replies
Bots reply in Markdown. The widget renders it to HTML and sanitizes the result with DOMPurify before showing it. Inline styles, <style>, forms, inputs and buttons are removed, and links open in a new tab with rel="noopener noreferrer".
Files
Files bots send are downloaded from app.teamshelf.ai, never from third parties. Each download needs the visitor’s session. To make sure nothing can run on that origin:
- PNG, JPEG, GIF and WebP images are served inline with their real type, so they can be shown in
<img>. - Everything else, including SVG and HTML, is served as
application/octet-streamwithContent-Disposition: attachment, so it downloads instead of rendering. - Every file response carries
X-Content-Type-Options: nosniffandContent-Security-Policy: default-src 'none'; sandbox. - Uploads are limited to 20 MB.
Custom icons
Bot icons set in the portal must be PNG, JPEG, WebP, GIF or SVG images under about 200 KB. They’re delivered to the widget as data: URLs and shown with <img>, which doesn’t run scripts inside SVGs.
What the widget stores in the browser
localStorage:teamshelf:<team key>:visitor-id, the anonymous visitor’s random id. If storage is blocked, the visitor gets a new id on each page load.localStorage: any names or looks the visitor gave bots, if you let visitors personalize bots.sessionStorage:teamshelf:<team key>:folded, remembering whether the shelf is folded.
No cookies and no tracking. The session token is kept in memory only.
Checklist
- List only the origins you need, and avoid
*. - Use a separate team for development.
- Keep bot instructions free of anything an anonymous visitor shouldn’t read.
- Keep the identity secret on your server, and sign tokens that expire within an hour.
- Call
TeamShelf.logout()when users sign out of your app. - Set a visitor data retention period that matches your privacy policy.