Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Replaced the incorrect runtime type used for rule…
…Source (#184004) ## Summary This PR replaces the incorrect Zod schema for the `ruleSource` rule param. Previously, the rule source field schema was implemented using a Zod transformation that automatically converted the snake-cased `is_customized` attribute to its camel-cased version `isCustomized`. ```ts const RuleSourceCamelCased = RuleSource.transform(convertObjectKeysToCamelCase); const RuleSource = z.object({ type: z.literal('external'), is_customized: IsExternalRuleCustomized, }); ``` However, this meant that the expected input type for the schema was snake-cased, as the transformation happened only after validation. **Valid payload before:** ```json5 { "ruleSource": { "type": "external", "is_customized": false // <- it should be camel cased } } ``` To overcome this issue, the rule source schema was implemented without using the transformation (revert #180121). **Valid payload after:** ```json5 { "ruleSource": { "type": "external", "isCustomized": false } } ``` ### Important Note This rule param schema change is considered safe because we do not currently use this field in the code. All values of this field are currently `undefined`. However, to ensure a Serverless release rollout without breaking changes, we need to release this schema change before we start writing any actual data.
- Loading branch information