Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Validate request body #3632

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Validate request body #3632

wants to merge 2 commits into from

Conversation

niwsa
Copy link
Member

@niwsa niwsa commented Feb 20, 2025

What does this PR do?

Throughout the application, when a body is accepted through a POST request, the request body is cast to the correct type, with the parameters usually being strings. But, Typescript does not perform any checks at runtime, allowing more complex types (arrays and objects) to be passed in. This can potentially lead to unexpected behavior. For example, some functions allow passing either a string or an object with options as the first argument.

Add validation to request body to fix above issue.

Type of change

  • Updated dependencies
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Existing unit tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code and corrected any misspellings
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant