Langfuse security hardening

How to harden a self-hosted Langfuse deployment that holds sensitive prompts and traces, covering network exposure, SSO, secrets, masking, retention and audit evidence, and which controls need an Enterprise key.

On this page

Why Langfuse security hardening starts before the first trace

Prompts, completions and tool outputs often carry personal data, customer records or confidential business material, so a self-hosted Langfuse instance is a sensitive data store from the day it receives its first trace. Hardening has to be planned as part of the deployment, not added after tracing is live. The attack surface spans the Langfuse Web and Langfuse Worker containers, PostgreSQL, ClickHouse, Redis or Valkey and the S3-compatible blob storage, and each one holds some part of the record. Your team should decide early which of these components are reachable from which networks, who can administer each one and where encryption keys and database credentials will live.

The open source edition covers the core product, but several governance controls are gated behind an Enterprise license key according to Langfuse's license key documentation. These include project-level RBAC roles, protected prompt labels, data retention policies, audit logs, server-side data masking and SCIM provisioning through the org management API. If your compliance review requires any of these, the license decision belongs in the first design review, not after go-live. Confirm the current feature list against the Langfuse license key documentation and the edition terms in the repository before you commit to a control design.

What makes this harder than it looks is that traces are written by many applications, often by teams that did not design the data model. A developer may log a full prompt with a customer's name, a retrieval step may return a document with account numbers, or a tool call may echo a credential into its output, and none of this is flagged as sensitive at the point of capture. Plan for accidental capture as the default case, and decide where masking, filtering and retention will apply before the first application sends traces, because data already written is far harder to remove than data never stored.

Which Langfuse components hold data and need controls

A self-hosted Langfuse deployment spreads prompts, traces and credentials across several services, and each one needs its own access and encryption decisions. The cards below map each component and ingestion path to the control it needs before a regulated team signs off on the deployment.

Langfuse Web (UI and APIs)

Langfuse Web is the single entry point for people and for SDKs. It serves the user interface, the public APIs and the ingestion endpoints, so it is where authentication, session handling and TLS termination must be verified. Check which routes are reachable from which networks, whether the instance sits behind a private load balancer or ingress, and how API keys are issued, scoped and rotated. Confirm that admin and instance management paths are not exposed beyond the operators who need them.

Authentication and SSO docs

Langfuse Worker

Langfuse Worker processes events asynchronously after they are received, so it reads and writes the same trace and prompt data as the web tier. It usually needs no inbound exposure at all, which makes it a good place to enforce a tight network boundary. Confirm that it can reach PostgreSQL, ClickHouse, Redis or Valkey and blob storage, and nothing else. Review the service account and environment secrets it receives, since it holds the same database credentials as the web tier.

PostgreSQL

PostgreSQL holds the relational records: users, projects, organizations, API keys metadata and prompt versions. Because prompts often contain proprietary logic and credentials can slip into them, this database needs encryption at rest, TLS for connections, and a dedicated role for the application rather than a superuser. Check backup encryption and who can read backup copies. Confirm where database credentials are stored and how they are rotated without downtime.

ClickHouse

ClickHouse stores the high-volume observability data, including traces, observations and scores, which is typically where prompt and completion content with personal or customer data ends up. It deserves its own access model, separate from PostgreSQL, with restricted users for the application, reporting and administration. Decide whether data at rest is encrypted at the disk or volume layer, and confirm how retention and deletion work across replicas and backups. Sensitive content usually lands here first, so treat it as the primary data store for classification.

Redis or Valkey

Redis or Valkey is used for queueing and short-lived processing state rather than as a long-term record. It is easy to overlook, but queued payloads can contain trace content until they are processed. Keep it on a private network with authentication enabled, and do not expose it through any ingress. Confirm whether persistence is enabled, since on-disk snapshots would extend how long event content remains outside ClickHouse.

S3-compatible blob storage

Blob storage holds uploaded media, large event payloads and exports, depending on how the deployment is configured. Buckets should be private, with access granted to the Langfuse services only, and server-side encryption enabled with keys your team controls. Versioning and lifecycle rules determine whether deleted content truly disappears, so confirm them against your retention policy. Ask your storage team how bucket credentials are issued and audited.

OTLP ingestion at /api/public/otel

The OpenTelemetry endpoint at /api/public/otel accepts traces from any instrumented application, so anyone who can reach it and hold valid keys can write data into the system. Restrict which networks and services can send to it, issue separate keys per application or environment, and review which attributes those applications attach, since they may include user identifiers or prompt text. Treat it as an ingestion path to be controlled, not just a convenience endpoint.

OpenTelemetry docs

Choosing between open source controls and Enterprise controls

This table compares four security control choices for self-hosted Langfuse, showing when each fits, what it costs your team to run, and whether the feature needs an Enterprise license key. Read the Enterprise column first to see which options are available on the free MIT-licensed version and which require a key before you plan the design.

ControlWhen it fitsOperational costNeeds Enterprise key
Data masking at the application SDKTeams that must keep sensitive values out of the trace pipeline entirely, including before data leaves the applicationDevelopers maintain masking code in every instrumented service, and reviews are needed when new fields appearNo
Server-side data maskingTeams that want a central rule applied to all ingested traces regardless of which application sent themRules must be written, tested and kept in step with schema changes; masking mistakes are harder to spot after ingestionYes
Retention set by policyRegulated teams that must delete traces after a defined period without relying on people to rememberPolicy values must be agreed with compliance, and deleted data cannot be recovered for later investigationsYes
Manual deletionSmall deployments or short pilots where data volume is low and deletions are rareSomeone must run deletions on a schedule and keep records of them; gaps are easy to miss and hard to prove to an assessorNo
SSO-only sign-inOrganizations that require all users to authenticate through the corporate identity providerIdentity provider outages block access, so break-glass admin accounts need a documented plan; confirm SSO domain enforcement steps in the authentication docsNo
Password plus SSOPilots or mixed user populations where some accounts are not in the identity providerTwo sign-in paths double the account review scope and widen the set of credentials to rotate and monitorNo
Internal-only network accessDeployments that only receive traces from applications inside the same network or VPNRemote developers and external tools need VPN or private connectivity, and cross-environment tracing takes more setupNot applicable
Public ingress behind a reverse proxyApplications running outside the private network or in several cloud accounts that must send tracesThe proxy needs TLS configuration, rate limits, access logging and regular certificate renewal, all owned by your teamNot applicable

How to harden a self-hosted Langfuse instance in sequence

This sequence moves a self-hosted Langfuse instance from a working deployment to one that controls who can reach it, how users sign in, what sensitive content is stored, and what changes are recorded. Each step ends with a check you can run and evidence you can keep for a security review.

  1. Restrict network exposure and terminate TLS

    Decide which networks can reach the Langfuse Web endpoint, and close every other path to it, including direct access to PostgreSQL, ClickHouse, Redis or Valkey and blob storage. Place the web endpoint behind a load balancer or reverse proxy that terminates TLS, and confirm that the ingestion path used by SDKs and OTLP clients is reachable only from the application networks that send traces. The step is done when a scan from outside the approved network cannot reach the data stores, and plain HTTP to the web endpoint is refused or redirected. Your infrastructure or network team will own the firewall and certificate work, and the Langfuse operator will confirm the public URL settings match the certificate.

  2. Move secrets into the platform secret store

    Find every credential in the deployment, including the database passwords, the ClickHouse and Redis credentials, the blob storage keys, the encryption and session secrets, and any SSO client secret, then move them out of compose files, Helm values and shell history into your secret manager or Kubernetes secrets with restricted access. Rotate any value that was ever committed to a repository or pasted into a ticket. The step is done when a search of the deployment repository and configuration returns no plaintext credentials, and when only the service accounts that run Langfuse can read the secret objects. Ask the vendor or your own platform team to confirm which Langfuse settings accept secrets from files or environment references in your chosen deployment method.

  3. Enforce SSO and block password sign-in for company domains

    Connect Langfuse to your identity provider using one of the supported Auth.js providers, such as Entra ID, Okta, Keycloak or generic OIDC, and then configure SSO enforcement for your company email domains so that password sign-in is not offered to those addresses. Keep a break-glass path for administrators under a documented procedure, and test it before you need it. The step is done when a test account on a managed domain is redirected to the identity provider, and an attempt to sign in with a password for that domain is rejected. Confirm with the vendor documentation which settings are available on your edition, because SCIM provisioning and some access controls depend on an Enterprise license key.

  4. Set project-level roles and least-privilege access

    Map your teams to Langfuse projects and assign each user the lowest role that lets them do their work. Project-level RBAC roles are an Enterprise license feature, so confirm whether your edition includes them before you design around them. If your edition does not include project roles, record that gap as a risk and limit access through separate instances or tighter membership rules. The step is done when a test user assigned to one project cannot read traces, prompts or datasets in another project, and when the administrator list is short and written down. Review membership with the team lead who owns each project.

  5. Configure data masking and retention

    Decide what sensitive content must not be stored in full, such as personal data, credentials that appear in prompts, or regulated identifiers, and configure server-side masking where your edition supports it. Set a data retention policy that matches your records schedule, noting that retention policies are an Enterprise license feature. Also tell application teams to remove sensitive fields in the SDK or instrumentation layer, because masking applied after ingestion does not help if the raw content already reached storage. The step is done when a test trace containing a known sample value shows the masked form in the UI and API, and when a retention setting is confirmed on a test project. Ask your privacy and legal teams to sign off on the masking rules and retention period.

  6. Enable and review audit logging

    Turn on audit logging, which is an Enterprise license feature, and decide where the logs are forwarded so that they are retained outside the Langfuse instance and cannot be altered by ordinary administrators. Define which events you need, such as sign-ins, role changes, key creation and settings changes, and confirm with the vendor documentation which events are recorded. The step is done when a test role change appears in the audit log and in the external destination, and when someone other than the administrator has been assigned to review the log on a schedule you set. Compliance leads should confirm the retention period and the review cadence against their own control requirements.

  7. Restrict blob storage and database access

    Limit the blob storage bucket and the PostgreSQL and ClickHouse databases to the Langfuse service identities only, using bucket policies, network rules and database users with the narrowest grants the product allows. Disable public read on the bucket, enable encryption at rest in your cloud or data center platform, and turn on access logging where available. Confirm that backups of PostgreSQL, ClickHouse and the bucket are encrypted and restricted in the same way, because they hold the same prompts and traces. The step is done when a test credential outside the Langfuse service identity is denied access to the bucket and the databases, and when backup restores are tested in a separate environment. Your cloud or infrastructure team should provide the evidence for each check.

How hardening changes across Docker Compose, Kubernetes and cloud deployments

Langfuse documents Docker Compose on a single VM for testing, and it does not provide high availability. Hardening here is mostly about the host and the containers around it, because there is no load balancer, cluster policy engine or managed secret store by default. The Compose stack runs Langfuse Web, Langfuse Worker, PostgreSQL, ClickHouse, Redis or Valkey and S3-compatible storage on one machine, so every service shares the same network namespace on the host and the same disk.

  • Exposure: Decide which ports the host publishes. Only the web endpoint should be reachable from users, and the database, Redis and ClickHouse ports should stay on the internal Docker network.
  • Secrets: Compose files often hold passwords and the encryption key in plain .env files. Restrict file permissions and confirm how your team rotates them.
  • Encryption at rest: Encrypt the host disk or the volumes that hold ClickHouse and PostgreSQL data, since the VM itself is the storage boundary.
  • TLS: Put a reverse proxy in front of the web container and terminate TLS there, with certificates managed outside the stack.
  • Backups and host patching: Both fall to your team. A single VM means one failure domain for tracing data.

Before you rely on this model for regulated data, confirm with Langfuse's self-hosting documentation which settings the Compose file exposes and which you must set yourself.

Access control, secrets and data handling controls to set

These controls decide who can see prompts and traces, what sensitive data ever reaches storage, and how long it stays. Identity, access scope, masking, retention and credential handling depend on each other, so set them together and check them against your data classification before the first production trace arrives.

SSO provider and domain enforcement

