litellm icon indicating copy to clipboard operation
litellm copied to clipboard

Add User ID validation to ensure it is not an email or phone number

Open raz-alon opened this issue 8 months ago • 2 comments

Title

Add validation to exclude invalid user_id (e.g. email or phone number) from Anthropic metadata

Relevant issues

Fixes #10106

Type

🐛 Bug Fix

Changes

This PR introduces a validation check for the user_id field in the _litellm_metadata dictionary to ensure it does not contain personally identifiable information (PII) such as emails or phone numbers.

Rationale

Anthropic requires that the user_id in metadata must be a UUID, hash value, or other opaque, non-identifying identifier. It must not contain any personally identifiable information such as names, email addresses, or phone numbers. Including such data can lead to the API rejecting the request with a 400 Bad Request error. View

This update ensures that if an invalid user_id is provided (e.g. an email), it will simply be excluded from the metadata, preventing avoidable request failures.

raz-alon avatar Apr 17 '25 13:04 raz-alon

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2025 1:06pm

vercel[bot] avatar Apr 17 '25 13:04 vercel[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 22 '25 21:04 CLAassistant

@krrishdholakia its blocking us, did you have a chance to take a look?

raz-alon avatar May 05 '25 07:05 raz-alon

Hey @krrishdholakia this is also blocking us. Is there any progress here?

omerc7 avatar May 07 '25 07:05 omerc7

Running into the same issue. Didn't realize there is already a fix out since a couple of months...

fkrauthan avatar Jun 05 '25 01:06 fkrauthan

Sorry for the delay, missed this PR - merged!

krrishdholakia avatar Jun 05 '25 01:06 krrishdholakia