Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(scim): ignore password attribute in user provisioning (#15997)

Steffen Schmitzb27fdec2292b
diff --git a/fern/apis/server/definition/scim.yml b/fern/apis/server/definition/scim.yml
index 219e6fb88a..14583eed8b 100644
--- a/fern/apis/server/definition/scim.yml
+++ b/fern/apis/server/definition/scim.yml
@@ -63,8 +63,17 @@ service:
docs: Whether the user is active
type: optional<boolean>
password:
- docs: Initial password for the user
+ docs: >-
+ Ignored. Accepted only for compatibility with identity
+ providers that always send a password on user creation (Okta
+ sends a placeholder value even when password sync is disabled).
+ No credential is created for the user; provisioned users
+ authenticate via SSO or set a password themselves through the
+ password reset flow.
type: optional<string>
+ availability:
+ status: deprecated
+ message: "This attribute is ignored. SCIM provisioning never sets a password; provisioned users authenticate via SSO or the password reset flow."
response: ScimUser
getUser:
diff --git a/web/src/__tests__/server/scim-api.servertest.ts b/web/src/__tests__/server/scim-api.servertest.ts
index 539aa81fcc..2fbc607897 100644
--- a/web/src/__tests__/server/scim-api.servertest.ts
+++ b/web/src/__tests__/server/scim-api.servertest.ts
@@ -9,7 +9,6 @@ import {
} from "@langfuse/shared/src/server";
import { prisma } from "@langfuse/shared/src/db";
import { randomUUID } from "crypto";
-import { verifyPassword } from "@/src/features/auth-credentials/lib/credentialsServerUtils";
// Schema for SCIM User response
const ScimUserSchema = z.object({
@@ -224,9 +223,17 @@ describe("SCIM API", () => {
"urn:ietf:params:scim:api:messages:2.0:ListResponse",
);
expect(response.body.Resources.length).toBeGreaterThan(0);
+ // RFC 7644 3.4.2: `totalResults` must match what was actually returned.
+ expect(response.body.totalResults).toBe(response.body.Resources.length);
expect(response.body.Resources[0].id).toContain(
"urn:ietf:params:scim:schemas:core:2.0:User",
);
+ // `password` must not be advertised: schema discovery is how a SCIM
+ // client learns the attribute is unsupported.
+ const attributeNames = response.body.Resources[0].attributes.map(
+ (attribute) => (attribute as { name: string }).name,
+ );
+ expect(attributeNames).not.toContain("password");
});
it("should return 401 when invalid API keys are provided", async () => {
@@ -473,7 +480,7 @@ describe("SCIM API", () => {
expect(user?.name).toBe("Test User");
});
- it("should create a new user with password", async () => {
+ it("accepts a password attribute but never sets a credential", async () => {
const uniqueEmail = `test.user.${randomUUID().substring(0, 8)}@example.com`;
const password = `password-${randomUUID().substring(0, 8)}`;
const response = await makeZodVerifiedAPICall(
@@ -517,9 +524,11 @@ describe("SCIM API", () => {
expect(user).not.toBeNull();
expect(user?.email).toBe(uniqueEmail);
expect(user?.name).toBe("Test User With Password");
- // Verify password was created
- expect(user?.password).not.toBeNull();
- expect(await verifyPassword(password, user?.password ?? "")).toBe(true);
+ // The password attribute is ignored, so the account has no usable
+ // credential and cannot be signed into with the supplied value. Okta
+ // sends a placeholder password on every create, so the request must
+ // still succeed rather than 4xx.
+ expect(user?.password).toBeNull();
});
it("should return 400 when userName is missing", async () => {
diff --git a/web/src/pages/api/public/scim/Schemas.ts b/web/src/pages/api/public/scim/Schemas.ts
index bda4c1f3f8..eb79f250fa 100644
--- a/web/src/pages/api/public/scim/Schemas.ts
+++ b/web/src/pages/api/public/scim/Schemas.ts
@@ -52,7 +52,10 @@ export default async function handler(
// Return the schemas
return res.status(200).json({
schemas: ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
- totalResults: 2,
+ // Only the User schema is advertised; `Resources` has one entry, and RFC
+ // 7644 3.4.2 wants `totalResults` to match what was returned. Sibling
+ // `/ResourceTypes` already gets this right.
+ totalResults: 1,
Resources: [
// User Schema
{
@@ -150,17 +153,6 @@ export default async function handler(
returned: "default",
uniqueness: "none",
},
- {
- name: "password",
- type: "string",
- multiValued: false,
- description: "The user's password",
- required: false,
- caseExact: false,
- mutability: "writeOnly",
- returned: "never",
- uniqueness: "none",
- },
{
name: "meta",
type: "complex",
diff --git a/web/src/pages/api/public/scim/ServiceProviderConfig.ts b/web/src/pages/api/public/scim/ServiceProviderConfig.ts
index 39a3a68752..fd96fe6501 100644
--- a/web/src/pages/api/public/scim/ServiceProviderConfig.ts
+++ b/web/src/pages/api/public/scim/ServiceProviderConfig.ts
@@ -52,7 +52,8 @@ export default async function handler(
// Return the service provider configuration
return res.status(200).json({
schemas: ["urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"],
- documentationUri: "https://docs.langfuse.com/scim",
+ documentationUri:
+ "https://langfuse.com/docs/administration/scim-and-org-api",
patch: {
supported: false,
},
diff --git a/web/src/pages/api/public/scim/Users/index.ts b/web/src/pages/api/public/scim/Users/index.ts
index 694f620468..32707fdde4 100644
--- a/web/src/pages/api/public/scim/Users/index.ts
+++ b/web/src/pages/api/public/scim/Users/index.ts
@@ -4,7 +4,6 @@ import { prisma } from "@langfuse/shared/src/db";
import { logger, redis } from "@langfuse/shared/src/server";
import { type NextApiRequest, type NextApiResponse } from "next";
-import { hashPassword } from "@/src/features/auth-credentials/lib/credentialsServerUtils";
import { z } from "zod";
import { type Role } from "@langfuse/shared";
import { auditLog } from "@/src/features/audit-logs/auditLog";
@@ -173,7 +172,17 @@ export default async function handler(
}
}
- const { userName, name, password, displayName, roles } = body;
+ // A `password` in the request body is accepted and ignored. Setting it
+ // created a usable login credential for an email address nobody had
+ // verified, so an org-scoped key could pre-register an account for
+ // someone else's address. Ignoring rather than rejecting is deliberate:
+ // RFC 7644 3.3 lets a service provider ignore POSTed content, the
+ // attribute is `returned: "never"` so no conformant client can observe
+ // the difference, and Okta sends a placeholder password on every create
+ // even when password sync is disabled — rejecting it would break those
+ // syncs. Users authenticate via SSO, or claim the account through the
+ // password-reset flow.
+ const { userName, name, displayName, roles } = body;
if (!userName) {
logger.warn("[SCIM] userName is required for user creation");
@@ -235,7 +244,6 @@ export default async function handler(
create: {
email: normalizedEmail,
name: name?.formatted || displayName,
- password: password ? await hashPassword(password) : undefined,
},
update: {},
});