What doesn't work?
GET /item/steal returns 500 Internal Server Error when the request does not include steal_token or the request body is missing/undefined.
The likely bug is in StealTokenGuard:
const stealToken = request.query.steal_token ?? request.body.steal_token;
For a GET request, request.body may be undefined. In that case, accessing request.body.steal_token throws a TypeError before the guard can return the intended authorization error.
Expected result: the endpoint should return 403 Forbidden with the existing steal_token is not provided API error.
Actual result: in some environments, the endpoint returns 500 Internal Server Error.
What is the endpoint and method? (if applicable)
Endpoint: /item/steal
Method: GET
How can it be reproduced?
- Send a
GET request to /item/steal.
- Do not include
steal_token in the query string.
- Make sure the request has no body.
- Observe that the server may return
500 Internal Server Error.
Likely fix area: src/clanInventory/item/guards/StealToken.guard.ts, where request.body should be accessed safely.
What doesn't work?
GET /item/stealreturns500 Internal Server Errorwhen the request does not includesteal_tokenor the request body is missing/undefined.The likely bug is in
StealTokenGuard:For a GET request,
request.bodymay beundefined. In that case, accessingrequest.body.steal_tokenthrows aTypeErrorbefore the guard can return the intended authorization error.Expected result: the endpoint should return
403 Forbiddenwith the existingsteal_token is not providedAPI error.Actual result: in some environments, the endpoint returns
500 Internal Server Error.What is the endpoint and method? (if applicable)
Endpoint:
/item/stealMethod:
GETHow can it be reproduced?
GETrequest to/item/steal.steal_tokenin the query string.500 Internal Server Error.Likely fix area:
src/clanInventory/item/guards/StealToken.guard.ts, whererequest.bodyshould be accessed safely.