Connect Langfuse to your identity provider through one of the supported Auth.js providers, such as Entra ID, Okta, Keycloak or generic OIDC, then decide which email domains must sign in through SSO. Once enforcement is on, disable password sign-in for those domains so that offboarding in the identity provider actually removes access. Confirm with your identity team how group membership maps to Langfuse roles before you rely on it.

Authentication docs

Project roles and protected prompt labels

Project-level RBAC roles and protected prompt labels require an Enterprise license key. Without them, plan access around organization and project boundaries and keep sensitive applications in separate projects where possible. If your teams need to restrict who can publish a production prompt, confirm whether that control is in your edition before designing the approval workflow.

Masking sensitive fields before ingestion

Server-side data masking is an Enterprise feature, so the open source edition gives you no built-in masking of trace content. Decide which fields (user identifiers, customer records, credentials in tool arguments) must never reach ClickHouse or blob storage, and strip them in the application or an upstream collector before the trace is sent. Test the redaction with real sample payloads in a non-production project.

Retention policies for traces and prompts

Data retention policies require an Enterprise key. Without one, traces accumulate until you remove them through your own process, so define the retention period from your data classification and confirm how deletions reach ClickHouse, PostgreSQL and backups. Ask your legal and records team whether backup copies fall under the same schedule.

Rotating database, storage and auth secrets

Rotate the PostgreSQL, ClickHouse, Redis or Valkey and S3-compatible storage credentials, along with the auth provider client secret and the Langfuse encryption and session keys. Plan each rotation with a restart window, because Web and Worker must both pick up new values. Store every secret in your secrets manager instead of plain environment files, and confirm the rotation procedure with the vendor for your version.

Restricting OTLP endpoint and API keys

The OTLP ingestion endpoint at /api/public/otel accepts traces from any client holding valid project keys. Limit each key to one application or environment, rotate keys that leave a team, and restrict network paths to the endpoint so only your application subnets can reach it. Check your network policy and load balancer rules against the list of services that are actually authorized to send traces.

OpenTelemetry docs

What encryption and audit evidence regulated teams should collect

Encryption at rest and in transit is decided by the infrastructure you choose, not by Langfuse alone. PostgreSQL, ClickHouse and the S3-compatible blob storage each hold prompts, traces or metadata, and each inherits its encryption posture from the cloud account, data center or storage platform underneath it. Before a control owner signs off, ask the cloud or data center provider to confirm, in writing, which encryption is enabled for each volume and bucket, who manages the keys, how key rotation works, and whether TLS is enforced between Langfuse Web, Langfuse Worker and each data store. Record the answers next to the architecture diagram so the evidence and the deployment describe the same system.

Audit logs are an Enterprise feature, so plan for the license key before you plan the evidence. Langfuse lists audit logs among the features that need an Enterprise license key, alongside project-level RBAC, data retention policies and server-side data masking. If your control set depends on who changed a prompt, exported traces or altered an SSO or admin setting, confirm with Langfuse that the Enterprise edition covers those events, and export the logs on a schedule to storage your security team controls. Keep the export, the retention period you set, and the access list for the log store as evidence. Confirm the exact event coverage in the Langfuse license key documentation before you map it to a control.

DeployOpen prepares systems and evidence for compliance assessments, but it does not issue audit reports or certifications. We can configure the encryption settings, assemble the configuration and access records, and organize the evidence for your control owners. An independent auditor or certification body decides whether those controls meet a framework. Agree in writing, before work starts, which evidence items are in scope, who owns each one, and how often it is refreshed, so the assessment has a single, current record to review.

Where the trust boundaries sit in a hardened Langfuse deployment

The diagram starts with applications and SDKs sending traces over OTLP and the Langfuse API into a TLS reverse proxy, the only element that should face outside traffic. Behind it, Langfuse Web and Langfuse Worker run inside a private network and reach PostgreSQL, ClickHouse, Redis or Valkey, and S3-compatible blob storage. The SSO provider sits outside the boundary, and administrators reach the platform through a separate path. Check that no data store has a public address, that each hand-off uses encrypted transport, and that admin access is not shared with the ingestion path.

Trust boundaries between clients, the private Langfuse network, and the external SSO provider.

How to test that controls hold and fail safely

Test each control from the position of the party it is meant to stop, and do it before users or real traces arrive. Start with network exposure: from a host outside your allowed address range, confirm that the Langfuse web endpoint, the load balancer and any database or storage ports do not answer. Run the same check against PostgreSQL, ClickHouse, Redis or Valkey and the S3-compatible bucket, because a deployment can be locked down at the ingress while an internal service is still reachable from a wider network. Record the result for each path, not only for the public hostname.

Next, test identity and access. With SSO enforced for your managed email domains, attempt password sign-in with an account on that domain and confirm it is refused. Then test role-based access with at least two test users in two projects: a user in project A should not read traces, prompts or datasets in project B through the UI or the public API with a key issued to project A. Project-level roles and protected prompt labels depend on an Enterprise license key, so confirm the edition you run before you write those results into a control register. For the SSO failure case, stop or misconfigure the identity provider in a test instance and confirm that Langfuse does not fall back to a local account, a shared admin login or an open sign-up path. Write down exactly what a user sees.

Finally, test data handling. Seed the instance with fake but realistic-looking sensitive values, such as card-like numbers, patient identifiers and API keys, inside a prompt and a trace. Check whether server-side data masking, where your edition provides it, hides them in the UI, the API responses and exports. Then apply a short retention setting to test data and confirm that the records and their blob copies are removed on schedule, which you can check against your retention documentation. Confirm your audit logs capture these events. These tests show what the configuration does, but they do not prove the deployment is secure. Treat independent security testing of the deployment as a separate step, scoped in writing, with a retest after fixes.

What to monitor, rotate, back up and document after hardening

This table lists the recurring security tasks that keep a hardened self-hosted Langfuse deployment trustworthy after go-live, with what each task guards against and who should own it. Read it as a starting operating calendar: agree owners and cadences in writing before handover, because a hardened setup drifts quickly without them.

Recurring itemWhat it guards againstTypical owner
Review of user and role membershipFormer staff or contractors keeping access to prompts and traces, and project roles drifting from least privilege (project-level RBAC needs an Enterprise key)Platform owner with the security team approving changes
Secret rotation scheduleExposure of database, ClickHouse, blob storage, SSO client and encryption secrets over time; confirm rotation steps for each secret with the vendor docs before go-livePlatform engineering, with the security team setting the interval
Audit log reviewUnnoticed admin changes, data exports or retention edits (audit logs need an Enterprise key); define who reads the logs and how oftenSecurity operations or compliance lead
TLS certificate renewalOutage of the public UI and ingestion endpoints, or fallback to weak configuration when certificates expireInfrastructure or network team
Dependency and version updatesUnpatched containers and data stores; plan within-major updates and major upgrades against the Langfuse upgrade guides, including ClickHouse 25.12 or later and PostgreSQL 15 or later for v4Platform engineering, with change approval
Backup and restore tests for PostgreSQL, ClickHouse and blob storageBackups that exist but cannot be restored; test restores into an isolated environment and record the time taken and any gapsDatabase owners, with a periodic sign-off from operations
Written control documentationAuditors and internal reviewers finding controls that are configured but not explained; keep architecture, access, retention and key handling records currentCompliance lead, with input from platform engineering

Questions regulated teams ask about hardening Langfuse

Is the open source edition of Langfuse enough for SSO and data masking?

SSO is available in the open source edition. Self-hosted Langfuse supports SSO through Auth.js providers such as Google, GitHub, Azure AD or Entra ID, Okta, Keycloak and generic OIDC, and it can disable password sign-in or enforce SSO for given email domains. Server-side data masking is different: it is listed among the features that need an Enterprise license key, so it is not part of the open source edition. Confirm this against the license key documentation for your version, and plan a client-side or pipeline-side redaction step if masking is required and no key is planned. The core features and APIs are otherwise available in the MIT-licensed version.

Which Langfuse hardening controls need an Enterprise license key?

According to the license key documentation, the self-hosted features that need a key include:

  • Project-level RBAC roles
  • Protected prompt labels
  • Data retention policies
  • Audit logs
  • Server-side data masking
  • UI customization and the org management API with SCIM

