rusackas opened a new pull request, #40672:
URL: https://github.com/apache/superset/pull/40672

   > **Draft / `hold:testing`** — wires previously-unused option schemas into 
validation. Needs a per-schema audit before strict validation (see "Why draft").
   
   ### SUMMARY
   
   `ChartDataPostProcessingOperationSchema` accepted `options` as a free-form 
`fields.Dict()`. The per-operation option schemas 
(`ChartDataAggregateOptionsSchema`, `…RollingOptionsSchema`, 
`…ProphetOptionsSchema`, `…PivotOptionsSchema`, etc.) existed **only for 
OpenAPI docs** and were never connected to the validation pipeline (FINDING-029 
/ ASVS 2.1.1, CWE-20).
   
   This adds a `@validates_schema` hook that maps each operation to its option 
schema and validates `options` against it. Validation is **lenient** 
(`unknown=EXCLUDE`): it surfaces wrong types / out-of-range values on 
**declared** fields without rejecting payloads that carry extra keys. 
Operations with no dedicated schema (e.g. `flatten`, `diff`, `compare`) are 
unaffected.
   
   ### WHY DRAFT (`hold:testing`)
   
   These option schemas were never exercised as validators and have latent 
issues — e.g. `ChartDataAggregateOptionsSchema.groupby` is accidentally defined 
as a **tuple** (`groupby = (fields.List(...),)`), so it isn't a field and isn't 
validated. Before tightening to strict (`unknown=RAISE`) validation, each 
option schema should be audited against the real `pandas_postprocessing` 
signatures so currently-valid requests aren't rejected. The lenient approach 
here is the safe first step.
   
   ### TESTING INSTRUCTIONS
   
   ```
   pytest tests/unit_tests/charts/test_schemas.py -k 
post_processing_operation_validates
   ```
   
   Test: valid prophet options load; an out-of-range `confidence_interval` is 
rejected (`options` error); extra/unknown keys are tolerated; a schema-less 
operation accepts arbitrary options.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to