plugins: sanitize user input before passing it to plugins
This commit is contained in:
parent
94f5445742
commit
0afa7bc184
1 changed files with 5 additions and 3 deletions
|
@ -57,7 +57,7 @@ var UrlPlugin = function(name, urlCallback) {
|
||||||
* to display when messages are received.
|
* to display when messages are received.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
|
plugins.service('plugins', ['userPlugins', '$sce', '$sanitize', function(userPlugins, $sce, $sanitize) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines the plugin manager object
|
* Defines the plugin manager object
|
||||||
|
@ -85,7 +85,7 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
|
||||||
*/
|
*/
|
||||||
var contentForMessage = function(message) {
|
var contentForMessage = function(message) {
|
||||||
message.metadata = [];
|
message.metadata = [];
|
||||||
|
message.text = $sanitize(message.text);
|
||||||
var addPluginContent = function(content, pluginName, num) {
|
var addPluginContent = function(content, pluginName, num) {
|
||||||
if (num) {
|
if (num) {
|
||||||
pluginName += " " + num;
|
pluginName += " " + num;
|
||||||
|
@ -110,7 +110,9 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
|
||||||
nsfw = true;
|
nsfw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pluginContent = plugins[i].contentForMessage(message.text);
|
var pluginContent = plugins[i].contentForMessage(
|
||||||
|
message.text
|
||||||
|
);
|
||||||
if (pluginContent && pluginContent !== []) {
|
if (pluginContent && pluginContent !== []) {
|
||||||
|
|
||||||
if (pluginContent instanceof Array) {
|
if (pluginContent instanceof Array) {
|
||||||
|
|
Loading…
Reference in a new issue