Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(Pydantic): honor hide_input_in_errors in throwing validation exceptions #3843

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

charles-dyfis-net
Copy link
Contributor

Description

Pydantic's BaseModel supports configuration to hide data values when throwing exceptions, via setting hide_input_in_errors -- see https://docs.pydantic.dev/2.0/api/config/#pydantic.config.ConfigDict.hide_input_in_errors and https://docs.pydantic.dev/latest/usage/model_config/#hide-input-in-errors (the value is also in 2.0, but not linkable in the non-latest version of the documentation build).

At present, Litestar does not honor this configuration when generating exceptions for validation errors, which can lead to sensitive data leaking into logs.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.42%. Comparing base (017464f) to head (db892ce).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3843   +/-   ##
=======================================
  Coverage   98.42%   98.42%           
=======================================
  Files         333      333           
  Lines       15346    15348    +2     
  Branches     1694     1694           
=======================================
+ Hits        15105    15107    +2     
  Misses        111      111           
  Partials      130      130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charles-dyfis-net charles-dyfis-net force-pushed the honor-pydantic-hide-input branch 2 times, most recently from 4b6e70a to 17c0944 Compare October 29, 2024 21:03
Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3843

Copy link
Member

@cofin cofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cofin cofin removed the Triage Required 🏥 This requires triage label Oct 29, 2024
@cofin
Copy link
Member

cofin commented Oct 29, 2024

@all-contributors add @charles-dyfis-net for code

Copy link
Contributor

@cofin

I've put up a pull request to add @charles-dyfis-net! 🎉

@cofin cofin merged commit dcae3b3 into litestar-org:main Oct 29, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants