Skip to content

fix(api): reject unknown JSON fields in request bodies#405

Open
Minin1991 wants to merge 1 commit into
haproxytech:masterfrom
Minin1991:master
Open

fix(api): reject unknown JSON fields in request bodies#405
Minin1991 wants to merge 1 commit into
haproxytech:masterfrom
Minin1991:master

Conversation

@Minin1991
Copy link
Copy Markdown

Previously, JSON request bodies containing unknown fields could be accepted by the Data Plane API and silently decoded into client-native models with unsupported fields dropped.

This made it possible for users or automation pipelines to believe that a submitted configuration parameter was applied, while the field was actually ignored during decoding.

Add a strict pre-decode validation step in the JSON consumer. The request body is first decoded into a generic JSON structure and checked against the target Go model using reflection. If an unknown field is found, the API now returns a parsing error instead of silently dropping the field.

The check supports nested structs, embedded model structs, maps such as backend servers, and arrays. Plain text raw configuration endpoints are excluded from this validation.

This helps GitOps/CI pipelines fail early when a request contains misspelled or unsupported configuration parameters.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant