-
Notifications
You must be signed in to change notification settings - Fork 239
[BUG] Missing Validation for JSON Payload Contents #1490
Copy link
Copy link
Closed
Labels
area:backendBackend API, database, or service workBackend API, database, or service worklevel:intermediate35 pts difficulty label for moderate contributor PRs35 pts difficulty label for moderate contributor PRspriority:mediumImportant issue with normal urgencyImportant issue with normal urgencytype:bugBug fix work category bonus labelBug fix work category bonus label
Description
Activity
Metadata
Metadata
Assignees
Labels
area:backendBackend API, database, or service workBackend API, database, or service worklevel:intermediate35 pts difficulty label for moderate contributor PRs35 pts difficulty label for moderate contributor PRspriority:mediumImportant issue with normal urgencyImportant issue with normal urgencytype:bugBug fix work category bonus labelBug fix work category bonus label
Missing Validation for JSON Payload Contents
Description:
In
backend/secuscan/routes.py, complex JSON fields are serialized into the database without verifying their schema or contents. For instance,_json_payload(payload.get("allowed_targets"), "[]")is used to store target lists.Impact:
If an attacker provides an invalid structure (e.g., passing a string or object instead of a list of strings for
allowed_targets), it will be blindly stored. Downstream components that rely onallowed_targetsbeing a list might crash or behave unpredictably when they attempt to parse and use the invalid data.Recommendation:
Validate complex nested fields inside the API handlers (or better, using Pydantic models) before serializing and saving them to the database. Ensure that
allowed_targetsis actually a list of valid URLs/hostnames, and thatmetadata,extra_headers, andlogin_recipeconform to their respective expected schemas.