The instance management API and organization creators also require a key. Confirm the current list on the license key page before you set requirements, because it changes between releases. Your team should decide early which of these controls your regulator or internal policy expects, since that decision determines whether the Self-Hosted Enterprise plan is needed.

How much effort does hardening a self-hosted Langfuse take, and what drives it?

Effort depends mainly on the number of controls in scope, how many identity and network systems must be integrated, and how many teams send data. The main drivers are the identity provider setup, network exposure and TLS design, secrets handling for PostgreSQL, ClickHouse and blob storage, retention and masking rules agreed with data owners, and the evidence your compliance team needs. Ask any partner for a fixed-scope written proposal that lists each control, the environment it applies to and the review steps. Duration figures should come from that written scope, not from general estimates.

Can our internal platform team harden Langfuse without outside help?

Often yes, if the team already runs Kubernetes or Docker-based services, manages an identity provider and has security review capacity. Hardening still touches several areas at once: ingress and private networking, secrets, SSO configuration, role design, backups and audit evidence. Teams that have not handled a regulated review before often underestimate the documentation and verification work. A useful check is whether one person can own each control from configuration through evidence. Where that is not true, a partner can cover the gaps, and the internal team keeps ownership of the running system.

What does the hardening work need from our organization?

Expect to provide four things: access to your identity provider with rights to register an application and configure SSO and domain enforcement, approvals for network paths and firewall rules to the Langfuse hosts and data stores, named data owners who decide retention periods and what must be masked, and a test environment or change window for verification. Your security team should also name who approves exceptions. Lacking any of these usually stalls the work at the point where it is most expensive to restart, so confirm them in the written scope before work starts.

What does a partner hand over at the end of hardening?

A partner should hand over the configuration as deployed, documented controls mapped to your requirements, the SSO and role settings, network and secrets design, backup and retention settings, an audit logging review, and test results with the fixes made. Ask for the handover list in writing before work starts, including which items are configuration, which are documentation and which are evidence for your compliance team. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue any audit report or attestation.

Does hardening Langfuse protect prompts and traces that contain sensitive data?

Hardening reduces exposure, but it does not decide what data should be sent in the first place. Prompts and traces can contain personal, financial or health information, so the controls work best with an agreed data classification and rules for what applications may send. Network restriction, encryption in transit and at rest, scoped secrets, SSO with role separation and retention limits all address different risks. Ask your team to confirm which fields are sensitive and where masking must happen, whether in the application, in the pipeline or in Langfuse with an Enterprise key.

How DeployOpen scopes and hands over Langfuse hardening

DeployOpen agrees the hardening scope in writing before any work starts. For a Langfuse deployment, that scope names the environments covered (for example, production and a non-production copy), the components in the boundary (Langfuse Web, Langfuse Worker, PostgreSQL, ClickHouse, Redis or Valkey, and the S3-compatible blob store), the controls to configure and the evidence to hand over. Most engagements are fixed-scope, so deliverables and timelines are fixed in the same document, and the quote follows from that written scope. DeployOpen does not publish a price list. Your team should ask for the quote to list each control, who configures it, which controls depend on an Enterprise license key, and what is excluded, such as your identity provider administration or your cloud network team's work.

The work happens inside your own cloud accounts, data centers or air-gapped network, so prompts and traces never leave your environment during the engagement. DeployOpen configures and documents the controls covered in this topic: network exposure, encryption, secrets handling, SSO enforcement, data masking and retention settings, and audit logging. It then tests the deployed system against that configuration and reports findings with fixes and a retest. Where a control needs an Enterprise license key, such as data retention policies, server-side data masking or audit logs, the scope should say so, and your team should confirm the license decision with Langfuse before configuration starts. The Langfuse license key documentation lists the features that need one.

At handover, you receive the configuration record, the evidence that each control was applied and tested, and runbooks for routine operations such as rotating secrets, reviewing audit logs and changing retention settings. Ongoing support, upgrades and continuous testing are available as retainers, which matter because Langfuse ships updates and major version changes that can affect security settings. Ask for a named owner on each side and a written list of what the retainer covers after go-live, so that hardening does not drift once the initial scope closes.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.