Skip to content

SECFOO-22: Fix 422 error when "All projects" is selected on findings lists - #37

Merged
vsn411 merged 1 commit into
secfoo-com:mainfrom
AmirNCI:fix/secfoo-22-all-projects-422
Nov 1, 2026
Merged

vsn411 merged 1 commit into
secfoo-com:mainfrom
AmirNCI:fix/secfoo-22-all-projects-422

Conversation

@AmirNCI

@AmirNCI AmirNCI commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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 declared project_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:

/activities/sast/findings?status=open&project_id=&q=sql      -> 422
/activities/sca-reachability/vulnerabilities?project_id=     -> 422
/activities/secret-scanning/findings?project_id=             -> 422

The existing tests passed only because they built URLs by hand without the empty param.

Fix: project_id is taken as a string and parsed leniently (empty or non-numeric means all projects), via a small _project_id() helper in routes/activities.py.

Testing

🤖 Generated with Claude Code

…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]>
@vsn411
vsn411 merged commit a1d8bba into secfoo-com:main Nov 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants