Skip to content

[ISSUE]: Default Content-Type Mismatch in security_parsers.py #394

Closed

Description

@Aditya8369

Description

Description:
In validate_content_type() function in backend/security_parsers.py, the docstring states that allowed_types defaults to ['application/json', 'application/x-www-form-urlencoded'], but the actual code only sets the default to ['application/json']:

# Docstring says (line 28-29):
# If None, defaults to ['application/json', 'application/x-www-form-urlencoded']

# But actual code (line 38-39):
if allowed_types is None:
    allowed_types = ['application/json']

This inconsistency can cause confusion and potential security issues when form data is submitted.

Steps to fix:

  1. Open backend/security_parsers.py
  2. Find the validate_content_type() function
  3. Change line 38-39 from:
    if allowed_types is None:
        allowed_types = ['application/json']
    To:
    if allowed_types is None:
        allowed_types = ['application/json', 'application/x-www-form-urlencoded']

Additional Context

No response

Activity

  1. Aditya8369 commented on May 1, 2026

    @Aditya8369
    ContributorAuthor

    @devanshi14malhotra please assign me

  2. added
    NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source event
    on May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source eventlevel13 points

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions