Skip to content

Commit

Permalink
Merge commit from fork
Browse files Browse the repository at this point in the history
SECURITY: Make 'unittest' mode only work during tests
  • Loading branch information
jpatokal committed Aug 22, 2024
2 parents 3ada5ee + a1f83e1 commit 17273e9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion help/resetpw.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
Cheers,
OpenFlights.org";

if (isset($_POST["unittest"])) {
if (defined(UNIT_TEST_MODE) && UNIT_TEST_MODE && isset($_POST["unittest"])) {
echo $link . "***" . $row['challenge'];
exit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion php/apsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
TXT;


if (isset($_POST["unittest"])) {
if (defined(UNIT_TEST_MODE) && UNIT_TEST_MODE && isset($_POST["unittest"])) {
echo $title . "\n\n" . $body;
exit;
}
Expand Down
3 changes: 3 additions & 0 deletions php/config.php.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

const UNIT_TEST_MODE = false;

$host = "localhost";
$dbname = "flightdb2";
$user = "openflights";
Expand Down
2 changes: 2 additions & 0 deletions test/server/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// Path to OpenFlights upload directory
$uploadDir = '../../import/';

const UNIT_TEST_MODE = true;

// Database configuration
$dbhost = "localhost";
$dbuser = "openflights";
Expand Down

0 comments on commit 17273e9

Please sign in to comment.