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: Security bug about prototype pollution #805

Merged
merged 1 commit into from
Oct 13, 2021

Conversation

sumeetkakkar
Copy link
Collaborator

Refer #804

@sumeetkakkar
Copy link
Collaborator Author

$ npm run test

> dustjs-linkedin@2.7.2 test /Users/.../dustjs
> grunt travis

Running "jasmine_nodejs:templates" (jasmine_nodejs) task

>> Executing 729 defined specs...
>> Done!


>> Successful!

Running "jasmine_nodejs:core" (jasmine_nodejs) task

>> Executing 24 defined specs...
>> Done!


>> Successful!

Running "jasmine_nodejs:cjs" (jasmine_nodejs) task

>> Executing 8 defined specs...
>> Done!


>> Successful!

Running "jasmine_nodejs:dustc" (jasmine_nodejs) task

>> Executing 15 defined specs...
>> Done!


>> Successful!

Done.

Object.prototype.MAL_CODE= [ malicious ];
const compiled = dust.compile('{username} is an important person.{~n}');
const tmpl = dust.loadSource(compiled);
dust.render(tmpl, { username: 'Jane Doe' }, (err, output) => {

Choose a reason for hiding this comment

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

how did we test this?
what should be the result of this test without the above fix

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will execute curl 127.0.0.1 and the test fails

@@ -70,6 +70,9 @@
type = type || INFO;
if (loggingLevels[type] >= loggingLevels[dust.debugLevel]) {
log('[DUST:' + type + ']', message);
if (type === ERROR && dust.debugLevel === DEBUG && message instanceof Error && message.stack) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Were errors just logging [Object] or something like that before this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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