Repository navigation
FIX: Apply the request limits to the remaining request fields - #3174
Open
varunj-msft wants to merge 1 commit into
Open
varunj-msft wants to merge 1 commit into
varunj-msft wants to merge 1 commit into
Conversation
Conversion markers, technique creation fields, seed browsing filters, message-send ids, the scorer routes, and the save-conversation target name accepted values of any length, and the conversation_id filter for attack messages lost its limit because a Query default replaced the annotated one. They now use the shared limits and return 422.
This branch has not been deployed
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.
Description
#2960 added request limits, but some fields didn't get them: fields added since (conversion markers in #3002, technique creation in #3047, seed browsing in #2989) and fields from PRs that landed while #2960 was open (the scorer API in #2990, async message sends in #2861, conversation save in #2853). Separately, #2960 declared
conversation_idonGET /api/attacks/{attack_result_id}/messagesasIdentifierStr = Query(...), and FastAPI drops the length limit of an annotated alias on a required query parameter, so any length reached the service.These now return 422 above the existing limits:
start_tokenandend_tokenon add-message and converter preview: identifier length.POST /api/techniques:paramskeys, converter names, andadversarial_chat(identifier length), anddescription(text length). The adversarial prompts stay limited only by the body size, like other prompt content.GET /api/datasets/seedsand/seeds/{example_id}:selection_key(cursor length) andharm_categoryvalues (label value length).type,paramskeys and count,cursor, andscorer_registry_name, matching targets and converters.target_registry_nameonPOST /api/attacks/save-conversation.conversation_id: the limit is set on theQueryitself.Not included:
GET /api/media?path(bounded by the URL length limit) and thelabelfilters (checked by their validator).Tests and Documentation
test_common_models.py,test_api_routes.py,test_message_send_routes.py,test_scorer_routes.py,test_seed_example_routes.py: each added limit rejects one character or item over, and the routes return 422 before the service is called, including an over-longconversation_id.test_common_models.pyalso checks that technique fields accept values at the limit while the adversarial prompts stay unbounded.No JupyText changes.