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

Use object with null prototype for various app properties #4861

Merged

Conversation

EvanHahn
Copy link
Contributor

See discussion here.

app.cache, app.engines, and app.settings are now created with Object.create(null) instead of {}.

This also adds a test that app.locals is created the same way.

lib/application.js Show resolved Hide resolved
test/app.locals.js Outdated Show resolved Hide resolved
@EvanHahn
Copy link
Contributor Author

This has been open for over a year. No rush from me, but let me know if there's anything I can do to move this along.

@lucasraziel
Copy link

I could work with the conflicts in this PR, but I do not have write access.

`app.cache`, `app.engines`, and `app.settings` are now created with
`Object.create(null)` instead of `{}`.

This also updates a test to ensure that `app.locals` is created the same
way.
@EvanHahn EvanHahn force-pushed the object.create-null-for-various-properties branch from a2348c8 to 68d1b9e Compare April 28, 2024 23:13
@EvanHahn
Copy link
Contributor Author

Fixed the merge conflict. I think this is now ready to be merged.

Copy link
Member

@UlisesGascon UlisesGascon left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for managing the conflicts @EvanHahn

@wesleytodd wesleytodd merged commit 1443973 into expressjs:5.x Apr 29, 2024
20 checks passed
@EvanHahn EvanHahn deleted the object.create-null-for-various-properties branch May 1, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants