Browse Source

Merge pull request #1202 from PrivateBin/release-prep

1.6.1 release preparations
El RIDO 2 years ago
parent
commit
65f289e516

+ 1 - 0
CHANGELOG.md

@@ -2,6 +2,7 @@
 
 ## 1.6.1 (not yet released)
 * ADDED: Right-To-Left (RTL) support for Arabic & Hebrew (#1174)
+* CHANGED: Upgrading libraries to: DOMpurify 3.0.6
 
 ## 1.6.0 (2023-09-11)
 * ADDED: Translations for Japanese & Arabic

+ 2 - 2
Makefile

@@ -18,7 +18,7 @@ coverage-js: ## Run JS unit tests and generate code coverage reports.
 
 coverage-php: ## Run PHP unit tests and generate code coverage reports.
 	cd tst && phpunit 2> /dev/null
-	cd tst/log/php-coverage-report && sed -i "s#$(CURDIR)##g" *.html */*.html
+	cd tst/log/php-coverage-report && sed -i "s#$(CURDIR)/##g" *.html */*.html
 
 doc: doc-js doc-php ## Generate all code documentation.
 
@@ -26,7 +26,7 @@ doc-js: ## Generate JS code documentation.
 	jsdoc -p -d doc/jsdoc js/privatebin.js js/legacy.js
 
 doc-php: ## Generate JS code documentation.
-	phpdoc --visibility public,protected,private -t doc/phpdoc -d lib/
+	phpdoc --visibility=public,protected,private --target=doc/phpdoc --directory=lib/
 
 increment: ## Increment and commit new version number, set target version using `make increment VERSION=1.2.3`.
 	for F in `grep -l -R $(REGEX_CURRENT_VERSION) $(VERSION_FILES) | grep -v -e tst/log/ -e ":0" -e CHANGELOG.md`; \

+ 16 - 15
bin/configuration-test-generator

@@ -23,7 +23,7 @@ new ConfigurationTestGenerator(array(
             'tests'   => array(
                 array(
                     'conditions' => array('steps' => $vd),
-                    'type'       => 'RegExp',
+                    'type'       => 'MatchesRegularExpression',
                     'args'       => array(
                         '#<div[^>]*id="opendiscussionoption"[^>]*>#',
                         '$content',
@@ -53,7 +53,7 @@ new ConfigurationTestGenerator(array(
             'setting' => false,
             'tests'   => array(
                 array(
-                    'type' => 'NotRegExp',
+                    'type' => 'DoesNotMatchRegularExpression',
                     'args' => array(
                         '#<div[^>]*id="opendiscussionoption"[^>]*>#',
                         '$content',
@@ -70,7 +70,7 @@ new ConfigurationTestGenerator(array(
             'tests'   => array(
                 array(
                     'conditions' => array('main/discussion' => true),
-                    'type'       => 'RegExp',
+                    'type'       => 'MatchesRegularExpression',
                     'args'       => array(
                         '#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
                         '$content',
@@ -84,7 +84,7 @@ new ConfigurationTestGenerator(array(
             'tests'   => array(
                 array(
                     'conditions' => array('main/discussion' => true),
-                    'type'       => 'NotRegExp',
+                    'type'       => 'DoesNotMatchRegularExpression',
                     'args'       => array(
                         '#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
                         '$content',
@@ -100,7 +100,7 @@ new ConfigurationTestGenerator(array(
             'setting' => true,
             'tests'   => array(
                 array(
-                    'type' => 'RegExp',
+                    'type' => 'MatchesRegularExpression',
                     'args' => array(
                         '#<input[^>]+id="burnafterreading"[^>]*checked="checked"[^>]*>#',
                         '$content',
@@ -113,7 +113,7 @@ new ConfigurationTestGenerator(array(
             'setting' => false,
             'tests'   => array(
                 array(
-                    'type' => 'NotRegExp',
+                    'type' => 'DoesNotMatchRegularExpression',
                     'args' => array(
                         '#<input[^>]+id="burnafterreading"[^>]*checked="checked"[^>]*>#',
                         '$content',
@@ -129,7 +129,7 @@ new ConfigurationTestGenerator(array(
             'setting' => true,
             'tests'   => array(
                 array(
-                    'type' => 'RegExp',
+                    'type' => 'MatchesRegularExpression',
                     'args' => array(
                         '#<div[^>]*id="password"[^>]*>#',
                         '$content',
@@ -143,7 +143,7 @@ new ConfigurationTestGenerator(array(
             'tests'   => array(
                 array(
                     'conditions' => array('main/discussion' => true),
-                    'type'       => 'NotRegExp',
+                    'type'       => 'DoesNotMatchRegularExpression',
                     'args'       => array(
                         '#<div[^>]*id="password"[^>]*>#',
                         '$content',
@@ -159,14 +159,14 @@ new ConfigurationTestGenerator(array(
             'setting' => 'page',
             'tests'   => array(
                 array(
-                    'type' => 'RegExp',
+                    'type' => 'MatchesRegularExpression',
                     'args' => array(
                         '#<link[^>]+type="text/css"[^>]+rel="stylesheet"[^>]+href="css/privatebin\.css\\?\d[\d\.]+\d+"[^>]*/>#',
                         '$content',
                         'outputs "page" stylesheet correctly',
                     ),
                 ), array(
-                    'type' => 'NotRegExp',
+                    'type' => 'DoesNotMatchRegularExpression',
                     'args' => array(
                         '#<link[^>]+type="text/css"[^>]+rel="stylesheet"[^>]+href="css/bootstrap/bootstrap-\d[\d\.]+\d\.css"[^>]*/>#',
                         '$content',
@@ -179,14 +179,14 @@ new ConfigurationTestGenerator(array(
             'setting' => 'bootstrap',
             'tests'   => array(
                 array(
-                    'type' => 'NotRegExp',
+                    'type' => 'DoesNotMatchRegularExpression',
                     'args' => array(
                         '#<link[^>]+type="text/css"[^>]+rel="stylesheet"[^>]+href="css/privatebin\.css\\?\d[\d\.]+\d+"[^>]*/>#',
                         '$content',
                         'removes "page" stylesheet correctly',
                     ),
                 ), array(
-                    'type' => 'RegExp',
+                    'type' => 'MatchesRegularExpression',
                     'args' => array(
                         '#<link[^>]+type="text/css"[^>]+rel="stylesheet"[^>]+href="css/bootstrap/bootstrap-\d[\d\.]+\d\.css"[^>]*/>#',
                         '$content',
@@ -361,7 +361,7 @@ class ConfigurationTestGenerator
                         }
                         // skip if not all test conditions are met
                         if (array_key_exists('conditions', $test)) {
-                            while (list($path, $setting) = each($test['conditions'])) {
+                            foreach ($test['conditions'] as $path => $setting) {
                                 if ($path == 'steps' && !in_array($step, $setting)) {
                                     continue 2;
                                 } elseif ($path != 'steps') {
@@ -591,8 +591,9 @@ EOT;
             return $this->_configurations;
         }
         echo "generateConfigurations: iteration $this->_iterationCount", PHP_EOL;
-        $continue = list($path, $settings) = each($this->_options);
-        if ($continue === false) {
+        $path = key($this->_options);
+        $settings = current($this->_options);
+        if (next($this->_options) === false) {
             return $this->_configurations;
         }
         list($section, $option) = explode('/', $path);

+ 1 - 1
doc/Generating Source Code Documentation.md

@@ -21,7 +21,7 @@ $ sudo pear install phpdoc/phpDocumentor
 To generate the documentation, change into the main directory and run phpdoc:
 ```console
 $ cd PrivateBin
-$ phpdoc --visibility public,protected,private -t doc/phpdoc -d lib/
+$ phpdoc --visibility=public,protected,private --target=doc/phpdoc --directory=lib/
 ```
 
 **Note:** When used with PHP 7, the prerelease of phpDocumentator 2.9 needs to be

+ 3 - 11
tst/README.md → doc/Running Unit Tests.md

@@ -28,11 +28,6 @@ docker run --rm --read-only -v ~/PrivateBin:/srv:ro privatebin/unit-testing phpu
 docker run --rm --read-only -v ~/PrivateBin:/srv:ro privatebin/unit-testing mocha
 ```
 
-We also provide a Janitor image that includes the  Cloud9  and Theia WebIDEs as
-well as the integrated unit testing utilities. See our [docker wiki
-page](https://github.com/PrivateBin/PrivateBin/wiki/Docker#janitor-image-with-cloud9-and-theia-webide-janitortechnologyprivatebin)
-for further details on this.
-
 ## Running PHP Unit Tests
 
 In order to run these tests, you will need to install the following packages
@@ -61,18 +56,15 @@ configurations defined in its constructor, it generates the unit test file
 of these configurations and tests for (most of the) valid combinations. Some of
 combinations can't be tested with this method, i.e. a valid option combined with
 an invalid one. Other very specific test cases (i.e. to trigger multiple errors)
-are covered in `tst/PrivateBinTest.php`. Here is how to generate the
+are covered in `tst/ControllerTest.php`. Here is how to generate the
 configuration test and run it:
 
 ```console
 $ cd PrivateBin/tst
-$ php ConfigurationTestGenerator.php
+$ ../bin/configuration-test-generator
 $ phpunit ConfigurationCombinationsTest.php
 ```
 
-Note that it can take an hour or longer to run the several thousand tests.
-
-
 ## Running JavaScript Unit Tests
 
 In order to run these tests, you will need to install the following packages
@@ -134,7 +126,7 @@ associated random number generator (RNG) state, so you can reproduce it easily:
   1 failing
 
   1) Helper getCookie returns the requested cookie:
-     Error: Failed after 30 tests and 11 shrinks. rngState: 88caf85079d32e416b; Counterexample: ["{", "9", "9", "YD8%fT"]; [" ", "_|K:"]; 
+     Error: Failed after 30 tests and 11 shrinks. rngState: 88caf85079d32e416b; Counterexample: ["{", "9", "9", "YD8%fT"]; [" ", "_|K:"];
 
 [...]
 ```

+ 1 - 1
js/common.js

@@ -17,7 +17,7 @@ require('./prettify');
 global.prettyPrint = window.PR.prettyPrint;
 global.prettyPrintOne = window.PR.prettyPrintOne;
 global.showdown = require('./showdown-2.1.0');
-global.DOMPurify = require('./purify-3.0.4');
+global.DOMPurify = require('./purify-3.0.6');
 global.baseX = require('./base-x-4.0.0').baseX;
 global.Legacy = require('./legacy').Legacy;
 require('./bootstrap-3.4.1');

+ 6 - 6
js/privatebin.js

@@ -80,7 +80,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
     /**
      * CryptoData class
      *
-     * bundles helper fuctions used in both paste and comment formats
+     * bundles helper functions used in both paste and comment formats
      *
      * @name CryptoData
      * @class
@@ -95,7 +95,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         /**
          * gets the cipher data (cipher text + adata)
          *
-         * @name Paste.getCipherData
+         * @name CryptoData.getCipherData
          * @function
          * @return {Array}|{string}
          */
@@ -108,7 +108,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
     /**
      * Paste class
      *
-     * bundles helper fuctions around the paste formats
+     * bundles helper functions around the paste formats
      *
      * @name Paste
      * @class
@@ -171,7 +171,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
     /**
      * Comment class
      *
-     * bundles helper fuctions around the comment formats
+     * bundles helper functions around the comment formats
      *
      * @name Comment
      * @class
@@ -183,7 +183,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         /**
          * gets the UNIX timestamp of the comment creation
          *
-         * @name Paste.getCreated
+         * @name Comment.getCreated
          * @function
          * @return {int}
          */
@@ -195,7 +195,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         /**
          * gets the icon of the comment submitter
          *
-         * @name Paste.getIcon
+         * @name Comment.getIcon
          * @function
          * @return {string}
          */

File diff suppressed because it is too large
+ 0 - 1
js/purify-3.0.4.js


File diff suppressed because it is too large
+ 1 - 0
js/purify-3.0.6.js


+ 1 - 1
js/zlib-1.2.13.js

@@ -25,7 +25,7 @@
         };
 
         let buff;
-        if (typeof fetch === 'undefined') {
+        if (typeof fs === 'object') {
             buff = fs.readFileSync('zlib-1.2.13.wasm');
         } else {
             const resp = await fetch('js/zlib-1.2.13.wasm');

+ 2 - 2
tpl/bootstrap.php

@@ -71,9 +71,9 @@ if ($MARKDOWN) :
 <?php
 endif;
 ?>
-		<script type="text/javascript" data-cfasync="false" src="js/purify-3.0.4.js" integrity="sha512-N7H+3ylaOUeKuTX57cZoa42hqaG5w1rchG/IP9+BHd48W/vESgPDpb5QuDqzJE1dZhrGVCQgU8peIQGHmdGFhQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/purify-3.0.6.js" integrity="sha512-N3y6/HOk3pbsw3lFh4O8CKKEVwu1B2CF8kinhjURf8Yqa5OfSUt+/arozxFW+TUPOPw3TsDCRT/0u7BGRTEVUw==" crossorigin="anonymous"></script>
 		<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
-		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ykPMZuZDmyGNik7G5dIeqE/+CJ79OKZ0XzPPVWUwAzp+k8PQoP66J8F8zYtI53dM4ITLojkNKrv4vTv6E3bzFQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-JHrUjGZA30SBVu4JRp1nYsROnPZpGFazacs12e5rBavFRHSguo2Otu65U25CTsjAMa8R6Zq91u+aFf62M5B5Yw==" crossorigin="anonymous"></script>
 		<!-- icon -->
 		<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
 		<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />

+ 2 - 2
tpl/page.php

@@ -49,9 +49,9 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" data-cfasync="false" src="js/purify-3.0.4.js" integrity="sha512-N7H+3ylaOUeKuTX57cZoa42hqaG5w1rchG/IP9+BHd48W/vESgPDpb5QuDqzJE1dZhrGVCQgU8peIQGHmdGFhQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/purify-3.0.6.js" integrity="sha512-N3y6/HOk3pbsw3lFh4O8CKKEVwu1B2CF8kinhjURf8Yqa5OfSUt+/arozxFW+TUPOPw3TsDCRT/0u7BGRTEVUw==" crossorigin="anonymous"></script>
 		<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
-		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ykPMZuZDmyGNik7G5dIeqE/+CJ79OKZ0XzPPVWUwAzp+k8PQoP66J8F8zYtI53dM4ITLojkNKrv4vTv6E3bzFQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-JHrUjGZA30SBVu4JRp1nYsROnPZpGFazacs12e5rBavFRHSguo2Otu65U25CTsjAMa8R6Zq91u+aFf62M5B5Yw==" crossorigin="anonymous"></script>
 		<!-- icon -->
 		<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
 		<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />

Some files were not shown because too many files changed in this diff