Node.js - Generic Object Injection Sink (on eslint) using FOR iteration

Viewed 19

I have a node project and a function to find a specific object item

My code:

const filterObjectItem = (myObject, property, value) => {
    for (const prop in myObject) {
        if (prop === property) {
            for (const item in myObject[prop]) {
                if (item === value) {
                    return myObject[prop][item][0]
                }
            }
        }
    }

    return false
}

the function workingl, but I'm getting this warning when running the eslint

warning  Generic Object Injection Sink  security/detect-object-injection

does anyone have an idea how to refactor the function to solve this warnning?

0 Answers
Related