Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Add TRUST_SAML_EMAILS and TRUST_LDAP_EMAILS opts
Tuan Dang80da2a19aae8
diff --git a/backend/src/ee/services/ldap-config/ldap-config-service.ts b/backend/src/ee/services/ldap-config/ldap-config-service.tsindex d6fa72c279..ce74147474 100644--- a/backend/src/ee/services/ldap-config/ldap-config-service.ts+++ b/backend/src/ee/services/ldap-config/ldap-config-service.ts@@ -437,7 +437,7 @@ export const ldapConfigServiceFactory = ({{username: uniqueUsername,email: emails[0],- isEmailVerified: false,+ isEmailVerified: appCfg.TRUST_LDAP_EMAILS,firstName,lastName,authMethods: [],@@ -557,7 +557,7 @@ export const ldapConfigServiceFactory = ({authTokenType: AuthTokenType.PROVIDER_TOKEN,userId: user.id,username: user.username,- ...(user.email && { email: user.email }),+ ...(user.email && { email: user.email, isEmailVerified: user.isEmailVerified }),firstName,lastName,organizationName: organization.name,diff --git a/backend/src/ee/services/saml-config/saml-config-service.ts b/backend/src/ee/services/saml-config/saml-config-service.tsindex a4785132b1..4d824613f3 100644--- a/backend/src/ee/services/saml-config/saml-config-service.ts+++ b/backend/src/ee/services/saml-config/saml-config-service.ts@@ -374,7 +374,7 @@ export const samlConfigServiceFactory = ({{username: uniqueUsername,email,- isEmailVerified: false,+ isEmailVerified: appCfg.TRUST_SAML_EMAILS,firstName,lastName,authMethods: [],@@ -414,7 +414,7 @@ export const samlConfigServiceFactory = ({authTokenType: AuthTokenType.PROVIDER_TOKEN,userId: user.id,username: user.username,- ...(user.email && { email: user.email }),+ ...(user.email && { email: user.email, isEmailVerified: user.isEmailVerified }),firstName,lastName,organizationName: organization.name,diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.tsindex 4d3d55ffd2..8a365f2847 100644--- a/backend/src/lib/config/env.ts+++ b/backend/src/lib/config/env.ts@@ -98,6 +98,9 @@ const envSchema = zCLIENT_ID_GITLAB: zpStr(z.string().optional()),CLIENT_SECRET_GITLAB: zpStr(z.string().optional()),URL_GITLAB_URL: zpStr(z.string().optional().default(GITLAB_URL)),+ // email verification+ TRUST_SAML_EMAILS: zodStrBool.default("false"),+ TRUST_LDAP_EMAILS: zodStrBool.default("false"),// SECRET-SCANNINGSECRET_SCANNING_WEBHOOK_PROXY: zpStr(z.string().optional()),SECRET_SCANNING_WEBHOOK_SECRET: zpStr(z.string().optional()),diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.tsindex 5d81eaae14..4d2a302c60 100644--- a/backend/src/services/auth/auth-login-service.ts+++ b/backend/src/services/auth/auth-login-service.ts@@ -361,6 +361,7 @@ export const authLoginServiceFactory = ({user = await userDAL.create({username: email,email,+ isEmailVerified: true,firstName,lastName,authMethods: [authMethod],@@ -374,6 +375,8 @@ export const authLoginServiceFactory = ({authTokenType: AuthTokenType.PROVIDER_TOKEN,userId: user.id,username: user.username,+ email: user.email,+ isEmailVerified: user.isEmailVerified,firstName: user.firstName,lastName: user.lastName,authMethod,diff --git a/backend/src/services/auth/auth-signup-service.ts b/backend/src/services/auth/auth-signup-service.tsindex 86693df8d0..31ca5552fa 100644--- a/backend/src/services/auth/auth-signup-service.ts+++ b/backend/src/services/auth/auth-signup-service.ts@@ -135,11 +135,6 @@ export const authSignupServiceFactory = ({userAgent,authorization}: TCompleteAccountSignupDTO) => {- console.log("completeEmailAccountSignup args: ", {- email,- firstName,- lastName- });const user = await userDAL.findOne({ username: email });if (!user || (user && user.isAccepted)) {throw new Error("Failed to complete account for complete user");diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdxindex 4c1456d3b5..e9f4431a4e 100644--- a/docs/self-hosting/configuration/envars.mdx+++ b/docs/self-hosting/configuration/envars.mdx@@ -3,30 +3,34 @@ title: "Configurations"description: "Read how to configure environment variables for self-hosted Infisical."-----Infisical accepts all configurations via environment variables. For a minimal self-hosted instance, at least `ENCRYPTION_KEY`, `AUTH_SECRET`, `DB_CONNECTION_URI` and `REDIS_URL` must be defined.+Infisical accepts all configurations via environment variables. For a minimal self-hosted instance, at least `ENCRYPTION_KEY`, `AUTH_SECRET`, `DB_CONNECTION_URI` and `REDIS_URL` must be defined.However, you can configure additional settings to activate more features as needed.-## General platform+## General platform+Used to configure platform-specific security and operational settings<ParamField query="ENCRYPTION_KEY" type="string" default="none" required>- Must be a random 16 byte hex string. Can be generated with `openssl rand -hex 16`+ Must be a random 16 byte hex string. Can be generated with `openssl rand -hex+ 16`</ParamField><ParamField query="AUTH_SECRET" type="string" default="none" required>- Must be a random 32 byte base64 string. Can be generated with `openssl rand -base64 32`+ Must be a random 32 byte base64 string. Can be generated with `openssl rand+ -base64 32`</ParamField><ParamField query="SITE_URL" type="string" default="none" optional>- Must be an absolute URL including the protocol (e.g. https://app.infisical.com).+ Must be an absolute URL including the protocol (e.g.+ https://app.infisical.com).</ParamField>-## Data Layer+## Data Layer+The platform utilizes Postgres to persist all of its data and Redis for caching and backgroud tasks<ParamField query="DB_CONNECTION_URI" type="string" default="" required>- Postgres database connection string.+ Postgres database connection string.</ParamField><ParamField query="DB_ROOT_CERT" type="string" default="" optional>@@ -39,9 +43,8 @@ The platform utilizes Postgres to persist all of its data and Redis for cachingRedis connection string.</ParamField>--## Email service+Without email configuration, Infisical's core functions like sign-up/login and secret operations work, but this disables multi-factor authentication, email invites for projects, alerts for suspicious logins, and all other email-dependent features.<Accordion title="Generic Configuration">@@ -49,25 +52,36 @@ Without email configuration, Infisical's core functions like sign-up/login and sHostname to connect to for establishing SMTP connections</ParamField>- <ParamField query="SMTP_USERNAME" type="string" default="none" optional>- Credential to connect to host (e.g. [email protected])- </ParamField>+{" "}- <ParamField query="SMTP_PASSWORD" type="string" default="none" optional>- Credential to connect to host- </ParamField>+<ParamField query="SMTP_USERNAME" type="string" default="none" optional>+ Credential to connect to host (e.g. [email protected])+</ParamField>- <ParamField query="SMTP_PORT" type="string" default="587" optional>- Port to connect to for establishing SMTP connections- </ParamField>+{" "}- <ParamField query="SMTP_SECURE" type="string" default="none" optional>- If true, use TLS when connecting to host. If false, TLS will be used if STARTTLS is supported- </ParamField>+<ParamField query="SMTP_PASSWORD" type="string" default="none" optional>+ Credential to connect to host+</ParamField>- <ParamField query="SMTP_FROM_ADDRESS" type="string" default="none" optional>- Email address to be used for sending emails- </ParamField>+{" "}++<ParamField query="SMTP_PORT" type="string" default="587" optional>+ Port to connect to for establishing SMTP connections+</ParamField>++{" "}++<ParamField query="SMTP_SECURE" type="string" default="none" optional>+ If true, use TLS when connecting to host. If false, TLS will be used if+ STARTTLS is supported+</ParamField>++{" "}++<ParamField query="SMTP_FROM_ADDRESS" type="string" default="none" optional>+ Email address to be used for sending emails+</ParamField><ParamField query="SMTP_FROM_NAME" type="string" default="none" optional>Name label to be used in From field (e.g. Team)@@ -76,25 +90,25 @@ Without email configuration, Infisical's core functions like sign-up/login and s<Accordion title="Twilio SendGrid">- 1. Create an account and configure [SendGrid](https://sendgrid.com) to send emails.- 2. Create a SendGrid API Key under Settings > [API Keys](https://app.sendgrid.com/settings/api_keys)- 3. Set a name for your API Key, we recommend using "Infisical," and select the "Restricted Key" option. You will need to enable the "Mail Send" permission as shown below:+1. Create an account and configure [SendGrid](https://sendgrid.com) to send emails.+2. Create a SendGrid API Key under Settings > [API Keys](https://app.sendgrid.com/settings/api_keys)+3. Set a name for your API Key, we recommend using "Infisical," and select the "Restricted Key" option. You will need to enable the "Mail Send" permission as shown below:- +- +- 4. With the API Key, you can now set your SMTP environment variables:+4. With the API Key, you can now set your SMTP environment variables:- ```- SMTP_HOST=smtp.sendgrid.net- SMTP_USERNAME=apikey- SMTP_PASSWORD=SG.rqFsfjxYPiqE1lqZTgD_lz7x8IVLx # your SendGrid API Key from step above- SMTP_PORT=587- SMTP_SECURE=true- [email protected] # your email address being used to send out emails- SMTP_FROM_NAME=Infisical- ```+```+SMTP_HOST=smtp.sendgrid.net+SMTP_USERNAME=apikey+SMTP_PASSWORD=SG.rqFsfjxYPiqE1lqZTgD_lz7x8IVLx # your SendGrid API Key from step above+SMTP_PORT=587+SMTP_SECURE=true[email protected] # your email address being used to send out emails+SMTP_FROM_NAME=Infisical+```<Info>Remember that you will need to restart Infisical for this to work properly.@@ -105,19 +119,20 @@ Without email configuration, Infisical's core functions like sign-up/login and s1. Create an account and configure [Mailgun](https://www.mailgun.com) to send emails.2. Obtain your Mailgun credentials in Sending > Overview > SMTP- +- 3. With your Mailgun credentials, you can now set up your SMTP environment variables:+3. With your Mailgun credentials, you can now set up your SMTP environment variables:++```+SMTP_HOST=smtp.mailgun.org # obtained from credentials page[email protected] # obtained from credentials page+SMTP_PASSWORD=password # obtained from credentials page+SMTP_PORT=587+SMTP_SECURE=true[email protected] # your email address being used to send out emails+SMTP_FROM_NAME=Infisical+```- ```- SMTP_HOST=smtp.mailgun.org # obtained from credentials page- [email protected] # obtained from credentials page- SMTP_PASSWORD=password # obtained from credentials page- SMTP_PORT=587- SMTP_SECURE=true- [email protected] # your email address being used to send out emails- SMTP_FROM_NAME=Infisical- ```</Accordion><Accordion title="AWS SES">@@ -149,6 +164,7 @@ Without email configuration, Infisical's core functions like sign-up/login and sSMTP_FROM_NAME=Infisical```</Step>+</Steps><Info>@@ -160,30 +176,32 @@ Without email configuration, Infisical's core functions like sign-up/login and s1. Create an account and configure [SocketLabs](https://www.socketlabs.com/) to send emails.2. From the dashboard, navigate to SMTP Credentials > SMTP & APIs > SMTP Credentials to obtain your SocketLabs SMTP credentials.- +- +- 3. With your SocketLabs SMTP credentials, you can now set up your SMTP environment variables:+3. With your SocketLabs SMTP credentials, you can now set up your SMTP environment variables:- ```- SMTP_HOST=smtp.socketlabs.com- SMTP_USERNAME=username # obtained from your credentials- SMTP_PASSWORD=password # obtained from your credentials- SMTP_PORT=587- SMTP_SECURE=true- [email protected] # your email address being used to send out emails- SMTP_FROM_NAME=Infisical- ```+```+SMTP_HOST=smtp.socketlabs.com+SMTP_USERNAME=username # obtained from your credentials+SMTP_PASSWORD=password # obtained from your credentials+SMTP_PORT=587+SMTP_SECURE=true[email protected] # your email address being used to send out emails+SMTP_FROM_NAME=Infisical+```- <Note>- The `SMTP_FROM_ADDRESS` environment variable should be an email for an- authenticated domain under Configuration > Domain Management in SocketLabs.- For example, if you're using SocketLabs in sandbox mode, then you may use an- email like `[email protected]`.- </Note>+{" "}- +<Note>+ The `SMTP_FROM_ADDRESS` environment variable should be an email for an+ authenticated domain under Configuration > Domain Management in SocketLabs.+ For example, if you're using SocketLabs in sandbox mode, then you may use an+ email like `[email protected]`.+</Note>++<Info>Remember that you will need to restart Infisical for this to work properly.@@ -194,55 +212,57 @@ Without email configuration, Infisical's core functions like sign-up/login and s1. Create an account on [Resend](https://resend.com).2. Add a [Domain](https://resend.com/domains).- +++3. Create an [API Key](https://resend.com/api-keys).- 3. Create an [API Key](https://resend.com/api-keys).+- +4. Go to the [SMTP page](https://resend.com/settings/smtp) and copy the values.- 4. Go to the [SMTP page](https://resend.com/settings/smtp) and copy the values.+- +5. With the API Key, you can now set your SMTP environment variables variables:- 5. With the API Key, you can now set your SMTP environment variables variables:+```+SMTP_HOST=smtp.resend.com+SMTP_USERNAME=resend+SMTP_PASSWORD=YOUR_API_KEY+SMTP_PORT=587+SMTP_SECURE=true[email protected] # your email address being used to send out emails+SMTP_FROM_NAME=Infisical+```- ```- SMTP_HOST=smtp.resend.com- SMTP_USERNAME=resend- SMTP_PASSWORD=YOUR_API_KEY- SMTP_PORT=587- SMTP_SECURE=true- [email protected] # your email address being used to send out emails- SMTP_FROM_NAME=Infisical- ```<Info>Remember that you will need to restart Infisical for this to work properly.</Info>+</Accordion><Accordion title="Gmail">Create an account and enable "less secure app access" in Gmail Account Settings > Security. This will allowapplications like Infisical to authenticate with Gmail via your username and password.- +- With your Gmail username and password, you can set your SMTP environment variables:+With your Gmail username and password, you can set your SMTP environment variables:- ```- SMTP_HOST=smtp.gmail.com- [email protected] # your email- SMTP_PASSWORD=password # your password- SMTP_PORT=587- SMTP_SECURE=true- SMTP_FROM_NAME=Infisical- ```+```+SMTP_HOST=smtp.gmail.com[email protected] # your email+SMTP_PASSWORD=password # your password+SMTP_PORT=587+SMTP_SECURE=true+SMTP_FROM_NAME=Infisical+```<Warning>As per the [notice](https://support.google.com/accounts/answer/6010255?hl=en) by Google, you should note that using Gmail credentials for SMTP configurationwill only work for Google Workspace or Google Cloud Identity customers as of May 30, 2022.- Put differently, the SMTP configuration is only possible with business (not personal) Gmail credentials.+Put differently, the SMTP configuration is only possible with business (not personal) Gmail credentials.</Warning></Accordion>@@ -250,51 +270,51 @@ Without email configuration, Infisical's core functions like sign-up/login and s<Accordion title="Office365">1. Create an account and configure [Office365](https://www.office.com/) to send emails.- 2. With your login credentials, you can now set up your SMTP environment variables:-- ```- SMTP_HOST=smtp.office365.com- [email protected] # your username- SMTP_PASSWORD=password # your password- SMTP_PORT=587- SMTP_SECURE=true- SMTP_FROM_NAME=Infisical- ```+2. With your login credentials, you can now set up your SMTP environment variables:++```+SMTP_HOST=smtp.office365.com[email protected] # your username+SMTP_PASSWORD=password # your password+SMTP_PORT=587+SMTP_SECURE=true+SMTP_FROM_NAME=Infisical+```+</Accordion><Accordion title="Zoho Mail">1. Create an account and configure [Zoho Mail](https://www.zoho.com/mail/) to send emails.- 2. With your email credentials, you can now set up your SMTP environment variables:-- ```- SMTP_HOST=smtp.zoho.com- SMTP_USERNAME=username # your email- SMTP_PASSWORD=password # your password- SMTP_PORT=587- SMTP_SECURE=true- [email protected] # your personal Zoho email or domain-based email linked to Zoho Mail- SMTP_FROM_NAME=Infisical- ```-- <Note>- You can use either your personal Zoho email address like `[email protected]` or- a domain-based email address like `[email protected]`. If using a- domain-based email address, then please make sure that you've configured and- verified it with Zoho Mail.- </Note>+2. With your email credentials, you can now set up your SMTP environment variables:++```+SMTP_HOST=smtp.zoho.com+SMTP_USERNAME=username # your email+SMTP_PASSWORD=password # your password+SMTP_PORT=587+SMTP_SECURE=true[email protected] # your personal Zoho email or domain-based email linked to Zoho Mail+SMTP_FROM_NAME=Infisical+```++{" "}++<Note>+ You can use either your personal Zoho email address like `[email protected]` or+ a domain-based email address like `[email protected]`. If using a+ domain-based email address, then please make sure that you've configured and+ verified it with Zoho Mail.+</Note><Info>Remember that you will need to restart Infisical for this to work properly.</Info></Accordion>+## Authentication----## SSO based loginBy default, users can only login via email/password based login method.To login into Infisical with OAuth providers such as Google, configure the associated variables.@@ -335,33 +355,49 @@ To login into Infisical with OAuth providers such as Google, configure the assoc</Accordion><Accordion title="Okta SAML">- Requires enterprise license. Please contact [email protected] to get more information.+ Requires enterprise license. Please contact [email protected] to get more+ information.</Accordion><Accordion title="Azure SAML">- Requires enterprise license. Please contact [email protected] to get more information.+ Requires enterprise license. Please contact [email protected] to get more+ information.</Accordion><Accordion title="JumpCloud SAML">- Requires enterprise license. Please contact [email protected] to get more information.+ Requires enterprise license. Please contact [email protected] to get more+ information.</Accordion>-<ParamField query="NEXT_PUBLIC_SAML_ORG_SLUG" type="string">- Configure SAML organization slug to automatically redirect all users of your Infisical instance to the identity provider.+<ParamField query="TRUST_SAML_EMAILS" type="boolean" default="false" optional>+ Whether or not to trust emails from external SAML identity providers. If set+ to `false` then users will be prompted to verify their email address upon+ first login.+</ParamField>+<ParamField query="TRUST_LDAP_EMAILS" type="string" default="false" optional>+ Whether or not to trust emails from external LDAP servers. If set to `false`+ then users will be prompted to verify their email address upon first login.</ParamField>---+<ParamField query="NEXT_PUBLIC_SAML_ORG_SLUG" type="string">+ Configure SAML organization slug to automatically redirect all users of your+ Infisical instance to the identity provider.+</ParamField>## Native secret integrations+To help you sync secrets from Infisical to services such as Github and Gitlab, Infisical provides native integrations out of the box.<Accordion title="Heroku"><ParamField query="CLIENT_ID_HEROKU" type="string" default="none" optional>OAuth2 client ID for Heroku integration</ParamField>- <ParamField query="CLIENT_SECRET_HEROKU" type="string" default="none" optional>+ <ParamField+ query="CLIENT_SECRET_HEROKU"+ type="string"+ default="none"+ optional+ >OAuth2 client secret for Heroku integration</ParamField></Accordion>@@ -371,9 +407,11 @@ To help you sync secrets from Infisical to services such as Github and Gitlab, IOAuth2 client ID for Vercel integration</ParamField>- <ParamField query="CLIENT_SECRET_VERCEL" type="string" default="none" optional>- OAuth2 client secret for Vercel integration- </ParamField>+{" "}++<ParamField query="CLIENT_SECRET_VERCEL" type="string" default="none" optional>+ OAuth2 client secret for Vercel integration+</ParamField><ParamField query="CLIENT_SLUG_VERCEL" type="string" default="none" optional>OAuth2 slug for Vercel integrationdiff --git a/frontend/src/views/Org/MembersPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsx b/frontend/src/views/Org/MembersPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsxindex 7941687293..a14e09a67e 100644--- a/frontend/src/views/Org/MembersPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsx+++ b/frontend/src/views/Org/MembersPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsx@@ -149,8 +149,6 @@ export const OrgMembersTable = ({ handlePopUpOpen, setCompleteInviteLink }: Prop[members, searchMemberFilter]);- console.log("filterdUser: ", filterdUser);-return (<div><Inputdiff --git a/frontend/src/views/Signup/SignupSSO.tsx b/frontend/src/views/Signup/SignupSSO.tsxindex 09c707629e..cf25b918d4 100644--- a/frontend/src/views/Signup/SignupSSO.tsx+++ b/frontend/src/views/Signup/SignupSSO.tsx@@ -16,8 +16,16 @@ export const SignupSSO = ({ providerAuthToken }: Props) => {const [step, setStep] = useState(0);const [password, setPassword] = useState("");- const { username, email, organizationName, organizationSlug, firstName, lastName, authType } =- jwt_decode(providerAuthToken) as any;+ const {+ username,+ email,+ organizationName,+ organizationSlug,+ firstName,+ lastName,+ authType,+ isEmailVerified+ } = jwt_decode(providerAuthToken) as any;const renderView = () => {switch (step) {@@ -25,7 +33,7 @@ export const SignupSSO = ({ providerAuthToken }: Props) => {return (<UserInfoSSOStepusername={username}- email={email}+ isEmailVerified={isEmailVerified}name={`${firstName} ${lastName}`}providerOrganizationName={organizationName}password={password}diff --git a/frontend/src/views/Signup/components/UserInfoSSOStep/UserInfoSSOStep.tsx b/frontend/src/views/Signup/components/UserInfoSSOStep/UserInfoSSOStep.tsxindex 6255ae386e..0fadee48bb 100644--- a/frontend/src/views/Signup/components/UserInfoSSOStep/UserInfoSSOStep.tsx+++ b/frontend/src/views/Signup/components/UserInfoSSOStep/UserInfoSSOStep.tsx@@ -26,7 +26,7 @@ const client = new jsrp.client();type Props = {setStep: (step: number) => void;username: string;- email?: string;+ isEmailVerified?: boolean;password: string;setPassword: (value: string) => void;name: string;@@ -60,7 +60,7 @@ type Errors = {*/export const UserInfoSSOStep = ({username,- email,+ isEmailVerified,name,providerOrganizationName,password,@@ -204,13 +204,13 @@ export const UserInfoSSOStep = ({localStorage.setItem("orgData.id", orgId);localStorage.setItem("projectData.id", project.id);- if (email) {+ if (isEmailVerified) {+ // move to backup PDF step+ setStep(3);+ } else {// move to verify emailawait sendEmailVerificationCode();setStep(1);- } else {- // move to backup PDF step- setStep(3);}} catch (error) {setIsLoading(false);