Skip to content

Fix a bug with unsafe properties#408

Merged
snewcomer merged 2 commits intoadopted-ember-addons:masterfrom
andreyfel:unsafe-properties-bug
Jan 17, 2020
Merged

Fix a bug with unsafe properties#408
snewcomer merged 2 commits intoadopted-ember-addons:masterfrom
andreyfel:unsafe-properties-bug

Conversation

@andreyfel
Copy link

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'];

Andrey Fel added 2 commits January 17, 2020 19:27
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 🙇

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
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