The outcome: a Streampixel deployment where your API keys aren’t on a Pastebin, your stream isn’t being embedded by random sites, your webhook endpoint isn’t being spoofed, and a leaked credential is contained in minutes instead of months. This recipe assumes you have already shipped a working integration. It walks through the threats you should care about and the controls that mitigate each.Documentation Index
Fetch the complete documentation index at: https://docs.streampixel.io/llms.txt
Use this file to discover all available pages before exploring further.
Threat model
The realistic risks for a typical Streampixel deployment:| Threat | Impact | Mitigation |
|---|---|---|
| API key leaked in client code or git history | Attacker uploads/distributes builds, runs up your bill | Server-side only, rotate immediately |
| Stream embedded on unauthorized sites | Brand misuse, traffic costs | Domain whitelisting |
| Webhook spoofing | Attacker triggers your downstream actions | Secret-token URL, payload validation |
| Unbounded session usage | Bill shock, worker exhaustion | Session limits, rate limiting your endpoint |
| Stale team members with admin access | Insider risk after departures | Periodic role audits |
| Credentials shoulder-surfed in screen-shared logs | Subtle but common | Mask in CI logs, env vars |
API key hygiene
Keep keys server-side
API keys must never appear in any code that ships to a browser, mobile app, or anywhere a user can crack open dev tools. The Web SDK does not need an API key to render a stream — it uses yourappId. Only server-to-server calls (upload, distribute, webhooks) use the API key.
apiKey: "sk_..." in a .html, .jsx, or anything bundled to the client, stop and rotate.
Use environment variables
.env. Add it to .gitignore on day one. Use a secret manager (AWS Secrets Manager, GCP Secret Manager, Vault, Doppler) for production.
Rotation
Treat key rotation as a fire drill you should be able to run in under five minutes:Generate a new key
In the API Keys dashboard, create a fresh key.
Roll out the new value
Update your secret manager / env vars. Restart workers so they pick up the new key.
Revoke the old key
Once you’ve confirmed the new key is in use (one successful upload or distribute call), revoke the old one in the dashboard.
Project-level access control
Streampixel projects have built-in access controls. See Security control for the full settings reference. The two most useful settings:- Allowed domains — only the domains you list can host the stream. This is the single most effective control against unauthorized embedding.
- Password protection — gate the stream behind a project password, useful for private demos.
Domain whitelisting for embeds
The Web SDK validateswindow.location.origin against the project’s allowed URLs list. Misconfigured domains are the #1 reason “the stream works locally but not in production” support tickets get filed.
| Pattern | Matches |
|---|---|
https://app.example.com | Exactly that host |
*.example.com | Any subdomain of example.com |
localhost | Always allowed for development |
staging.example.com is not the same as example.com.
Webhook security
Streampixel webhooks do not currently include a signature header. There is no HMAC, no shared secret in headers, no signed token. If your webhook URL ishttps://example.com/streampixel-webhook, anyone who guesses that URL can POST a fake build.approved event.
Treat this seriously. Mitigations:
1. Use a long random token in the URL path
Make the URL itself the secret. Generate 16+ random bytes, hex-encode, and include in the path:/webhooks/streampixel or to a wrong-token path returns 404. This makes the webhook URL effectively a shared secret — keep it out of logs and chat messages.
2. Validate the payload matches what you expect
3. Don’t log the webhook URL
Audit your logging. Many frameworks log the full request URL by default; if your webhook URL contains the secret token, that token ends up in log aggregators, error monitoring services, and screen captures.4. Respond fast, work async
Streampixel webhook delivery times out at 10 seconds and does not retry. If your handler does heavy work synchronously and exceeds that window, the event is lost. Always:Rate limiting your own endpoints
Any endpoint you expose that triggers Streampixel calls (say, “Reset my project” buttons in your admin UI) should be rate-limited. Otherwise a misbehaving script or a bored user can hammer Streampixel APIs and exhaust your quotas.TLS everywhere
There is no good reason to run any part of this over HTTP in production:- The Web SDK requires HTTPS for getUserMedia (microphone, camera) and WebXR.
- API calls go to
https://api.streampixel.io/...regardless. - Webhook listeners must be HTTPS — Streampixel will not deliver to plain HTTP URLs.
Content Security Policy for embeds
If you embed Streampixel via iframe, set a CSP that allows the player and nothing else:script-src and the relevant SDK origins. Test thoroughly — a too-restrictive CSP breaks WebRTC media in non-obvious ways.
Auditing team members
Regularly review who has access to your Streampixel account:List active members
Open the team / members page in the dashboard. Note everyone with admin or developer roles.
Compliance
Streampixel encrypts data in transit (HTTPS / DTLS-SRTP for WebRTC). For compliance work — SOC 2, GDPR, processing agreements — contact the Streampixel team directly; this recipe is engineering-focused and intentionally avoids making compliance claims.Pre-flight checklist
Before going to production, confirm:- No API key exists in any client-side code, including JS bundles served to browsers.
-
.envis in.gitignore. Rungit log -p -- .envandgit log --all -p -S "STREAMPIXEL_API_KEY"to confirm none has ever been committed. - Allowed domains list in the dashboard contains only your real production and staging hosts.
- Webhook URL contains a 24+ byte random token in the path.
- Webhook handler validates
projectIdand event name. - Webhook handler returns 200 within ~1 second.
- All endpoints are HTTPS.
- Team member list reviewed in the last 90 days.
- You have a documented runbook for “API key leaked, what now.”
Next steps
API keys
Manage and rotate your API keys.
Security control
Project-level password and domain restrictions.
Webhooks
All seven events and payload shapes.
CI/CD pipeline
A reference webhook listener with the patterns above.