Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raz-alon
Copy link

@raz-alon raz-alon commented Apr 17, 2025

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.

Copy link

vercel bot commented Apr 17, 2025

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

@CLAassistant
Copy link

CLAassistant commented Apr 22, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]:Anthropic API throws Bad Request when user_id in metadata is an email address
2 participants