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 a bug with unsafe properties #408

Merged

Conversation

andreyfel
Copy link
Contributor

possibleKeys were shared between the branches during the traverse.
Each node could push to it making it polluted for the next branch.
Source like: {a: {}, b: {c: {}}} could produce paths like:
['a', 'a.b.c'] instead of ['a', 'b.c'];

The test is failing on current implementation
possibleKeys were shared between the branches during the traverse.
Each node could push to it making it polluted for the next branch.
Source like: {a: {}, b: {c: {}}} could produce paths like:
['a', 'a.b.c'] instead of ['a', 'b.c'];
@andreyfel andreyfel requested a review from snewcomer January 17, 2020 16:46
Copy link
Collaborator

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

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

Phenomenal! Thank you thank you 🙇

@@ -35,4 +35,32 @@ module('Unit | Utility | merge deep', () => {

assert.deepEqual(value, { company: { employees: ['Jull', 'Olafur']} }, 'has right employees');
});

test('it works with unsafe properties', async function(assert) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you mean by "unsafe" here? Just curious b/c we also use this term to reference prototype poisoning in this codebase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure about the term, I used exactly the same term I found in the source code. I didn't find tests which were testing that branch of logic, so I've tried to "reverse engineer" the code to make tests go through that branch.

@snewcomer snewcomer merged commit 23fc7a2 into adopted-ember-addons:master Jan 17, 2020
@andreyfel andreyfel deleted the unsafe-properties-bug branch January 18, 2020 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants