Project
Security Considerations
API Keys and Secrets
- Never commit API keys, tokens, or secrets to the repository
- Use environment variables (
process.env.OPENAI_API_KEY, etc.) and inject them in agent logic - Use your platform's secret management (Vercel, AWS Secrets Manager, etc.)
Authentication
- Use the
authcallback inexpose()to validate tokens or sessions before processing requests - Return the request's principal (
{ allowed: true, principal: { id } }) so its history is namespaced: thecontextIdcomes from the client and is not a secret - Return appropriate HTTP status codes (401, 403) when auth fails
- Do not log sensitive tokens or credentials
Input Validation
- Event payloads are validated via Effect Schema at runtime
- Invalid payloads are rejected before reaching agent logic
- For custom validation, add checks in
onRequestor at the start of your agent logic
Multi-Tenant Isolation
- History is stored and read per
(principal, contextId). Requests without a principal share one anonymous namespace where anyone who knows acontextIdreads that conversation; do not rely on it for multi-user apps - Runs belong to their principal: events for another principal's run are refused, and streams only yield their own principal's events
- Proxy publishes never trust
meta.principalId; passprincipalexplicitly from your server-side auth (see Auth + Multi-Tenant) - Store adapters must scope every read and write by both
namespaceandcontextId(check yours withrunStoreContractfrom@m4trix/core/testing) - Keep per-tenant resources (credentials, indexes) behind dependency layers selected by the run's
principal - Avoid sharing mutable state between tenants
Dependencies
- Keep
@m4trix/coreand@m4trix/evalsup to date for security patches - Run
pnpm audit(or equivalent) regularly
Reporting Vulnerabilities
Please report security issues privately to pascal@stepsailor.com before opening a public issue.