Skip to content

[BUG] Missing Validation for JSON Payload Contents #1490

Description

@sahare77

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 on allowed_targets being 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_targets is actually a list of valid URLs/hostnames, and that metadata, extra_headers, and login_recipe conform to their respective expected schemas.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:backendBackend API, database, or service worklevel:intermediate35 pts difficulty label for moderate contributor PRspriority:mediumImportant issue with normal urgencytype:bugBug fix work category bonus label

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions