Skip to content

Commit

Permalink
4.17.11
Browse files Browse the repository at this point in the history
  • Loading branch information
scottjpearson committed Oct 10, 2022
1 parent ecff00c commit be4ea2b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CareerDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CareerDev {
public static $passedModule = NULL;

public static function getVersion() {
return "4.17.9";
return "4.17.11";
}

public static function getLockFile($pid) {
Expand Down
33 changes: 33 additions & 0 deletions classes/Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
require_once(__DIR__ . '/ClassLoader.php');

class Sanitizer {
/**
* @psalm-taint-specialize
*/
public static function sanitizeJSON($str) {
/**
* @psalm-taint-escape html
Expand All @@ -19,6 +22,9 @@ public static function sanitizeJSON($str) {
return "";
}

/**
* @psalm-taint-specialize
*/
public static function sanitizeREDCapData($data) {
$data = self::sanitizeArray($data, FALSE);
for ($i = 0; $i < count($data); $i++) {
Expand All @@ -40,6 +46,9 @@ public static function sanitizeInteger($int) {
}
}

/**
* @psalm-taint-specialize
*/
public static function sanitizeURL($url) {
$url = filter_var($url, FILTER_SANITIZE_URL);
$url = self::sanitize($url);
Expand All @@ -54,12 +63,18 @@ public static function sanitizeURL($url) {
}
}

/**
* @psalm-taint-specialize
*/
public static function sanitizePid($pid) {
$pid = filter_var($pid, FILTER_VALIDATE_INT);
$pid = self::sanitize($pid);
return $pid;
}

/**
* @psalm-taint-specialize
*/
private static function sanitizeRecursive($datum) {
if (is_array($datum)) {
$newData = [];
Expand All @@ -73,6 +88,9 @@ private static function sanitizeRecursive($datum) {
}
}

/**
* @psalm-taint-specialize
*/
public static function sanitizeDate($date) {
$date = self::sanitize($date);
if (DateManagement::isDate($date)) {
Expand All @@ -82,6 +100,9 @@ public static function sanitizeDate($date) {
}
}

/**
* @psalm-taint-specialize
*/
public static function sanitizeWithoutChangingQuotes($str) {
if (is_numeric($str)) {
$str = (string) $str;
Expand Down Expand Up @@ -132,6 +153,9 @@ public static function sanitizeArray($ary, $stripHTML = TRUE) {
}
}

/**
* @psalm-taint-specialize
*/
public static function sanitizeWithoutStrippingHTML($str, $encodeQuotes = TRUE) {
/**
* @psalm-taint-escape html
Expand All @@ -145,10 +169,16 @@ public static function sanitizeWithoutStrippingHTML($str, $encodeQuotes = TRUE)
return $str;
}

/**
* @psalm-taint-specialize
*/
public static function sanitizeCohort($cohortName) {
return Cohorts::sanitize($cohortName);
}

/**
* @psalm-taint-specialize
*/
public static function sanitize($origStr) {
if (REDCapManagement::isValidToken($origStr)) {
$module = Application::getModule();
Expand All @@ -174,6 +204,9 @@ public static function sanitize($origStr) {
}

# requestedRecord is from GET/POST
/**
* @psalm-taint-specialize
*/
public static function getSanitizedRecord($requestedRecord, $records) {
foreach ($records as $r) {
if ($r == $requestedRecord) {
Expand Down

0 comments on commit be4ea2b

Please sign in to comment.