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

fix: disallow keys of JS Object prototype for safety #236

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

wschurman
Copy link
Member

Why

This PR addresses this comment: #233 (comment)

Essentially, we want to disallow naming entity fields the same as some predefined JS prototype fields so that code in entity that uses for .. in loops over the fields object aren't accidentally unsafe (it's too easy a mistake to make).

How

Disallow fields, add test.

Test Plan

Run test.

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@7e2cea1). Learn more about missing BASE report.

Current head 46d0bc0 differs from pull request most recent head 70a685c

Please upload reports for the commit 70a685c to get more accurate results.

Additional details and impacted files
@@           Coverage Diff            @@
##             main      #236   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?        69           
  Lines           ?      1899           
  Branches        ?       262           
========================================
  Hits            ?      1899           
  Misses          ?         0           
  Partials        ?         0           
Flag Coverage Δ
integration 100.00% <100.00%> (?)
unittest 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/entity/src/EntityConfiguration.ts Outdated Show resolved Hide resolved
packages/entity/src/EntityConfiguration.ts Outdated Show resolved Hide resolved
@wschurman wschurman requested a review from ide June 4, 2024 21:23
Copy link
Member

@ide ide left a comment

Choose a reason for hiding this comment

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

Important typo to fix mentioned inline.

packages/entity/src/EntityConfiguration.ts Outdated Show resolved Hide resolved
Base automatically changed from @wschurman/constrain-tfields to main June 4, 2024 22:35
@wschurman wschurman force-pushed the @wschurman/constrain-tfields-2 branch from 46d0bc0 to 0cf2a45 Compare June 4, 2024 22:36
@wschurman wschurman force-pushed the @wschurman/constrain-tfields-2 branch from 0cf2a45 to 70a685c Compare June 4, 2024 22:37
@wschurman wschurman merged commit 05726d4 into main Jun 4, 2024
1 check passed
@wschurman wschurman deleted the @wschurman/constrain-tfields-2 branch June 4, 2024 22:41
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.

3 participants