kibana/x-pack/plugins/ml/server/models
Larry Gregory 74d88580a5
Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829)
## Summary

This PR has breadth, but not depth. This adds 3 new `eslint` rules. The
first two protect against the use of code generated from strings (`eval`
and friends), which will not work client-side due to our CSP, and is not
something we wish to support server-side. The last rule aims to prevent
a subtle class of bugs, and to defend against a subset of prototype
pollution exploits:

- `no-new-func` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-new-func
- `no-implied-eval` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-implied-eval. Note that this
function implies that it prevents no-new-func, but I don't see [test
cases](https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-implied-eval.js)
covering this behavior, so I think we should play it safe and enable
both rules.
- `no-prototype-builtins` to prevent accessing shadowed properties:
https://eslint.org/docs/latest/rules/no-prototype-builtins


In order to be compliant with `no-prototype-builtins`, I've migrated all
usages and variants of `Object.hasOwnProperty` to use the newer
[`Object.hasOwn`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn).
2024-08-13 10:30:19 -05:00
..
annotation_service [ML] Enable consistent-type-imports eslint rule (#176921) 2024-03-07 03:29:20 -07:00
bucket_span_estimator [ML] Enable consistent-type-imports eslint rule (#176921) 2024-03-07 03:29:20 -07:00
calculate_model_memory_limit [ML] Enable consistent-type-imports eslint rule (#176921) 2024-03-07 03:29:20 -07:00
calendar [ML] Increasing calendar events request limit (#158726) 2023-06-01 11:24:59 +01:00
data_frame_analytics [ML] Enable consistent-type-imports eslint rule (#176921) 2024-03-07 03:29:20 -07:00
data_recognizer [ML] Utilize the DataViewLazy in ML plugin (#189188) 2024-07-26 19:56:58 +02:00
data_visualizer Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829) 2024-08-13 10:30:19 -05:00
fields_service Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829) 2024-08-13 10:30:19 -05:00
filter [packages] prevent and remove basename collisions for js/ts code (#148835) 2023-01-12 12:29:30 -07:00
job_audit_messages Upgrade prettier dependencies (#188032) 2024-07-24 17:29:05 +01:00
job_service Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829) 2024-08-13 10:30:19 -05:00
job_validation Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829) 2024-08-13 10:30:19 -05:00
model_management [ML] Support E5 model download from the list view, mark not supported/not optimized models (#189372) 2024-08-07 08:43:18 +02:00
notifications_service Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829) 2024-08-13 10:30:19 -05:00
results_service [ML] Fixing issue with empty object creation (#186821) 2024-06-25 08:23:25 -07:00