Security¶
GVDB supports TLS (optionally mutual), API key authentication, RBAC, and structured audit logging. Production deployments should enable all four.
Note
Auth, TLS, and audit logging are configured in the server-side YAML, not as Helm values. The Helm chart renders a ConfigMap — override it by mounting your own. See Configuration for the full schema.
TLS¶
server:
tls:
enabled: true
cert_path: "/etc/gvdb/tls/server.crt"
key_path: "/etc/gvdb/tls/server.key"
ca_cert_path: "/etc/gvdb/tls/ca.crt" # only needed if mutual_tls
mutual_tls: true
Clients connect over an insecure channel by default. For TLS endpoints, use a custom gRPC channel:
import grpc
from gvdb.pb import vectordb_pb2_grpc as stub_pb
from gvdb import GVDBClient
creds = grpc.ssl_channel_credentials(open("ca.crt", "rb").read())
# The GVDBClient currently constructs an insecure channel internally.
# For TLS, use the generated gRPC stubs directly or wait for a
# channel-factory kwarg (tracked on the roadmap).
API keys¶
Two ways to declare keys:
1. RBAC via server.auth.roles (recommended)¶
server:
auth:
enabled: true
roles:
- key: "admin-key-abc123"
role: admin
collections: ["*"]
- key: "reader-key-def456"
role: readonly
collections: ["products", "reviews"]
2. Legacy server.auth.api_keys list¶
Keys in this list are treated as admin. Migrate to auth.roles — legacy keys have no per-collection scoping.
Passing the key from clients¶
The client sends authorization: Bearer <key> as gRPC metadata.
RBAC roles¶
| Role | Permissions |
|---|---|
admin |
All operations on all collections |
readwrite |
insert, search, get, delete, upsert, update on assigned collections |
readonly |
search, get, range_search, hybrid_search, list on assigned collections |
collection_admin |
All ops except create/drop on assigned collections |
HealthCheck and GetStats are always allowed without authentication.
See RBAC for details.
Audit logging¶
Every non-public RPC emits a structured JSON line when enabled:
logging:
audit:
enabled: true
file_path: "/var/log/gvdb/audit.jsonl"
max_file_size_mb: 100
max_files: 10
Each entry contains timestamp, api_key_id, operation, collection, status, grpc_code, latency_ms, item_count. The audit logger flushes synchronously — audit events must not be dropped.
Secrets management¶
- Kubernetes: keep API keys and TLS material in
Secretresources, mount into pods, reference via env or file paths. - Docker: use Docker secrets, mounted volumes, or env files with restricted permissions.
- Never commit API keys or TLS private keys to git.
Network isolation¶
- In Kubernetes, use
NetworkPolicyto restrict traffic to the proxy from known app namespaces. - For multi-tenant setups, combine RBAC collection scoping with per-tenant API keys.
Multi-tenancy¶
Phase 1 (tenant_id on collection metadata, RBAC restricted to a tenant's collections) is in progress.
See also¶
- RBAC feature
- Configuration — full YAML schema
- Monitoring — audit log details