Skip to content

Commit 78122ba

Browse files
committed
Improve tests security.
1 parent 8c76cd6 commit 78122ba

18 files changed

+8
-5
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
* PHPMUSSEL COPYRIGHT 2013 AND BEYOND BY THE PHPMUSSEL TEAM.
77
*/
88

9-
// Prevent running tests outside of Composer (if the package is deployed
10-
// somewhere live with this file still intact, useful to prevent hammering and
11-
// cycles being needlessly wasted).
9+
/**
10+
* If this file remains intact after deploying the package to production,
11+
* preventing it from running outside of Composer may be useful as a means of
12+
* prevent potential attackers from hammering the file and needlessly wasting
13+
* cycles at the server.
14+
*/
1215
if (!isset($_SERVER['COMPOSER_BINARY'])) {
1316
die;
1417
}
@@ -41,7 +44,7 @@
4144
require $Autoloader;
4245

4346
// Path to all tests data.
44-
$TestsPath = __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR;
47+
$TestsPath = __DIR__ . DIRECTORY_SEPARATOR . '.tests' . DIRECTORY_SEPARATOR;
4548

4649
// Fetch the signatures needed for testing the scanner.
4750
$ZipObj = new \ZipArchive();
@@ -88,7 +91,7 @@
8891
// Test scanning against the standard phpMussel test samples.
8992
$Actual = $Scanner->scan($Samples, 3);
9093
ksort($Actual);
91-
if ($Actual !== $Expected) {
94+
if (serialize($Actual) !== serialize($Expected)) {
9295
echo 'Actual scan results does not match expected scan results.' . PHP_EOL;
9396
exit(5);
9497
}

0 commit comments

Comments
 (0)