-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Not a huge surprise, but notes with quotes in the body break sending notes:
root@localhost# ./pushbullet push mydev note "msg" "hello world"
Sending to device MYDEV
root@localhost# ./pushbullet push mydev note "msg" "hello \"world\""
Sending to device MYDEV
Error submitting the request. The error message was: {"error":{"code":"invalid_request","type":"invalid_request","message":"Failed to decode JSON body.","cat":"(=^‥^=)"},"error_code":"invalid_request"}This can be averted with something like the following (which includes the posix-ification from my posix PR):
body=$(echo "$body" | sed -e 's/\n/\\n/g' -e 's/"/\\"/g')Though I haven't come up with a string that would constitute an injection attack, it seems prudent to guard against inadvertent interpretation. (I'm doing this because I find it handy to have easily parsed message bodies; whether using CSV or JSON in the message body, it's not hard to conceive of situations where having some components quoted might be useful.)
There may be other shell escaping that might be necessary; I haven't investigated possible problems yet. Likewise, it might be a good idea to do this for the note title as well.
Metadata
Metadata
Assignees
Labels
No labels