-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Security Solution] Replaced the incorrect runtime type used for ruleSource #184004
Conversation
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xcrzx! Changes LGTM.
@@ -84,7 +84,6 @@ import { | |||
TimestampOverrideFallbackDisabled, | |||
} from '../../../../../common/api/detection_engine/model/rule_schema'; | |||
import type { SERVER_APP_ID } from '../../../../../common/constants'; | |||
import { convertObjectKeysToCamelCase } from '../../../../utils/object_case_converters'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also do something with this utility? For example:
- Add a comment to
convertObjectKeysToCamelCase
that it doesn't work as it was originally intended. Explain how it works. - Create a ticket for reworking it or reopen [Security Solution] Implement a Zod transformation from snake_case to camelCase and vice versa #180121. Add a comment to
convertObjectKeysToCamelCase
with a link to the ticket. - Delete the utility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function works as expected. It accepts any object and converts its keys to camel case. It has nothing to do with Zod and can be used (and is used) in other places, so I believe we can leave it as is.
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @xcrzx |
Needed for: #180141 and #180128
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 versionisCustomized
.However, this meant that the expected input type for the schema was snake-cased, as the transformation happened only after validation.
Valid payload before:
To overcome this issue, the rule source schema was implemented without using the transformation (revert #180121).
Valid payload after:
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.