Skip to content

events: prefix events to prevent breaking on known object properties #728

Closed
@3rd-Eden

Description

@3rd-Eden

In the EventEmitter the events are stored in an plain Object instance. The event names that you use are added directly as property on the object so when you event names such as __proto__ it will break. One solution is to prefix the keys with a char such as ~.

Example case:

var EventEmitter = require('events').EventEmitter;
var e = new EventEmitter();

e.on('__proto__', function (bar) {
  console.log('foo', bar);
});
e.emit('__proto__', 1);

Willing to create pull request if bug requires fixing ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.eventsIssues and PRs related to the events subsystem / EventEmitter.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions