Page MenuHomePhabricator

ipoid API should return a 400 instead of a 500 for malformed IPs
Closed, ResolvedPublic

Description

From https://gitlab.wikimedia.org/repos/mediawiki/services/ipoid/-/merge_requests/213#note_68634

500 always indicates an error that the server doesn't know how to handle. If it does know how to handle, like apparently in this case, where the mistake is on the client side since they provide a badly formatted input that is none of the acceptable formats, you want a 400.

Acceptance criteria:

  • request data for an invalid IP should return a 400 error, not a 500 error

Event Timeline

dom_walden subscribed.

If the IP in the request to /feed/v1/ip/<ip> is invalid, it returns a 400 with response body "<ip> is not an IP address".

Previously, it returned a 500 with response body Unable to process request.

ipoid commit: 3fc04e78cb82ac031188446aed0aa1210d1200f0.

Thanks for the QA. Leaving open until we deploy the change.

@kostajh has this change been deployed yet?

Not as far as I know.

Deployment patches should reference the task related to the patch they're deploying (https://wikitech.wikimedia.org/wiki/Service/IPoid#Prepare_the_deployment_patch), so we should see a patch linked here when someone gets around to deploying.

Change 1010524 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[operations/deployment-charts@master] ipoid: Bump version

https://gerrit.wikimedia.org/r/1010524

Change 1010524 merged by jenkins-bot:

[operations/deployment-charts@master] ipoid: Bump version

https://gerrit.wikimedia.org/r/1010524