Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Prevent options from leaking #1595

Merged
merged 1 commit into from
Jun 15, 2016
Merged

Prevent options from leaking #1595

merged 1 commit into from
Jun 15, 2016

Conversation

xzyfer
Copy link
Contributor

@xzyfer xzyfer commented Jun 15, 2016

The options object passed into render and renderSync is only
shallow copied. This is an issue when nested objects and arrays like
custom importer and functions. In the case of custom function we
wrap the provided function. This wrapped version replaces the provided
one which can then leak back into the calling code. This is an issue
if render* is called in a loop like in gulp-sass.

Fixes #1168

@xzyfer xzyfer added this to the next.patch milestone Jun 15, 2016
@xzyfer xzyfer self-assigned this Jun 15, 2016
@xzyfer xzyfer force-pushed the fix/option-leakage branch 2 times, most recently from 108d8bb to efd5560 Compare June 15, 2016 11:15
The options object passed into `render` and `renderSync` is only
shallow copied. This is an issue when nested objects and arrays like
custom importer and functions. In the case of custom function we
wrap the provided function. This wrapped version replaces the provided
one which can then leak back into the calling code. This is an issue
if `render*` is called in a loop like in gulp-sass.

Fixes sass#1168
@xzyfer xzyfer force-pushed the fix/option-leakage branch from efd5560 to 7ac6c2e Compare June 15, 2016 11:50
@@ -535,19 +535,18 @@ describe('api', function() {
});
});

it('should copy all options properties', function(done) {
it('should wrap importer options', function(done) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test didn't make sense. It was actually asserting this issue existed.

@xzyfer xzyfer merged commit 655a85f into sass:master Jun 15, 2016
@xzyfer xzyfer deleted the fix/option-leakage branch June 15, 2016 12:14
@xzyfer xzyfer changed the title Prevention options from leaking Prevent options from leaking Jun 15, 2016
@xzyfer xzyfer modified the milestone: next.patch Sep 4, 2016
jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this pull request Apr 7, 2024
Emulate Ruby Sass' url() parsing semantics
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant