🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(ee): refuse FIPS mode with storage options that compute MD5 (#18443)
Steffen Reuther6637994377b6
diff --git a/packages/shared/src/server/ee/fips/assertFipsMode.test.ts b/packages/shared/src/server/ee/fips/assertFipsMode.test.tsindex 0316321b2b..47a4399412 100644--- a/packages/shared/src/server/ee/fips/assertFipsMode.test.ts+++ b/packages/shared/src/server/ee/fips/assertFipsMode.test.ts@@ -67,4 +67,45 @@ describe("assertFipsMode", () => {/FIPS provider is not active/,);});++ it.each([+ [+ "the MD5 S3 delete checksum",+ { LANGFUSE_S3_DELETE_OBJECTS_CHECKSUM_ALGORITHM: "MD5" },+ /LANGFUSE_S3_DELETE_OBJECTS_CHECKSUM_ALGORITHM=MD5/,+ ],+ [+ "OCI native object storage",+ { LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE: "true" },+ /LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true/,+ ],+ ] as const)(+ "refuses to start with %s, which computes MD5",+ (_label, overrides, message) => {+ expect(() => assertFipsMode(createTestEnv(overrides))).toThrow(message);+ },+ );++ it("passes with FIPS-approved storage options", () => {+ expect(() =>+ assertFipsMode(+ createTestEnv({+ LANGFUSE_S3_DELETE_OBJECTS_CHECKSUM_ALGORITHM: "SHA256",+ LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE: "false",+ }),+ ),+ ).not.toThrow();+ });++ it("ignores MD5 storage options when FIPS mode is not requested", () => {+ expect(() =>+ assertFipsMode(+ createTestEnv({+ LANGFUSE_REQUIRE_FIPS: "false",+ LANGFUSE_S3_DELETE_OBJECTS_CHECKSUM_ALGORITHM: "MD5",+ LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE: "true",+ }),+ ),+ ).not.toThrow();+ });});diff --git a/packages/shared/src/server/ee/fips/assertFipsMode.ts b/packages/shared/src/server/ee/fips/assertFipsMode.tsindex d84057647e..46b8c5d98d 100644--- a/packages/shared/src/server/ee/fips/assertFipsMode.ts+++ b/packages/shared/src/server/ee/fips/assertFipsMode.ts@@ -31,4 +31,31 @@ export function assertFipsMode(envOverride?: SharedEnv): void {"LANGFUSE_REQUIRE_FIPS=true but Node's OpenSSL FIPS provider is not active (crypto.getFips() != 1). Run Langfuse on a host with FIPS mode enabled.",);}++ const incompatibleOptions = getFipsIncompatibleOptions(e);+ if (incompatibleOptions.length > 0) {+ throw new Error(+ `LANGFUSE_REQUIRE_FIPS=true cannot be combined with ${incompatibleOptions.join("; ")}.`,+ );+ }+}++/**+ * getFipsIncompatibleOptions lists configured options whose code paths compute+ * MD5, which the FIPS provider rejects at runtime, so startup fails instead of+ * the affected uploads or deletes.+ */+function getFipsIncompatibleOptions(e: SharedEnv): string[] {+ const options: string[] = [];+ if (e.LANGFUSE_S3_DELETE_OBJECTS_CHECKSUM_ALGORITHM === "MD5") {+ options.push(+ "LANGFUSE_S3_DELETE_OBJECTS_CHECKSUM_ALGORITHM=MD5 (use SHA256, or leave it unset for CRC32)",+ );+ }+ if (e.LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE === "true") {+ options.push(+ "LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true (the OCI SDK hashes every upload part with MD5; use OCI's S3-compatible endpoint instead)",+ );+ }+ return options;}