← Platform overview (technical)Security & guardrails (as implemented)
Overview
Security & guardrails (as implemented)
Last updated 9 Oct 2026 · Pre-production — verify in your environment.
This page describes what the Hakunai web codebase does today. It is not a certification. Enterprise marketing summaries live under Security; prefer this page for engineering reviews.
Authentication
- Customer portal: Auth.js (NextAuth v5) with credentials and magic-link providers. Sessions are JWTs backed by a database
PortalUserSessionrow so revocation works before token expiry. - Admin: Separate HttpOnly cookie, HMAC-signed, eight-hour lifetime. Admin APIs re-check the user record, suspension state, email, and
ADMIN_ALLOWED_EMAILSon every request. - Login redirects:
getSafeInternalNextPathblocks open redirects.
Authorization & tenancy
- Organisation access comes from Membership in PostgreSQL — APIs must not trust client-supplied organisation IDs.
- Scoped helpers under
lib/auth/and*-scope.tsmodules centralise tenant checks for portal, Talent, Contractor, integrations, and learning routes.
Transport & browser hardening
- Shared CSP, anti-framing, MIME sniffing, referrer, permissions, and HSTS headers (
config/security-headers.cjs). - Sensitive API responses use
Cache-Control: private, no-store.
Input, abuse, and errors
- Public and authenticated mutation routes use bounded validation (often Zod) and process-local rate limits (
lib/process-rate-limit.ts, Talent-specific limits inlib/talent/rate-limit.ts) on routes such as contact, feedback, integrations, marketplace skills, and agent interest. - Limits are per-process — plan a shared backend before horizontal scale (see
docs/SECURITY.md).
Secrets & integrations
- Integration tokens at rest use AES-256-GCM keyed from
AUTH_SECRET(lib/integrations-store.ts). - OAuth client credentials for integrations are stored outside git in
content/oauth-credentials.jsonon the server.
AI / runtime guardrails (portal)
- Marketplace checkout and deploy are disabled unless foundation flags are explicitly enabled (
lib/platform-foundations.ts) — flags never grant authorization by themselves. - Portal runtime tooling (model adapters, action-centre approvals) enforces policy in
lib/runtime/— human approval queues apply where configured.
Billing safety
- There is no live third-party payment provider wired for agent checkout in the default configuration. Billing surfaces in the portal are backend-oriented; do not document card processing as available unless your environment enables it.
For privacy processing categories, see Privacy and data handling.
Was this helpful?
On this page