-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Synthetics] enable/disable - prevent incorrect keys from being added to the monitor saved object #140553
[Synthetics] enable/disable - prevent incorrect keys from being added to the monitor saved object #140553
Conversation
… to the monitor saved object
…-ref HEAD~1..HEAD --fix'
…enable-disable-incorrect-keys
…//github.com/dominiqueclarke/kibana into fix/synthetics-enable-disable-incorrect-keys
…-ref HEAD~1..HEAD --fix'
…//github.com/dominiqueclarke/kibana into fix/synthetics-enable-disable-incorrect-keys
…//github.com/dominiqueclarke/kibana into fix/synthetics-enable-disable-incorrect-keys
x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts
Outdated
Show resolved
Hide resolved
…ent/monitor_types.ts
x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts
Outdated
Show resolved
Hide resolved
dispatch( | ||
fetchUpsertMonitorAction({ | ||
id, | ||
monitor: { ...monitor, [ConfigKey.ENABLED]: enabled }, | ||
monitor: { [ConfigKey.ENABLED]: enabled }, |
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.
Since edits are applied on top of the existing object, we can just pass the enabled key to be safe here.
Pinging @elastic/uptime (Team:uptime) |
…//github.com/dominiqueclarke/kibana into fix/synthetics-enable-disable-incorrect-keys
…//github.com/dominiqueclarke/kibana into fix/synthetics-enable-disable-incorrect-keys
@elasticmachine merge upstream |
f9fe54b
to
3a7d244
Compare
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.
LGTM, Works as expected, doesn't add extra fields now !!
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
… to the monitor saved object (elastic#140553) * synthetics - enable/disable - prevent incorrect keys from being added to the monitor saved object * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust types * add exact typing * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust test * use exact types * use exact types for editing * adjust types * adjust tests * adjust types * Update x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts * adjust normalizers * Update x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts * Update x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts * adjust types * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * adjust jest tests * adjust types * adjust api_integration tests * update tests Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 27916d3)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… to the monitor saved object (#140553) (#142238) * synthetics - enable/disable - prevent incorrect keys from being added to the monitor saved object * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust types * add exact typing * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust test * use exact types * use exact types for editing * adjust types * adjust tests * adjust types * Update x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts * adjust normalizers * Update x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts * Update x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts * adjust types * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * adjust jest tests * adjust types * adjust api_integration tests * update tests Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 27916d3) Co-authored-by: Dominique Clarke <[email protected]>
… to the monitor saved object (elastic#140553) * synthetics - enable/disable - prevent incorrect keys from being added to the monitor saved object * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust types * add exact typing * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust test * use exact types * use exact types for editing * adjust types * adjust tests * adjust types * Update x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts * adjust normalizers * Update x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts * Update x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts * adjust types * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * adjust jest tests * adjust types * adjust api_integration tests * update tests Co-authored-by: kibanamachine <[email protected]>
Summary
Fixes a bug where incorrect keys were being added to montiors on the enable/disable flow in Synthetics UI.
This was due to an oversight where types were changed to accept either a Synthetics Monitor saved object or an Overview Monitor Item. In reality, Overview Monitor Items are not a type of Synthetics monitor, but is a unique object for displaying information about a monitor on the overview page in general. This only impacted 8.5.0.
The enable/disable hook was updated to adjust the types.
Additionally, extra runtime type decoding was added to ensure that unknown keys cannot be added to a monitor-saved object. The
t.exact
type returns a valid monitor, stripped of any additional unknown keys that are not part of the codec.Testing
attributes
key of the monitor. Ensure that no keys from theMonitorOverviewItem
are present, such aslocation
,isEnabled
orid
.