dis-moi / dis-moi/backend

Calling endpoints with non-numeric IDs should throw HTTP 400 BadRequest

Open
#345 0 comments 0 reactions 0 assignees View on GitHub
enhancement production
Dominant language
PHP
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

(And HTTP 400 BadRequest should be ignored by Sentry)

Sentry Issue: [BACKEND-C4](https://sentry.io/organizations/lmem/issues/2011831561/?referrer=github_integration)

```
TypeError: Argument 1 passed to App\Repository\ContributorRepository::getOne() must be of the type int, string given, called in /home/bas/app_8f549f01-474d-4e00-bf28-0670009b31eb/src/Controller/Api/GetContributorAction.php on line 30
File "/src/Repository/ContributorRepository.php", line 81, in App\Repository\ContributorRepository::getOne
public function getOne(int $id)
File "/src/Controller/Api/GetContributorAction.php", line 30, in App\Controller\Api\GetContributorAction::__invoke
$contributor = $this->repository->getOne($id);
File "/public/index.php", line 26
$response = $kernel->handle($request);
...
(1 additional frame(s) were not displayed)
```

Contributor guide

Open the contributing guide

Research direction

Start with src/Controller/Api/GetContributorAction.php and the call to src/Repository/ContributorRepository.php, then inspect public/index.php for the request flow. Reproduce an endpoint request with a non-numeric ID and trace the resulting response and Sentry report. Done means such requests return HTTP 400 BadRequest and are ignored by Sentry.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.