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
Disallowing unknown fields doesn't work when decoding into an object in the JSON serializer #104661
Comments
@luxas: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/sig api-machinery |
/assign |
cc @liggitt |
Thank you @luxas for taking this one! |
Cool, I'll send a PR is a couple of days 😄 |
Argh, didn't get to it this week, and I'm on vacation next week, but I'll get to it after that. |
Hey @luxasm, I would like to contribute to Kubernetes. Let me know if I can take this up. |
Absolutely, thanks for volunteering! 🥇 Let's chat on the Kubernetes Slack (join at https://slack.k8s.io/ if you're not already there) and if needed, hop on a short video call to get you going with this task? I'm @luxas on the Kubernetes Slack as well, please send me a message when you're there. |
fixes: kubernetes#104661 - add `Strict` mode check for `into` parameter of the Decode function in json.Serializer Signed-off-by: Aaqa Ishtyaq <aaqaishtyaq@gmail.com>
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
resolved by #105916 |
What happened:
Although the
Strict
mode (i.e. what should disallow unknown and duplicate fields) is enabled in thejson.Serializer
; unknown fields in serialized data doesn't yield any error when specifying theinto
parameter of theDecode(
function.What you expected to happen:
Disallowing unknown fields should yield errors when there are fields in serialized data that do not map to a struct field, regardless of decoding type (into or non-into)
How to reproduce it (as minimally and precisely as possible):
In this codepath there is no strict checking like here. The "sanitation" method linked in the latter case should be run for both the into and non-into cases, and an unit test should be added.
Anything else we need to know?:
I can send a PR for this :)
/sig apimachinery
cc @dims @sttts FYI
The text was updated successfully, but these errors were encountered: