[Security Solution] [Detections] Updates rules routes to validate "from" param on rules#76000
Merged
dhurley14 merged 6 commits intoelastic:masterfrom Aug 26, 2020
Merged
Conversation
dhurley14
commented
Aug 26, 2020
Comment on lines
25
to
35
Contributor
Author
There was a problem hiding this comment.
I moved this function into common because I needed to use it in the schema validations.
42922e4 to
390d7de
Compare
Contributor
|
Pinging @elastic/siem (Team:SIEM) |
rylnd
approved these changes
Aug 26, 2020
Contributor
rylnd
left a comment
There was a problem hiding this comment.
This looks great! The new codec is straightforward, tests are comprehensive, ![]()
| const request = requestMock.create({ | ||
| method: 'post', | ||
| path: `${DETECTION_ENGINE_RULES_URL}/_bulk_create`, | ||
| body: [{ from: 'now-7m', interval: '5m', ...getCreateRulesSchemaMock(), type: 'query' }], |
Contributor
There was a problem hiding this comment.
Why is the mock placed in the middle of the object here?
Contributor
Author
There was a problem hiding this comment.
No specific reason. I can re-organize this.
| import { requestContextMock, serverMock, requestMock } from '../__mocks__'; | ||
| import { patchRulesRoute } from './patch_rules_route'; | ||
| import { getCreateRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/create_rules_schema.mock'; | ||
| import { getPatchRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/patch_rules_schema.mock'; |
Contributor
💚 Build SucceededBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
dhurley14
added a commit
to dhurley14/kibana
that referenced
this pull request
Aug 26, 2020
…om" param on rules (elastic#76000) * updates validation on 'from' param to prevent malformed datemath strings from being accepted * fix imports * copy paste is not my friend * missed type check somehow * forgot to mock common utils * updates bodies for request validation tests
dhurley14
added a commit
to dhurley14/kibana
that referenced
this pull request
Aug 26, 2020
…om" param on rules (elastic#76000) * updates validation on 'from' param to prevent malformed datemath strings from being accepted * fix imports * copy paste is not my friend * missed type check somehow * forgot to mock common utils * updates bodies for request validation tests
Contributor
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updates validation on 'from' param to prevent malformed datemath strings from being accepted when creating, patching / updating, and importing rules.
Checklist
Delete any items that are not applicable to this PR.
For maintainers