security: harden API input validation and error messages#22
Merged
Conversation
Deploying cherry-evals with
|
| Latest commit: |
3b535fe
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f101f97e.cherry-evals.pages.dev |
| Branch Preview URL: | https://fix-api-hardening.cherry-evals.pages.dev |
marinone94
force-pushed
the
fix/api-hardening
branch
from
March 11, 2026 05:44
c3e91d1 to
9851ec1
Compare
marinone94
added a commit
that referenced
this pull request
Mar 11, 2026
- Pydantic: sort_by as Literal type, collection name pattern-validated - Agent inputs: max_length on description/format, pattern on hf_dataset_id - Error sanitization: remove internal details from HTTP responses (search, export, MCP server) - Analytics: scoped by user_id, anonymous callers don't see raw queries - Events: session_id validated against alphanumeric regex - Export: filename sanitized with regex to prevent path traversal - MCP server: sanitized error messages in semantic/hybrid search - Tests updated for new validation behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
marinone94
force-pushed
the
fix/api-hardening
branch
from
March 11, 2026 05:50
9851ec1 to
3b535fe
Compare
marinone94
added a commit
that referenced
this pull request
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sort_byasLiteral["relevance", "newest", "dataset"], collection name pattern^[a-z0-9_]{1,64}$, agent inputmax_lengthandpatternconstraintsget_event_stats()scoped byuser_id; anonymous callers get aggregate counts only (no raw query strings)^[0-9a-zA-Z\-_]{1,100}$prevents arbitrary string storageTest plan
test_search_sort_invalid_rejected— invalid sort_by returns 422test_langfuse_without_credentials_returns_502— sanitized error messagetest_get_event_stats_with_events— uses user_id scopingtest_get_event_stats_anonymous_hides_queries— privacy test🤖 Generated with Claude Code