Skip to content

JS: fix a FN for prototype polluting function query #8946

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

Merged
merged 1 commit into from
Apr 29, 2022
Merged

JS: fix a FN for prototype polluting function query #8946

merged 1 commit into from
Apr 29, 2022

Conversation

kaeluka
Copy link

@kaeluka kaeluka commented Apr 28, 2022

Fixes another FN from #8846 (CVE-2021-23574).

The bottom line is, that using iteration like this used to work:

function forEachPropNoTempVar(obj, callback) {
    const keys = Object.keys(obj)
    const len = keys.length
    for (let i = 0; i < len; i++) {
        const key = keys[i];
        callback(key, obj[key])
    }
}

But iteration like that did not (now fixed):

function forEachPropNoTempVar(obj, callback) {
    const keys = Object.keys(obj)
    const len = keys.length
    for (let i = 0; i < len; i++) {
        // no local variable used
        callback(keys[i], obj[keys[i]])
    }
}

@kaeluka kaeluka requested a review from a team as a code owner April 28, 2022 14:20
@github-actions github-actions bot added the JS label Apr 28, 2022
@kaeluka kaeluka added the no-change-note-required This PR does not need a change note label Apr 28, 2022
@kaeluka kaeluka changed the title fix a FN for prototype polluting function query JS: fix a FN for prototype polluting function query Apr 28, 2022
@kaeluka
Copy link
Author

kaeluka commented Apr 29, 2022

The experiments came back; looks all good.

Copy link
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kaeluka kaeluka merged commit fa377ac into github:main Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants