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
feat: add a instance version update check and display
Scott Wilson3f818bf2a611
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.tsindex 9dbc8a1955..bed306e6f0 100644--- a/backend/src/@types/fastify.d.ts+++ b/backend/src/@types/fastify.d.ts@@ -180,6 +180,7 @@ import { TSlackServiceFactory } from "@app/services/slack/slack-service";import { TSuperAdminServiceFactory } from "@app/services/super-admin/super-admin-service";import { TTelemetryServiceFactory } from "@app/services/telemetry/telemetry-service";import { TTotpServiceFactory } from "@app/services/totp/totp-service";+import { TUpdateCheckServiceFactory } from "@app/services/update-check/update-check-queue";import { TUserDALFactory } from "@app/services/user/user-dal";import { TUserServiceFactory } from "@app/services/user/user-service";import { TUserActivationServiceFactory } from "@app/services/user-activation/user-activation-service";@@ -385,6 +386,7 @@ declare module "fastify" {trustedIp: TTrustedIpServiceFactory;secretBlindIndex: TSecretBlindIndexServiceFactory;telemetry: TTelemetryServiceFactory;+ updateCheck: TUpdateCheckServiceFactory;dynamicSecret: TDynamicSecretServiceFactory;dynamicSecretLease: TDynamicSecretLeaseServiceFactory;emailDomain: TEmailDomainServiceFactory;diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex 969450e6d0..2017692d76 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -140,6 +140,7 @@ export const KeyStorePrefixes = {InsightsCache: (projectId: string, endpoint: string) => `insights-cache:${projectId}:${endpoint}` as const,AdminConfig: "infisical-admin-cfg",+ UpdateCheckLatestVersion: "update-check-latest-version",InvalidatingCache: "invalidating-cache",SecretManagerCachePattern: "secret-manager:*",AuditLogMigrationAlert: "audit-log-migration-alert-last-row-count",@@ -186,6 +187,7 @@ export const KeyStoreTtls = {InsightsCacheInSeconds: 300, // 5 minutesInsightsDuplicationCacheInSeconds: 3600, // 1 hourAdminConfigInSeconds: 60,+ UpdateCheckLatestVersionInSeconds: 1209600, // 14 days (survives one missed weekly check)InvalidatingCacheInSeconds: 1800, // 30 minutes max lock for cache invalidation jobAuditLogMigrationAlertInSeconds: 604800, // 7 daysLicenseCloudPlanInSeconds: 300, // 5 minutesdiff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.tsindex e119665891..a4d6d1f70b 100644--- a/backend/src/lib/config/env.ts+++ b/backend/src/lib/config/env.ts@@ -55,6 +55,7 @@ const envSchema = z.default("false").transform((el) => el === "true"),DISABLE_PUBLIC_SECRET_SHARING: zodStrBool.default("false"),+ DISABLE_UPDATE_CHECK: zodStrBool.default("false"),REDIS_URL: zpStr(z.string().optional()),REDIS_USERNAME: zpStr(z.string().optional()),REDIS_PASSWORD: zpStr(z.string().optional()),diff --git a/backend/src/lib/cron/cron-job.ts b/backend/src/lib/cron/cron-job.tsindex 3640f0bf0b..72d2faa26c 100644--- a/backend/src/lib/cron/cron-job.ts+++ b/backend/src/lib/cron/cron-job.ts@@ -42,7 +42,8 @@ export const CronJobName = {AuditLogStreamOutboxStaleClaimSweeper: "audit-log-stream-outbox-stale-claim-sweeper",AuditLogStreamOutboxCleanup: "audit-log-stream-outbox-cleanup",LicenseUsageFlush: "license-usage-flush",- PamCredentialRotationQueueRotations: "pam-credential-rotation-queue-rotations"+ PamCredentialRotationQueueRotations: "pam-credential-rotation-queue-rotations",+ InstanceUpdateCheck: "instance-update-check"} as const;// ── tuning constants ──────────────────────────────────────────────────────────diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 02dd7b5089..0d8067071e 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -523,6 +523,7 @@ import { telemetryQueueServiceFactory } from "@app/services/telemetry/telemetry-import { telemetryServiceFactory } from "@app/services/telemetry/telemetry-service";import { totpConfigDALFactory } from "@app/services/totp/totp-config-dal";import { totpServiceFactory } from "@app/services/totp/totp-service";+import { updateCheckServiceFactory } from "@app/services/update-check/update-check-queue";import { userDALFactory } from "@app/services/user/user-dal";import { userServiceFactory } from "@app/services/user/user-service";import { userActivationDALFactory } from "@app/services/user-activation/user-activation-dal";@@ -1132,6 +1133,10 @@ export const registerRoutes = async (cronJob,telemetryService});+ const updateCheckService = updateCheckServiceFactory({+ cronJob,+ keyStore+ });const scimService = scimServiceFactory({licenseService,@@ -3833,6 +3838,7 @@ export const registerRoutes = async (// Register all cron jobs (synchronous registrations) before starting the schedulertelemetryQueue.startTelemetryCheck();telemetryQueue.startAggregatedEventsJob();+ updateCheckService.init();dailyResourceCleanUp.init();projectEnvQueue.init();projectCleanupQueue.init();@@ -3980,6 +3986,7 @@ export const registerRoutes = async (scim: scimService,secretBlindIndex: secretBlindIndexService,telemetry: telemetryService,+ updateCheck: updateCheckService,secretSharing: secretSharingService,userActivation: userActivationService,userEngagement: userEngagementService,diff --git a/backend/src/server/routes/v1/admin-router.ts b/backend/src/server/routes/v1/admin-router.tsindex 6c96970c94..3eeb5145c4 100644--- a/backend/src/server/routes/v1/admin-router.ts+++ b/backend/src/server/routes/v1/admin-router.ts@@ -42,6 +42,8 @@ const SanitizedSuperAdminSchema = z.object({enabledLoginMethods: z.string().array().nullable().optional(),authConsentContent: z.string().nullable().optional(),pageFrameContent: z.string().nullable().optional(),+ // Populated on self-hosted instances when a newer release than the running version exists+ latestAvailableVersion: z.string().nullable().optional(),// Super admin-only fields (omitted for non-super-admin callers)instanceId: z.string().uuid().optional(),createdAt: z.date().optional(),@@ -89,6 +91,8 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {const isSuperAdminUser = req.auth && isSuperAdmin(req.auth);const orgId = req.auth?.orgId ?? "";+ const latestAvailableVersion = await server.services.updateCheck.getAvailableUpdateVersion();+if (!isSuperAdminUser) {// Only return fields the frontend needs before authenticationreturn {@@ -106,7 +110,8 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {pageFrameContent: config.pageFrameContent,isPublicSecretSharingDisabled: serverEnvs.DISABLE_PUBLIC_SECRET_SHARING,licenseServerV2Enabled: serverEnvs.LICENSE_SERVER_V2_MODE === "on",- isCrossProjectSecretSharingEnabled: canUseCrossProjectSecretSharing(orgId)+ isCrossProjectSecretSharingEnabled: canUseCrossProjectSecretSharing(orgId),+ latestAvailableVersion}};}@@ -122,7 +127,8 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {kubernetesAutoFetchServiceAccountToken: serverEnvs.KUBERNETES_AUTO_FETCH_SERVICE_ACCOUNT_TOKEN,paramsFolderSecretDetectionEnabled: serverEnvs.PARAMS_FOLDER_SECRET_DETECTION_ENABLED,isOfflineUsageReportsEnabled: hasOfflineLicense,- isCrossProjectSecretSharingEnabled: canUseCrossProjectSecretSharing(orgId)+ isCrossProjectSecretSharingEnabled: canUseCrossProjectSecretSharing(orgId),+ latestAvailableVersion}};}diff --git a/backend/src/services/update-check/update-check-fns.test.ts b/backend/src/services/update-check/update-check-fns.test.tsnew file mode 100644index 0000000000..8706ce74c6--- /dev/null+++ b/backend/src/services/update-check/update-check-fns.test.ts@@ -0,0 +1,58 @@+import { isVersionNewer, parseSemanticVersion, TSemanticVersion } from "./update-check-fns";++const version = (value: string): TSemanticVersion => {+ const parsed = parseSemanticVersion(value);+ if (!parsed) throw new Error(`Invalid test version: ${value}`);+ return parsed;+};++describe("parseSemanticVersion", () => {+ test("parses plain semantic versions", () => {+ expect(parseSemanticVersion("0.162.10")).toEqual({ major: 0, minor: 162, patch: 10 });+ });++ test("parses versions with a leading v", () => {+ expect(parseSemanticVersion("v0.162.10")).toEqual({ major: 0, minor: 162, patch: 10 });+ expect(parseSemanticVersion("V0.162.10")).toEqual({ major: 0, minor: 162, patch: 10 });+ });++ test("parses nightly/prerelease versions to their base version", () => {+ expect(parseSemanticVersion("0.163.0-nightly-20260721")).toEqual({ major: 0, minor: 163, patch: 0 });+ expect(parseSemanticVersion("v0.163.0-nightly-20260721.1")).toEqual({ major: 0, minor: 163, patch: 0 });+ });++ test("returns null for values that are not semver-shaped", () => {+ expect(parseSemanticVersion(undefined)).toBeNull();+ expect(parseSemanticVersion("")).toBeNull();+ // dedicated instances use commit hash versions+ expect(parseSemanticVersion("a1b2c3d")).toBeNull();+ expect(parseSemanticVersion("0.162")).toBeNull();+ expect(parseSemanticVersion("0.162.10.1")).toBeNull();+ expect(parseSemanticVersion("latest")).toBeNull();+ });+});++describe("isVersionNewer", () => {+ test("returns false for equal versions", () => {+ expect(isVersionNewer(version("0.162.10"), version("0.162.10"))).toBe(false);+ });++ test("compares patch versions", () => {+ expect(isVersionNewer(version("0.162.11"), version("0.162.10"))).toBe(true);+ expect(isVersionNewer(version("0.162.9"), version("0.162.10"))).toBe(false);+ });++ test("a minor bump outranks a higher patch", () => {+ expect(isVersionNewer(version("0.163.0"), version("0.162.10"))).toBe(true);+ expect(isVersionNewer(version("0.162.10"), version("0.163.0"))).toBe(false);+ });++ test("a major bump outranks a higher minor", () => {+ expect(isVersionNewer(version("1.0.0"), version("0.999.999"))).toBe(true);+ });++ test("compares numerically, not lexicographically", () => {+ expect(isVersionNewer(version("0.10.0"), version("0.9.0"))).toBe(true);+ expect(isVersionNewer(version("0.100.0"), version("0.99.0"))).toBe(true);+ });+});diff --git a/backend/src/services/update-check/update-check-fns.ts b/backend/src/services/update-check/update-check-fns.tsnew file mode 100644index 0000000000..4aa4da7edb--- /dev/null+++ b/backend/src/services/update-check/update-check-fns.ts@@ -0,0 +1,19 @@+// Parses release tags / platform versions like "v0.162.10", "0.162.10" or+// "0.162.10-nightly-20260721" (the base version is used). Returns null for anything+// that is not semver-shaped (dev mode, dedicated instance hash versions, etc.)+export const parseSemanticVersion = (version?: string) => {+ if (!version) return null;++ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/i.exec(version.trim());+ if (!match) return null;++ return { major: Number(match[1]), minor: Number(match[2]), patch: Number(match[3]) };+};++export type TSemanticVersion = NonNullable<ReturnType<typeof parseSemanticVersion>>;++export const isVersionNewer = (candidate: TSemanticVersion, current: TSemanticVersion) => {+ if (candidate.major !== current.major) return candidate.major > current.major;+ if (candidate.minor !== current.minor) return candidate.minor > current.minor;+ return candidate.patch > current.patch;+};diff --git a/backend/src/services/update-check/update-check-queue.ts b/backend/src/services/update-check/update-check-queue.tsnew file mode 100644index 0000000000..1791af34da--- /dev/null+++ b/backend/src/services/update-check/update-check-queue.ts@@ -0,0 +1,97 @@+import { getLicenseKeyConfig } from "@app/ee/services/license/license-fns";+import { LicenseType } from "@app/ee/services/license/license-types";+import { KeyStorePrefixes, KeyStoreTtls, TKeyStoreFactory } from "@app/keystore/keystore";+import { getConfig } from "@app/lib/config/env";+import { request } from "@app/lib/config/request";+import { CronJobName, TCronJobFactory } from "@app/lib/cron/cron-job";+import { logger } from "@app/lib/logger";++import { isVersionNewer, parseSemanticVersion } from "./update-check-fns";++const GITHUB_LATEST_RELEASE_URL = "https://api.github.com/repos/Infisical/infisical/releases/latest";++type TUpdateCheckServiceFactoryDep = {+ cronJob: TCronJobFactory;+ keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry">;+};++export type TUpdateCheckServiceFactory = ReturnType<typeof updateCheckServiceFactory>;++export const updateCheckServiceFactory = ({ cronJob, keyStore }: TUpdateCheckServiceFactoryDep) => {+ const appCfg = getConfig();++ const licenseKeyConfig = getLicenseKeyConfig();+ const hasOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Offline;++ // The update check only applies to standard self-hosted instances: cloud deploys+ // continuously, dedicated instances use hash versions that cannot be compared, and+ // an offline license explicitly signals an intentionally air-gapped instance.+ const isEnabled =+ !appCfg.INFISICAL_CLOUD &&+ !appCfg.isCloud &&+ !appCfg.DISABLE_UPDATE_CHECK &&+ !hasOfflineLicense &&+ Boolean(parseSemanticVersion(appCfg.INFISICAL_PLATFORM_VERSION));++ const refreshLatestVersion = async () => {+ try {+ const { data } = await request.get<{ tag_name?: unknown }>(GITHUB_LATEST_RELEASE_URL, {+ headers: { Accept: "application/vnd.github+json" },+ timeout: 10_000+ });++ const tagName = data.tag_name;+ const latestVersion = typeof tagName === "string" ? tagName.replace(/^v/i, "") : null;+ if (!latestVersion || !parseSemanticVersion(latestVersion)) {+ logger.warn(`update-check: could not interpret latest release tag [tagName=${String(tagName)}]`);+ return;+ }++ await keyStore.setItemWithExpiry(+ KeyStorePrefixes.UpdateCheckLatestVersion,+ KeyStoreTtls.UpdateCheckLatestVersionInSeconds,+ latestVersion+ );+ logger.info(`update-check: refreshed latest platform version [latestVersion=${latestVersion}]`);+ } catch (err) {+ // best effort: air-gapped instances cannot reach GitHub, and a missed refresh+ // only delays the nudge until the next weekly fire, so failures stay quiet+ // instead of surfacing as failed cron runs+ logger.debug(err, "update-check: failed to refresh latest platform version");+ }+ };++ const init = () => {+ if (!isEnabled) return;++ cronJob.register({+ name: CronJobName.InstanceUpdateCheck,+ pattern: "0 0 * * 0", // weekly on Sunday at midnight UTC+ runHashTtlS: 3 * 24 * 60 * 60,+ handler: refreshLatestVersion+ });++ // also refresh once at boot so a fresh instance is not blind until the next Sunday fire+ void keyStore+ .getItem(KeyStorePrefixes.UpdateCheckLatestVersion)+ .then((cached) => (cached ? undefined : refreshLatestVersion()))+ .catch((err) => logger.debug(err, "update-check: failed to refresh latest platform version at boot"));+ };++ // Returns the latest release version when it is newer than the running instance,+ // null otherwise (up to date, check disabled, or no data fetched yet).+ const getAvailableUpdateVersion = async () => {+ if (!isEnabled) return null;++ const latestVersion = await keyStore.getItem(KeyStorePrefixes.UpdateCheckLatestVersion);+ if (!latestVersion) return null;++ const latest = parseSemanticVersion(latestVersion);+ const current = parseSemanticVersion(appCfg.INFISICAL_PLATFORM_VERSION);+ if (!latest || !current) return null;++ return isVersionNewer(latest, current) ? latestVersion : null;+ };++ return { init, getAvailableUpdateVersion };+};diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdxindex d64773462a..adfd0c011c 100644--- a/docs/self-hosting/configuration/envars.mdx+++ b/docs/self-hosting/configuration/envars.mdx@@ -54,6 +54,17 @@ Example values:this to `false`.</ParamField>+<ParamField query="DISABLE_UPDATE_CHECK" type="bool" default="false" optional>+ Self-hosted instances check GitHub for the latest Infisical release once a week+ (and once at startup) and show a subtle indicator in the UI when a newer version+ is available. Set this to `true` to disable the check; no request is made to+ GitHub when disabled.++ Air-gapped deployments should set this to `true` to suppress the outbound+ request entirely. Instances configured with an offline license disable the+ check automatically.+</ParamField>+<ParamFieldquery="ALLOW_INTERNAL_IP_CONNECTIONS"type="bool"diff --git a/frontend/src/hooks/api/admin/types.ts b/frontend/src/hooks/api/admin/types.tsindex d9c3977fdb..e182b99e1a 100644--- a/frontend/src/hooks/api/admin/types.ts+++ b/frontend/src/hooks/api/admin/types.ts@@ -67,6 +67,8 @@ export type TServerConfig = {isPublicSecretSharingDisabled?: boolean;licenseServerV2Enabled?: boolean;isCrossProjectSecretSharingEnabled?: boolean;+ // populated on self-hosted instances when a newer release than the running version exists+ latestAvailableVersion?: string | null;// Super admin-only fields (omitted for non-super-admin callers)instanceId?: string;createdAt?: string;diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsxindex 489a516106..d21f0cc0d0 100644--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx@@ -66,6 +66,7 @@ import {OrgPermissionActions,OrgPermissionSubjects,useOrganization,+ useServerConfig,useSubscription,useUser} from "@app/context";@@ -142,6 +143,7 @@ export const Navbar = () => {const { user } = useUser();const { subscription } = useSubscription();const { currentOrg, isSubOrganization } = useOrganization();+ const { config: serverConfig } = useServerConfig();const [showAdminsModal, setShowAdminsModal] = useState(false);const [showSubOrgForm, setShowSubOrgForm] = useState(false);@@ -595,6 +597,7 @@ export const Navbar = () => {)}</div>+ <VersionBadge />{subscription &&subscription.slug === SubscriptionPlanTypes.Starter &&!subscription.has_used_trial ? (@@ -624,7 +627,6 @@ export const Navbar = () => {{getSubscriptionPlanLabel(subscription)}</Badge>)}- <VersionBadge />{!location.pathname.startsWith("/admin") && user.superAdmin && (<Button variant="outline" size="xs" className="mt-px mr-2" asChild><Link to="/admin" onClick={handleNavigateToAdminConsole}>@@ -699,6 +701,16 @@ export const Navbar = () => {<div className="flex items-center gap-2 px-3 py-1.5 text-xs text-muted"><Info className="size-3.5" />Version: {envConfig.PLATFORM_VERSION}+ {serverConfig.latestAvailableVersion && (+ <a+ href="https://github.com/Infisical/infisical/releases"+ target="_blank"+ rel="noopener noreferrer"+ className="text-info hover:underline"+ >+ (v{serverConfig.latestAvailableVersion} available)+ </a>+ )}</div></>)}diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/VersionBadge.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/VersionBadge.tsxindex fd5f989515..f0b3e9e485 100644--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/VersionBadge.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/VersionBadge.tsx@@ -1,8 +1,10 @@-import { Badge } from "@app/components/v3";+import { Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";import { envConfig } from "@app/config/env";+import { useServerConfig } from "@app/context";import { isInfisicalCloud } from "@app/helpers/platform";export const VersionBadge = () => {+ const { config } = useServerConfig();const version = envConfig.PLATFORM_VERSION;// We only display the version for on-premise instances, so we disable this@@ -16,9 +18,29 @@ export const VersionBadge = () => {if (shouldNotDisplay) return null;+ // only populated on self-hosted instances that are behind the latest release+ const newerVersion = config.latestAvailableVersion;++ if (!newerVersion) {+ return null;+ }+return (- <Badge variant="neutral" className="mt-[3px] mr-2 hidden md:inline-flex">- {`v${version}`}- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <a+ href="https://github.com/Infisical/infisical/releases"+ target="_blank"+ rel="noopener noreferrer"+ className="mt-1 mr-2 hidden items-center gap-x-1.5 text-xs text-muted transition-colors hover:text-accent md:inline-flex"+ >+ <span aria-hidden className="size-1.5 rounded-full bg-info" />+ New version available+ </a>+ </TooltipTrigger>+ <TooltipContent>+ v{version} → v{newerVersion}+ </TooltipContent>+ </Tooltip>);};