Repository navigation
SECFOO-22: Fix 422 error when "All projects" is selected on findings lists - #37
Merged
Merged
Conversation
…ists The SAST findings, SCA vulnerabilities and secret findings lists have an "All projects" option whose value is empty, so the form submits project_id=. The route declared project_id as `int | None`, which FastAPI rejects for an empty string with a 422 -- so picking "All projects", or pressing Search on the SAST list with it selected (the default), showed a raw JSON error instead of the list. The existing tests passed only because they built URLs by hand without the empty param. project_id is now taken as a string and parsed leniently: empty or non-numeric means "all projects". Regression test on each page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What does this change, and why?
Found during SECFOO-22 (Dashboard usability). Independent of the other SECFOO-22 PRs, with no conflicts with #34.
The SAST findings, SCA vulnerabilities and secret findings lists have an "All projects" option whose value is empty, so the form submits
project_id=. The routes declaredproject_id: int | None, and FastAPI rejects an empty string for that with a 422. So picking "All projects", or pressing Search on the SAST list while it's selected (the default), showed a raw JSON error instead of the list. In practice the SAST search box didn't work from the page.Confirmed on current
main:The existing tests passed only because they built URLs by hand without the empty param.
Fix:
project_idis taken as a string and parsed leniently (empty or non-numeric means all projects), via a small_project_id()helper inroutes/activities.py.Testing
pytest tests: 815 passed; 3 new regression tests (one per page) fail onmain🤖 Generated with Claude Code