Skip to content

Commit b9d148d

Browse files
committed
patch: fixes possible injection issue for notify-send
1 parent c374fe1 commit b9d148d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/utils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ module.exports.constructArgumentList = function (options, extra) {
313313
};
314314

315315
initial.forEach(function (val) {
316-
args.push(escapeFn(val));
316+
if (typeof val === 'string') {
317+
args.push(escapeFn(val));
318+
}
317319
});
318320
for (var key in options) {
319321
if (

test/notify-send.js

+11
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ describe('notify-send', function () {
7070
notifier.notify({ message: 'some\n "me\'ss`age`"' });
7171
});
7272

73+
it.only('should only include strings as arguments', function (done) {
74+
var expected = ['"HACKED"', '--expire-time', '"10000"'];
75+
76+
expectArgsListToBe(expected, done);
77+
var notifier = new Notify({ suppressOsdCheck: true });
78+
var options = JSON.parse(
79+
'{"title":"HACKED", "message":["`touch HACKED`"]}'
80+
);
81+
notifier.notify(options);
82+
});
83+
7384
it('should send additional parameters as --"keyname"', function (done) {
7485
var expected = [
7586
'"title"',

0 commit comments

Comments
 (0)