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
Merge branch 'main' into feature/google-signin-signup-integration
Sheen Capadngan69472514af0b
diff --cc backend/src/config/index.tsindex 870c7b2bb0,4c6bed800f..efbc90df82--- a/backend/src/config/index.ts+++ b/backend/src/config/index.ts@@@ -1,59 -1,61 +1,64 @@@- import infisical from 'infisical-node';- export const getPort = () => infisical.get('PORT')! || 4000;- export const getInviteOnlySignup = () => infisical.get('INVITE_ONLY_SIGNUP')! == undefined ? false : infisical.get('INVITE_ONLY_SIGNUP');- export const getEncryptionKey = () => infisical.get('ENCRYPTION_KEY')!;- export const getSaltRounds = () => parseInt(infisical.get('SALT_ROUNDS')!) || 10;- export const getJwtAuthLifetime = () => infisical.get('JWT_AUTH_LIFETIME')! || '10d';- export const getJwtAuthSecret = () => infisical.get('JWT_AUTH_SECRET')!;- export const getJwtMfaLifetime = () => infisical.get('JWT_MFA_LIFETIME')! || '5m';- export const getJwtMfaSecret = () => infisical.get('JWT_MFA_LIFETIME')! || '5m';- export const getJwtRefreshLifetime = () => infisical.get('JWT_REFRESH_LIFETIME')! || '90d';- export const getJwtRefreshSecret = () => infisical.get('JWT_REFRESH_SECRET')!;- export const getJwtServiceSecret = () => infisical.get('JWT_SERVICE_SECRET')!;- export const getJwtSignupLifetime = () => infisical.get('JWT_SIGNUP_LIFETIME')! || '15m';- export const getJwtSignupSecret = () => infisical.get('JWT_SIGNUP_SECRET')!;- export const getJwtProviderAuthSecret = () => infisical.get('JWT_PROVIDER_AUTH_SECRET')!;- export const getJwtProviderAuthLifetime = () => infisical.get('JWT_PROVIDER_AUTH_LIFETIME')! || '15m';- export const getMongoURL = () => infisical.get('MONGO_URL')!;- export const getNodeEnv = () => infisical.get('NODE_ENV')! || 'production';- export const getVerboseErrorOutput = () => infisical.get('VERBOSE_ERROR_OUTPUT')! === 'true' && true;- export const getLokiHost = () => infisical.get('LOKI_HOST')!;- export const getClientIdAzure = () => infisical.get('CLIENT_ID_AZURE')!;- export const getClientIdHeroku = () => infisical.get('CLIENT_ID_HEROKU')!;- export const getClientIdVercel = () => infisical.get('CLIENT_ID_VERCEL')!;- export const getClientIdNetlify = () => infisical.get('CLIENT_ID_NETLIFY')!;- export const getClientIdGitHub = () => infisical.get('CLIENT_ID_GITHUB')!;- export const getClientIdGitLab = () => infisical.get('CLIENT_ID_GITLAB')!;- export const getClientSecretAzure = () => infisical.get('CLIENT_SECRET_AZURE')!;- export const getClientSecretHeroku = () => infisical.get('CLIENT_SECRET_HEROKU')!;- export const getClientSecretVercel = () => infisical.get('CLIENT_SECRET_VERCEL')!;- export const getClientSecretNetlify = () => infisical.get('CLIENT_SECRET_NETLIFY')!;- export const getClientSecretGitHub = () => infisical.get('CLIENT_SECRET_GITHUB')!;- export const getClientSecretGitLab = () => infisical.get('CLIENT_SECRET_GITLAB')!;- export const getClientSlugVercel = () => infisical.get('CLIENT_SLUG_VERCEL')!;- export const getPostHogHost = () => infisical.get('POSTHOG_HOST')! || 'https://app.posthog.com';- export const getPostHogProjectApiKey = () => infisical.get('POSTHOG_PROJECT_API_KEY')! || 'phc_nSin8j5q2zdhpFDI1ETmFNUIuTG4DwKVyIigrY10XiE';- export const getSentryDSN = () => infisical.get('SENTRY_DSN')!;- export const getSessionSecret = () => infisical.get('SESSION_SECRET')!;- export const getSiteURL = () => infisical.get('SITE_URL')!;- export const getSmtpHost = () => infisical.get('SMTP_HOST')!;- export const getSmtpSecure = () => infisical.get('SMTP_SECURE')! === 'true' || false;- export const getSmtpPort = () => parseInt(infisical.get('SMTP_PORT')!) || 587;- export const getSmtpUsername = () => infisical.get('SMTP_USERNAME')!;- export const getSmtpPassword = () => infisical.get('SMTP_PASSWORD')!;- export const getSmtpFromAddress = () => infisical.get('SMTP_FROM_ADDRESS')!;- export const getSmtpFromName = () => infisical.get('SMTP_FROM_NAME')! || 'Infisical';- export const getStripeProductStarter = () => infisical.get('STRIPE_PRODUCT_STARTER')!;- export const getStripeProductPro = () => infisical.get('STRIPE_PRODUCT_PRO')!;- export const getStripeProductTeam = () => infisical.get('STRIPE_PRODUCT_TEAM')!;- export const getStripePublishableKey = () => infisical.get('STRIPE_PUBLISHABLE_KEY')!;- export const getStripeSecretKey = () => infisical.get('STRIPE_SECRET_KEY')!;- export const getStripeWebhookSecret = () => infisical.get('STRIPE_WEBHOOK_SECRET')!;- export const getTelemetryEnabled = () => infisical.get('TELEMETRY_ENABLED')! !== 'false' && true;- export const getLoopsApiKey = () => infisical.get('LOOPS_API_KEY')!;- export const getSmtpConfigured = () => infisical.get('SMTP_HOST') == '' || infisical.get('SMTP_HOST') == undefined ? false : true- export const getHttpsEnabled = () => {- if (getNodeEnv() != "production") {+ import InfisicalClient from 'infisical-node';++ const client = new InfisicalClient({+ token: process.env.INFISICAL_TOKEN!+ });++ export const getPort = async () => (await client.getSecret('PORT')).secretValue || 4000;+ export const getInviteOnlySignup = async () => (await client.getSecret('INVITE_ONLY_SIGNUP')).secretValue == undefined ? false : await client.getSecret('INVITE_ONLY_SIGNUP');+ export const getEncryptionKey = async () => (await client.getSecret('ENCRYPTION_KEY')).secretValue;+ export const getSaltRounds = async () => parseInt((await client.getSecret('SALT_ROUNDS')).secretValue) || 10;+ export const getJwtAuthLifetime = async () => (await client.getSecret('JWT_AUTH_LIFETIME')).secretValue || '10d';+ export const getJwtAuthSecret = async () => (await client.getSecret('JWT_AUTH_SECRET')).secretValue;+ export const getJwtMfaLifetime = async () => (await client.getSecret('JWT_MFA_LIFETIME')).secretValue || '5m';+ export const getJwtMfaSecret = async () => (await client.getSecret('JWT_MFA_LIFETIME')).secretValue || '5m';+ export const getJwtRefreshLifetime = async () => (await client.getSecret('JWT_REFRESH_LIFETIME')).secretValue || '90d';+ export const getJwtRefreshSecret = async () => (await client.getSecret('JWT_REFRESH_SECRET')).secretValue;+ export const getJwtServiceSecret = async () => (await client.getSecret('JWT_SERVICE_SECRET')).secretValue;+ export const getJwtSignupLifetime = async () => (await client.getSecret('JWT_SIGNUP_LIFETIME')).secretValue || '15m';++export const getJwtProviderAuthSecret = async () => (await client.getSecret('JWT_PROVIDER_AUTH_SECRET')).secretValue;++export const getJwtProviderAuthLifetime = async () => (await client.getSecret('JWT_PROVIDER_AUTH_LIFETIME')).secretValue || '15m';+ export const getJwtSignupSecret = async () => (await client.getSecret('JWT_SIGNUP_SECRET')).secretValue;+ export const getMongoURL = async () => (await client.getSecret('MONGO_URL')).secretValue;+ export const getNodeEnv = async () => (await client.getSecret('NODE_ENV')).secretValue || 'production';+ export const getVerboseErrorOutput = async () => (await client.getSecret('VERBOSE_ERROR_OUTPUT')).secretValue === 'true' && true;+ export const getLokiHost = async () => (await client.getSecret('LOKI_HOST')).secretValue;+ export const getClientIdAzure = async () => (await client.getSecret('CLIENT_ID_AZURE')).secretValue;+ export const getClientIdHeroku = async () => (await client.getSecret('CLIENT_ID_HEROKU')).secretValue;+ export const getClientIdVercel = async () => (await client.getSecret('CLIENT_ID_VERCEL')).secretValue;+ export const getClientIdNetlify = async () => (await client.getSecret('CLIENT_ID_NETLIFY')).secretValue;+ export const getClientIdGitHub = async () => (await client.getSecret('CLIENT_ID_GITHUB')).secretValue;+ export const getClientIdGitLab = async () => (await client.getSecret('CLIENT_ID_GITLAB')).secretValue;+ export const getClientSecretAzure = async () => (await client.getSecret('CLIENT_SECRET_AZURE')).secretValue;+ export const getClientSecretHeroku = async () => (await client.getSecret('CLIENT_SECRET_HEROKU')).secretValue;+ export const getClientSecretVercel = async () => (await client.getSecret('CLIENT_SECRET_VERCEL')).secretValue;+ export const getClientSecretNetlify = async () => (await client.getSecret('CLIENT_SECRET_NETLIFY')).secretValue;+ export const getClientSecretGitHub = async () => (await client.getSecret('CLIENT_SECRET_GITHUB')).secretValue;+ export const getClientSecretGitLab = async () => (await client.getSecret('CLIENT_SECRET_GITLAB')).secretValue;+ export const getClientSlugVercel = async () => (await client.getSecret('CLIENT_SLUG_VERCEL')).secretValue;+ export const getPostHogHost = async () => (await client.getSecret('POSTHOG_HOST')).secretValue || 'https://app.posthog.com';+ export const getPostHogProjectApiKey = async () => (await client.getSecret('POSTHOG_PROJECT_API_KEY')).secretValue || 'phc_nSin8j5q2zdhpFDI1ETmFNUIuTG4DwKVyIigrY10XiE';+ export const getSentryDSN = async () => (await client.getSecret('SENTRY_DSN')).secretValue;++export const getSessionSecret = async () => (await client.getSecret('SESSION_SECRET')).secretValue;+ export const getSiteURL = async () => (await client.getSecret('SITE_URL')).secretValue;+ export const getSmtpHost = async () => (await client.getSecret('SMTP_HOST')).secretValue;+ export const getSmtpSecure = async () => (await client.getSecret('SMTP_SECURE')).secretValue === 'true' || false;+ export const getSmtpPort = async () => parseInt((await client.getSecret('SMTP_PORT')).secretValue) || 587;+ export const getSmtpUsername = async () => (await client.getSecret('SMTP_USERNAME')).secretValue;+ export const getSmtpPassword = async () => (await client.getSecret('SMTP_PASSWORD')).secretValue;+ export const getSmtpFromAddress = async () => (await client.getSecret('SMTP_FROM_ADDRESS')).secretValue;+ export const getSmtpFromName = async () => (await client.getSecret('SMTP_FROM_NAME')).secretValue || 'Infisical';+ export const getStripeProductStarter = async () => (await client.getSecret('STRIPE_PRODUCT_STARTER')).secretValue;+ export const getStripeProductPro = async () => (await client.getSecret('STRIPE_PRODUCT_PRO')).secretValue;+ export const getStripeProductTeam = async () => (await client.getSecret('STRIPE_PRODUCT_TEAM')).secretValue;+ export const getStripePublishableKey = async () => (await client.getSecret('STRIPE_PUBLISHABLE_KEY')).secretValue;+ export const getStripeSecretKey = async () => (await client.getSecret('STRIPE_SECRET_KEY')).secretValue;+ export const getStripeWebhookSecret = async () => (await client.getSecret('STRIPE_WEBHOOK_SECRET')).secretValue;+ export const getTelemetryEnabled = async () => (await client.getSecret('TELEMETRY_ENABLED')).secretValue !== 'false' && true;+ export const getLoopsApiKey = async () => (await client.getSecret('LOOPS_API_KEY')).secretValue;+ export const getSmtpConfigured = async () => (await client.getSecret('SMTP_HOST')).secretValue == '' || (await client.getSecret('SMTP_HOST')).secretValue == undefined ? false : true+ export const getHttpsEnabled = async () => {+ if ((await getNodeEnv()) != "production") {// no https for anything other than prodreturn false}diff --cc backend/src/index.tsindex 3b3091f92b,7270470ce2..a250fc6bca--- a/backend/src/index.ts+++ b/backend/src/index.ts@@@ -1,6 -1,6 +1,5 @@@-import mongoose from 'mongoose';import dotenv from 'dotenv';dotenv.config();- import infisical from 'infisical-node';import express from 'express';import helmet from 'helmet';import cors from 'cors';@@@ -112,13 -105,8 +106,13 @@@ const main = async () =>);app.use(requestIp.mw());+ app.use(session({+ secret: getSessionSecret(),+ resave: false, // don't save session if unmodified+ saveUninitialized: false, // don't create session until something stored+ }));- if (getNodeEnv() === 'production') {+ if ((await getNodeEnv()) === 'production') {// enable app-wide rate-limiting + helmet security// in productionapp.disable('x-powered-by');