Skip to main content

Auth: helvia-rag-pipelines

How this service handles authentication. Full flows: docs/architecture/auth-flows.md

Tokens This Service Accepts

Token typeWhere validatedGuard / middleware
Pipeline JWT (Bearer)Validated locally by JWTBearer class (extends HTTPBearer). HS256 with JWT_SECRET env var.FastAPI dependency injection on protected routes

Public endpoints (no token required): GET / (root info endpoint).

Tokens This Service Sends

This service does not send JWTs to other services. It uses external API keys for third-party integrations:

CallingToken usedHow attached
OpenAIOpenAI API keyAuthorization: Bearer <key> header
Azure OpenAIAzure API keyapi-key header
SemCacheSemCache tokenAuthorization: Bearer <token> header
RAG serviceRAG user emailCustom header

Tokens This Service Issues

TokenLifetimePurpose
Pipeline JWTNo expiry by defaultAccess to pipeline endpoints. Payload: { role, pipeline_id, iat }. Issued via POST /admin/token (admin only).

Roles / Scopes Enforced

Two roles: admin and client.

Endpoint patternRequired role
POST /pipelinesadmin
GET /pipelinesadmin
GET /pipelines/{pipeline_id}admin or client (pipeline_id must match token)
PATCH /pipelines/{pipeline_id}admin or client (pipeline_id must match token)
DELETE /pipelines/{pipeline_id}admin or client (pipeline_id must match token)
PUT /pipelines/{pipeline_id}/corpusadmin or client (pipeline_id must match token)
GET /pipelines/{pipeline_id}/corpusadmin or client (pipeline_id must match token)
POST /pipelines/{pipeline_id}:processadmin or client (pipeline_id must match token)
POST /pipelines/{pipeline_id}:searchadmin or client (pipeline_id must match token)
POST /pipelines/{pipeline_id}:trainadmin or client (pipeline_id must match token)
POST /pipelines/{pipeline_id}:indexadmin or client (pipeline_id must match token)
POST /admin/tokenadmin
Admin NLP providersadmin
Admin config endpointsadmin

Client scope restriction: A client token contains a pipeline_id claim. The service verifies that the pipeline_id in the URL path matches the token's pipeline_id. This prevents clients from accessing pipelines they were not granted access to.

Admin bypass: The admin role has unrestricted access to all endpoints, regardless of pipeline_id.

Auth Notes

  • This service has a completely independent auth system from hbf-core. It does not share secrets, tokens, or user databases with the rest of the platform.
  • Tokens have no expiry by default. Rotation or revocation must be handled manually.
  • All auth errors return HTTP 403 (not 401).
  • The default JWT_SECRET is "secret", which is insecure for production. Must be overridden via environment variable.