Skip to content
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

check hasOwnProperty when using for..in #2132

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Conversation

xavdid-stripe
Copy link
Member

When using iterating over the properties of an object, we should be defensive and ensure we're only using the properties that belong directly to that object (not anything inherited from the prototype chain). If users have modified the base Object, then we'll modify those modifications in a way we shouldn't, causing issues.

This seemed like something we could catch in lint, and it is! We just disabled the rule for some reason. So I re-enabled it and fixed the errors.

More info: https://eslint.org/docs/latest/rules/guard-for-in


Fixes #2114

Fixes RUN_DEVSDK-1209

@xavdid-stripe xavdid-stripe requested review from a team and helenye-stripe and removed request for a team July 9, 2024 17:29
@xavdid-stripe xavdid-stripe merged commit f5e86aa into master Jul 9, 2024
8 checks passed
@xavdid-stripe xavdid-stripe deleted the RUN_DEVSDK-1209 branch July 9, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_prepResources() and ResourceNamespace iterate all properties, but don't check hasOwnProperty
2 participants