From ebc2d649c412afc0d82b1c3ad6a7990189d11289 Mon Sep 17 00:00:00 2001 From: rugk Date: Mon, 13 Jan 2020 19:56:15 +0100 Subject: [PATCH] [TEST] Try to disallow vulnerable cases --- js/privatebin.js | 3 +++ test.diff | 40 ++++++++++++++++++++++++++++++++++++++++ tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 test.diff diff --git a/js/privatebin.js b/js/privatebin.js index c83d8ffb..5c0aeccb 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -620,6 +620,9 @@ jQuery.PrivateBin = (function($, RawDeflate) { // messageID may contain links, but only the first parameter, as that is from a trusted source (code or translation JSON files) let containsLinks = args[0].indexOf(' 0) { + throw new Error('security violation detected: do not concatenate links and untrusted data!'); + } // format string let output = Helper.sprintf.apply(this, args); diff --git a/test.diff b/test.diff new file mode 100644 index 00000000..97e384f2 --- /dev/null +++ b/test.diff @@ -0,0 +1,40 @@ +diff --git a/js/privatebin.js b/js/privatebin.js +index c83d8ff..5c0aecc 100644 +--- a/js/privatebin.js ++++ b/js/privatebin.js +@@ -620,6 +620,9 @@ jQuery.PrivateBin = (function($, RawDeflate) { + + // messageID may contain links, but only the first parameter, as that is from a trusted source (code or translation JSON files) + let containsLinks = args[0].indexOf(' 0) { ++ throw new Error('security violation detected: do not concatenate links and untrusted data!'); ++ } + + // format string + let output = Helper.sprintf.apply(this, args); +diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php +index 59c730e..0e949da 100644 +--- a/tpl/bootstrap.php ++++ b/tpl/bootstrap.php +@@ -72,7 +72,7 @@ endif; + ?> + + +- ++ + + + +diff --git a/tpl/page.php b/tpl/page.php +index 0f8df18..ff2d5f5 100644 +--- a/tpl/page.php ++++ b/tpl/page.php +@@ -50,7 +50,7 @@ endif; + ?> + + +- ++ + + + diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 59c730e2..0e949da6 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -72,7 +72,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 0f8df184..ff2d5f50 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -50,7 +50,7 @@ endif; ?> - +