Skip to content
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

handle GET reqs with invalid query params as 400 #839

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adysenrothman
Copy link
Contributor

Description

Currently, when an user inputs a request with a query param that has an invalid syntax issue, it gets processed as a 500 internal service error. We should be processing these as a 400 bad request instead.

Link to original Jira with more details: https://issues.redhat.com/browse/RHOAIENG-19195

How Has This Been Tested?

This has been locally tested by creating new registered models and model artifacts, and then sending GET requests with bad query params for name and externalId in order to trigger the "Illegal syntax" error. For example:
GET /api/model_registry/v1alpha3/registered_model?%C3%B5%F1%A5%BC%A2x%1D%1C&externalId=1l%26%F3%AF%81%9Fd%F0%96%B0%AD%5C-%10%C3%AD%09%C3%BD%F3%BF%B9%B0%C2%98%C3%8B%C3%A7%F0%BF%BD%A4%3D%C2%BB%C2%B0%C3%AF

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • [x ] The commits have meaningful messages; the author will squash them after approval or in case of manual merges will ask to merge with squash.
  • [x ] Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • [x ] The developer has manually tested the changes and verified that the changes work.
  • [ x] Code changes follow the kubeflow contribution guidelines.
Screenshot 2025-02-27 at 8 56 09 AM

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign andreyvelich for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rareddy
Copy link
Contributor

rareddy commented Feb 28, 2025

any unit test case?

Signed-off-by: Adysen Rothman <[email protected]>
@google-oss-prow google-oss-prow bot added size/L and removed size/S labels Feb 28, 2025
@adysenrothman
Copy link
Contributor Author

adysenrothman commented Feb 28, 2025

any unit test case?

yes, just added several tests to catch these 400 errors @rareddy

@rareddy
Copy link
Contributor

rareddy commented Feb 28, 2025

/lgtm

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

Successfully merging this pull request may close these issues.

2 participants