SAML SSO is part of the Formbricks Enterprise Edition
Overview
Formbricks supports SAML Single Sign-On (SSO) to enable secure, centralized authentication. With SAML, organizations can integrate their existing Identity Provider (IdP) infrastructure for streamlined access management. Formbricks internally uses BoxyHQ’s SAML Jackson to manage SAML connections. SAML Jackson is a service provided by BoxyHQ that manages SAML connection details and validates assertions. It is part of the Formbricks server. To learn more about SAML Jackson, please refer to the BoxyHQ SAML Jackson documentation.How SAML works in Formbricks
SAML (Security Assertion Markup Language) is an XML-based standard for exchanging authentication and authorization data between an Identity Provider (IdP) and Formbricks. Here’s how the integration works with BoxyHQ Jackson embedded into the flow:-
Login Initiation:
The user clicksContinue with SAML SSOon Formbricks. -
Configuration Retrieval via BoxyHQ:
Formbricks requests the SAML connection details from BoxyHQ Jackson. BoxyHQ securely stores and manages the IdP configuration, including endpoints, certificates, and other metadata. -
Redirection:
With the configuration details from BoxyHQ, Formbricks redirects the user to the IdP’s login page (e.g., Okta). -
Authentication:
The user authenticates directly with the IdP. -
SAML Response:
Upon successful authentication, the IdP sends a signed SAML response back to Formbricks via the user’s browser. -
Validation via BoxyHQ:
BoxyHQ Jackson validates the SAML assertion—verifying the signature and extracting user details—before sending the validated data back to Formbricks. -
Access Granted:
Formbricks logs the user in using the verified information.
SAML Auth Flow Sequence Diagram
Below is a sequence diagram illustrating the complete SAML authentication flow with BoxyHQ Jackson integrated:Setting Up SAML SSO
To configure SAML SSO in Formbricks, follow these steps:1
Database Setup
Configure a dedicated PostgreSQL database with The database certificate must cover the hostname in the URL. Use your secret manager for credentials
and verify the connection from the deployed runtime. Do not disable TLS to work around certificate errors.
SAML_DATABASE_URL. For a private certificate
authority, mount its CA certificate read-only into the app and require hostname verification:2
IdP Application
Create a SAML application in your IdP by following your provider’s instructions. See SAML with Identity Providers for the values Formbricks expects.
3
User Provisioning
Provision users in your IdP and configure access to the IdP SAML app for all your users (who need access to
Formbricks).
4
Metadata
Keep the XML metadata from your IdP handy for the next step.
5
Metadata Setup
Create a file called
connection.xml in your self-hosted Formbricks instance’s formbricks/saml-connection (use formbricks/apps/web/saml-connection for development) directory and paste the XML metadata from your IdP into it. Please create the directory if it doesn’t exist. Your metadata file should start with a tag like this: <?xml version="1.0" encoding="UTF-8"?><...> or <md:EntityDescriptor entityID="...">. Please remove any extra text from the metadata.6
Restart Formbricks
Recreate the app to apply environment and mounted-file changes:
docker compose up -d --no-deps --force-recreate formbricks. For Kubernetes, deploy the changed Secret and volume configuration through Helm or GitOps. Verify sign-in in a fresh session.We don’t support multiple SAML connections yet. You can only have one SAML connection at a time. If you
change the
connection.xml file, your existing SAML connection will be overwritten.Limits on SAML Responses
The SAML callback accepts sign-ins from anyone, so Formbricks bounds what it does with each response before checking who sent it. A response is refused, and the user is sent back to the login page, when it:- is larger than 256 KiB, the size limit for every
/api/authrequest; - carries more than 12,000 tags and attribute names, or nests elements more than 64 levels deep;
- contains a
DOCTYPEor another XML declaration other than the usual<?xml ...?>line; - takes longer than 100 ms to parse, or more memory than a parse of a real response needs. For an encrypted assertion, this includes decrypting it and parsing what it holds.
DOCTYPE checks above too. The SAML bridge rejects an encrypted assertion that does not decrypt with this instance’s SAML certificate, as it does any response that fails validation.
Real responses stay within these limits. A response carrying 1,000 group memberships written as verbosely as Okta writes them is about 247 KiB and 5,000 tags and attribute names; a signed or encrypted assertion nests about 10 levels deep. If users with very many groups are refused, have your IdP send only the groups Formbricks needs, for example with a group filter on the SAML app, rather than every group the user belongs to.
When many sign-ins arrive at once, a server may also answer some with “try again” rather than fall behind on everything else. Each client IP may send 120 SAML responses a minute. That limit only applies when Formbricks can tell client IPs apart, which takes a trusted proxy in front of it: see Configure Trusted Proxy Hops for TRUSTED_PROXY_HOP_COUNT. A response that is refused after it was parsed is logged with its claimed issuer, response ID and InResponseTo; refusals before that are logged by size. The content is never logged.