code
stringlengths 14
2.05k
| label
int64 0
1
| programming_language
stringclasses 7
values | cwe_id
stringlengths 6
14
| cwe_name
stringlengths 5
98
⌀ | description
stringlengths 36
379
⌀ | url
stringlengths 36
48
⌀ | label_name
stringclasses 2
values |
---|---|---|---|---|---|---|---|
function comment_clean(&$arr) {
$arr ['name'] = apply_filters('pre_comment_author_name', stripslashes($arr ['name']));
if (isset($arr ['email']))
$arr ['email'] = apply_filters('pre_comment_author_email', $arr ['email']);
if (isset($arr ['url']))
$arr ['url'] = apply_filters('pre_comment_author_url', $arr ['url']);
$arr ['content'] = apply_filters('pre_comment_content', $arr ['content']);
return $arr;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function onsave() {
global $fp_config;
$l = explode(',', $_POST ['lang']);
$fp_config ['general'] = array(
// 'BLOG_ROOT' => $_POST['blog_root'],
'www' => $_POST ['www'],
'title' => wp_specialchars(stripslashes($_POST ['title'])),
'subtitle' => wp_specialchars(stripslashes($_POST ['subtitle'])),
'footer' => wp_specialchars(stripslashes($_POST ['blogfooter'])),
'author' => $_POST ['author'],
'email' => $_POST ['email'],
'startpage' => ($_POST ['startpage'] == ':NULL:') ? null : $_POST ['startpage'],
'maxentries' => $_POST ['maxentries'],
// 'voting' => $_POST['voting'],
'notify' => isset($_POST ['notify']),
/* preserve the following */
'theme' => $fp_config ['general'] ['theme'],
'style' => @$fp_config ['general'] ['style'],
'blogid' => $fp_config ['general'] ['blogid'],
'charset' => 'utf-8'
);
$fp_config ['locale'] = array(
'timeoffset' => $_POST ['timeoffset'],
'timeformat' => $_POST ['timeformat'],
'dateformat' => $_POST ['dateformat'],
'dateformatshort' => $_POST ['dateformatshort'],
'charset' => $_POST ['charset'],
'lang' => $_POST ['lang']
);
// 'LANG' => $l[0],
// 'CHARSET'=> $l[1],
$success = config_save() ? 1 : -1;
$this->smarty->assign('success', $success);
return 1;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function UploadAssignmentTeacherFile( $assignment_id, $teacher_id, $file_input_id )
{
global $error;
$assignment = GetAssignment( $assignment_id );
if ( ! $assignment )
{
return '';
}
$microseconds = new \DateTime();
// @since 9.0 Add microseconds to filename format to make it harder to predict.
$microseconds = $microseconds->format( 'u' );
// Filename = [course_title]_[assignment_ID].ext.
$file_name_no_ext = no_accents( $assignment['COURSE_TITLE'] . '_' . $assignment_id . '.' . $microseconds );
if ( ! empty( $assignment['FILE'] )
&& file_exists( $assignment['FILE'] ) )
{
// Delete existing Assignment File.
unlink( $assignment['FILE'] );
}
$assignments_path = GetAssignmentsFilesPath( User( 'STAFF_ID' ) );
// Upload file to AssignmentsFiles/[School_Year]/Teacher[teacher_ID]/Quarter[1,2,3,4...]/.
$file = FileUpload(
$file_input_id,
$assignments_path,
FileExtensionWhiteList(),
0,
$error,
'',
$file_name_no_ext
);
return $file;
} | 0 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
function _saveSalariesFile( $id )
{
global $error,
$FileUploadsPath;
$input = $id === 'new' ? 'FILE_ATTACHED' : 'FILE_ATTACHED_' . $id;
if ( ! isset( $_FILES[ $input ] ) )
{
return '';
}
$file_name_no_ext = no_accents( mb_substr(
$_FILES[ $input ]['name'],
0,
mb_strrpos( $_FILES[ $input ]['name'], '.' )
) );
$file_name_no_ext .= '_' . date( 'Y-m-d_His' );
$file_attached = FileUpload(
$input,
$FileUploadsPath . UserSyear() . '/staff_' . UserStaffID() . '/',
FileExtensionWhiteList(),
0,
$error,
'',
$file_name_no_ext
);
// Fix SQL error when quote in uploaded file name.
return DBEscapeString( $file_attached );
} | 0 | PHP | CWE-922 | Insecure Storage of Sensitive Information | The product stores sensitive information without properly limiting read or write access by unauthorized actors. | https://cwe.mitre.org/data/definitions/922.html | vulnerable |
function _saveFeesFile( $id )
{
global $error,
$FileUploadsPath;
$input = $id === 'new' ? 'FILE_ATTACHED' : 'FILE_ATTACHED_' . $id;
if ( ! isset( $_FILES[ $input ] ) )
{
return '';
}
$file_name_no_ext = no_accents( mb_substr(
$_FILES[ $input ]['name'],
0,
mb_strrpos( $_FILES[ $input ]['name'], '.' )
) );
$file_name_no_ext .= '_' . date( 'Y-m-d_His' );
$file_attached = FileUpload(
$input,
$FileUploadsPath . UserSyear() . '/student_' . UserStudentID() . '/',
FileExtensionWhiteList(),
0,
$error,
'',
$file_name_no_ext
);
// Fix SQL error when quote in uploaded file name.
return DBEscapeString( $file_attached );
} | 0 | PHP | CWE-922 | Insecure Storage of Sensitive Information | The product stores sensitive information without properly limiting read or write access by unauthorized actors. | https://cwe.mitre.org/data/definitions/922.html | vulnerable |
public function getAttributes(\SugarBean $bean, $fields = null)
{
$bean->fixUpFormatting();
// using the ISO 8601 format for dates
$attributes = array_map(function ($value) {
return is_string($value)
? (\DateTime::createFromFormat('Y-m-d H:i:s', $value)
? date(\DateTime::ATOM, strtotime($value))
: $value)
: $value;
}, $bean->toArray());
if ($fields !== null) {
$attributes = array_intersect_key($attributes, array_flip($fields));
}
unset($attributes['id']);
return new AttributeResponse($attributes);
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
$dataArrayValuesQuotedImplode = implode(', ', array_values($data));
$insert_query .= " VALUES (" . $dataArrayValuesQuotedImplode . ")";
$db->query($insert_query);
}
} else { | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public function getDuplicateQuery($focus, $prefix='')
{
$query = 'SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.title FROM contacts ';
// Bug #46427 : Records from other Teams shown on Potential Duplicate Contacts screen during Lead Conversion
// add team security
$query .= ' where contacts.deleted = 0 AND ';
if (isset($_POST[$prefix.'first_name']) && strlen($_POST[$prefix.'first_name']) != 0 && isset($_POST[$prefix.'last_name']) && strlen($_POST[$prefix.'last_name']) != 0) {
$query .= " contacts.first_name LIKE '". $_POST[$prefix.'first_name'] . "%' AND contacts.last_name = '". $_POST[$prefix.'last_name'] ."'";
} else {
$query .= " contacts.last_name = '". $_POST[$prefix.'last_name'] ."'";
}
if (!empty($_POST[$prefix.'record'])) {
$query .= " AND contacts.id != '". $_POST[$prefix.'record'] ."'";
}
return $query;
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public function getDuplicateQuery($focus, $prefix='')
{
$query = "SELECT id, first_name, last_name, account_name, title FROM leads ";
// Bug #46427 : Records from other Teams shown on Potential Duplicate Contacts screen during Lead Conversion
// add team security
$query .= " WHERE deleted != 1 AND (status <> 'Converted' OR status IS NULL) AND ";
//Use the first and last name from the $_POST to filter. If only last name supplied use that
if (isset($_POST[$prefix.'first_name']) && strlen($_POST[$prefix.'first_name']) != 0 && isset($_POST[$prefix.'last_name']) && strlen($_POST[$prefix.'last_name']) != 0) {
$query .= " (first_name='". $_POST[$prefix.'first_name'] . "' AND last_name = '". $_POST[$prefix.'last_name'] ."')";
} else {
$query .= " last_name = '". $_POST[$prefix.'last_name'] ."'";
}
return $query;
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public function checkForDuplicates($prefix)
{
global $local_log;
require_once('include/formbase.php');
$focus = BeanFactory::newBean('Prospects');
if (!checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
$query = '';
$baseQuery = 'select id,first_name, last_name, title, email1, email2 from prospects where deleted!=1 and (';
if (!empty($_POST[$prefix.'first_name']) && !empty($_POST[$prefix.'last_name'])) {
$query = $baseQuery ." (first_name like '". $_POST[$prefix.'first_name'] . "%' and last_name = '". $_POST[$prefix.'last_name'] ."')";
} else {
$query = $baseQuery ." last_name = '". $_POST[$prefix.'last_name'] ."'";
}
if (!empty($_POST[$prefix.'email1'])) {
if (empty($query)) {
$query = $baseQuery. " email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'";
} else {
$query .= "or email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'";
}
}
if (!empty($_POST[$prefix.'email2'])) {
if (empty($query)) {
$query = $baseQuery. " email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'";
} else {
$query .= "or email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'";
}
}
if (!empty($query)) {
$rows = array();
$db = DBManagerFactory::getInstance();
$result = $db->query($query.');');
while ($row = $db->fetchByAssoc($result)) {
$rows[] = $row;
}
if (count($rows) > 0) {
return $rows;
}
}
return null;
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public static function stripTags($dirtyHtml, $isEncoded = true)
{
if ($isEncoded) {
$dirtyHtml = from_html($dirtyHtml);
}
$dirtyHtml = filter_var($dirtyHtml, FILTER_SANITIZE_STRIPPED, FILTER_FLAG_NO_ENCODE_QUOTES);
return $isEncoded ? to_html($dirtyHtml) : $dirtyHtml;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);
// Re-encode html
if ($removeHtml === true) {
// remove all HTML tags
$sugarCleaner = self::getInstance();
$purifier = $sugarCleaner->purifier;
$clean_html = $purifier->purify($dirty_html_decoded);
} else {
// encode all HTML tags
$clean_html = $dirty_html_decoded;
}
return $clean_html;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
LoggerManager::getLogger()->fatal('Specified directory for zip file extraction does not exist');
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
$zip = new ZipArchive;
// We need realpath here for PHP streams support
$res = $zip->open(UploadFile::realpath($zip_archive));
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
if ($archive_file !== null) {
$res = $zip->extractTo(UploadFile::realpath($zip_dir), $archive_file);
if ((new SplFileInfo($archive_file))->getExtension() == 'php') {
SugarCache::cleanFile(UploadFile::realpath($zip_dir).'/'.$archive_file);
}
} else {
$res = $zip->extractTo(UploadFile::realpath($zip_dir));
SugarCache::cleanDir(UploadFile::realpath($zip_dir));
}
if ($res !== true) {
LoggerManager::getLogger()->fatal(sprintf('ZIP Error(%d): Status(%s)', $res, $zip->status));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
return false;
}
}
return true;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public function cleanBean()
{
parent::cleanBean();
$this->pdfheader = purify_html($this->pdfheader);
$this->description = purify_html($this->description);
$this->pdffooter = purify_html($this->pdffooter);
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
$strArr[] = array('str' => $tmpStr, 'sort_order' => $sortOrder);
}
usort(
$strArr,
function ($a, $b) {
return $a['sort_order'] - $b['sort_order'];
}
);
foreach ($strArr as $bits) {
$str .= $bits['str'];
}
$str .= '</dl>';
return $str;
case "DateTime":
return $responseArr[0]->answer_datetime;
case "Date":
$date = $timedate->fromUser($responseArr[0]->answer_datetime);
if (!$date) {
return $responseArr[0]->answer_datetime;
} else {
$date = $timedate->tzGMT($date);
return $timedate->asUserDate($date);
}
// no break
case "Rating":
return str_repeat('<img width=20 src="modules/Surveys/imgs/star.png"/>', $responseArr[0]->answer);
case "Scale":
return $responseArr[0]->answer . '/10';
case "Textbox":
case "Text":
default:
return $responseArr[0]->answer;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public function getMarkerDataCustom($marker_object)
{
// Define Marker
$marker = array();
$marker['name'] = $marker_object->name;
if (empty($marker['name'])) {
$marker['name'] = 'N/A';
}
$marker['id'] = $marker_object->id;
$marker['lat'] = $marker_object->jjwg_maps_lat;
if (!$this->is_valid_lat($marker['lat'])) {
$marker['lat'] = '0';
}
$marker['lng'] = $marker_object->jjwg_maps_lng;
if (!$this->is_valid_lng($marker['lng'])) {
$marker['lng'] = '0';
}
$marker['image'] = $marker_object->marker_image;
if (empty($marker['image'])) {
$marker['image'] = 'None';
}
if ($marker['lat'] != '0' || $marker['lng'] != '0') {
$fields = array();
foreach ($marker_object->column_fields as $field) {
$fields[$field] = $marker_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Markers');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
if (empty($marker['html'])) {
$marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Markers/tpls/MarkersInfoWindow.tpl');
}
$marker['html'] = preg_replace('/\n\r/', ' ', (string) $marker['html']);
//var_dump($marker['html']);
return $marker;
} else {
return false;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
public function getAreaDataCustom($area_object)
{
// Define Area
$area = array();
$area['name'] = $area_object->name;
if (empty($area['name'])) {
$area['name'] = 'N/A';
}
$area['id'] = $area_object->id;
$area['coordinates'] = $area_object->coordinates;
// Check for proper coordinates pattern
if (preg_match('/^[0-9\s\(\)\,\.\-]+$/', (string) $area_object->coordinates)) {
$fields = array();
foreach ($area_object->column_fields as $field) {
$fields[$field] = $area_object->$field;
}
// Define Maps Info Window HTML by Sugar Smarty Template
$this->sugarSmarty->assign("module_type", 'jjwg_Areas');
$this->sugarSmarty->assign("fields", $fields); // display fields array
// Use @ error suppression to avoid issues with SugarCRM On-Demand
$area['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
if (empty($area['html'])) {
$area['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Areas/tpls/AreasInfoWindow.tpl');
}
$area['html'] = preg_replace('/\n\r/', ' ', (string) $area['html']);
//var_dump($marker['html']);
return $area;
} else {
return false;
}
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
function getMimeType() {
if (!isset($this->_mimetype)) {
// Try to to auto-detect mime type
$finfo = new finfo(FILEINFO_MIME);
$this->_mimetype = $finfo->buffer($this->getContents(),
FILEINFO_MIME_TYPE);
}
return $this->_mimetype;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function getAdvancedSearchDialog($key=false, $context='advsearch') {
global $thisstaff;
if (!$thisstaff)
Http::response(403, 'Agent login required');
$search = new AdhocSearch(array(
'root' => 'T',
'staff_id' => $thisstaff->getId(),
'parent_id' => @$_GET['parent_id'] ?: 0,
));
if ($search->parent_id) {
$search->flags |= SavedSearch::FLAG_INHERIT_COLUMNS;
}
if (isset($_SESSION[$context]) && $key && $_SESSION[$context][$key])
$search->config = $_SESSION[$context][$key];
$this->_tryAgain($search);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function createSearch() {
global $thisstaff;
if (!$thisstaff)
Http::response(403, 'Agent login is required');
$search = SavedSearch::create(array(
'title' => __('Add Queue'),
'root' => 'T',
'staff_id' => $thisstaff->getId(),
'parent_id' => $_GET['pid'],
));
$this->_tryAgain($search);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$matched[] = array('name' => Format::htmlchars($name), 'info' => $name,
'id' => $id, '/bin/true' => $_REQUEST['q']); | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function update($vars, &$errors) {
if (!$vars['name'])
$errors['name'] = __('Name required');
elseif (($r=Role::lookup(array('name'=>$vars['name'])))
&& $r->getId() != $vars['id'])
$errors['name'] = __('Name already in use');
elseif (!$vars['perms'] || !count($vars['perms']))
$errors['err'] = __('Must check at least one permission for the role');
if ($errors)
return false;
$this->name = $vars['name'];
$this->notes = $vars['notes'];
$this->updatePerms($vars['perms'], $errors);
if (!$this->save(true))
return false;
return true;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
static function get_path_info() {
if(isset($_SERVER['PATH_INFO']))
return $_SERVER['PATH_INFO'];
if(isset($_SERVER['ORIG_PATH_INFO']))
return $_SERVER['ORIG_PATH_INFO'];
//TODO: conruct possible path info.
return null;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function create_item( $request ) {
/**
* Original post ID.
*
* @var int $original_id
*/
$original_id = ! empty( $request['original_id'] ) ? $request['original_id'] : null;
if ( ! $original_id ) {
return parent::create_item( $request );
}
$original_post = $this->get_post( $original_id );
if ( is_wp_error( $original_post ) ) {
return $original_post;
}
if ( ! $this->check_read_permission( $original_post ) ) {
return new \WP_Error(
'rest_cannot_create',
__( 'Sorry, you are not allowed to duplicate this story.', 'web-stories' ),
[ 'status' => rest_authorization_required_code() ]
);
}
$request->set_param( 'content', $original_post->post_content );
$request->set_param( 'excerpt', $original_post->post_excerpt );
$title = sprintf(
/* translators: %s: story title. */
__( '%s (Copy)', 'web-stories' ),
$original_post->post_title
);
$request->set_param( 'title', $title );
$story_data = json_decode( $original_post->post_content_filtered, true );
if ( $story_data ) {
$request->set_param( 'story_data', $story_data );
}
$thumbnail_id = get_post_thumbnail_id( $original_post );
if ( $thumbnail_id ) {
$request->set_param( 'featured_media', $thumbnail_id );
}
$meta = $this->get_registered_meta( $original_post );
if ( $meta ) {
$request->set_param( 'meta', $meta );
}
return parent::create_item( $request );
} | 0 | PHP | CWE-863 | Incorrect Authorization | The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
public function __construct(
private readonly EntityManagerInterface $em,
private readonly Adapters $adapters
) {
} | 0 | PHP | CWE-307 | Improper Restriction of Excessive Authentication Attempts | The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame, making it more susceptible to brute force attacks. | https://cwe.mitre.org/data/definitions/307.html | vulnerable |
public function __construct(
private readonly StationRequestRepository $requestRepo
) {
} | 0 | PHP | CWE-307 | Improper Restriction of Excessive Authentication Attempts | The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame, making it more susceptible to brute force attacks. | https://cwe.mitre.org/data/definitions/307.html | vulnerable |
function debugInfo() {
if (function_exists('getallheaders')) {
$ALL_HEADERS = getallheaders();
} else { //nginx http://php.net/getallheaders#84262
$ALL_HEADERS = array();
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) === 'HTTP_') {
$ALL_HEADERS[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
}
global $ORIGINAL_INPUT;
return print_r(
array(
'date' => date('c'),
'headers' => $ALL_HEADERS,
'_SERVER' => $_SERVER,
'_GET' => $_GET,
'_POST' => $_POST,
'_COOKIE' => $_COOKIE,
'INPUT' => $ORIGINAL_INPUT
), true);
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function badRequest() {
Minz_Log::warning('badRequest() ' . debugInfo(), API_LOG);
header('HTTP/1.1 400 Bad Request');
header('Content-Type: text/plain; charset=UTF-8');
die('Bad Request!');
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function serviceUnavailable() {
Minz_Log::warning('serviceUnavailable() ' . debugInfo(), API_LOG);
header('HTTP/1.1 503 Service Unavailable');
header('Content-Type: text/plain; charset=UTF-8');
die('Service Unavailable!');
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function checkCompatibility() {
Minz_Log::warning('checkCompatibility() ' . debugInfo(), API_LOG);
header('Content-Type: text/plain; charset=UTF-8');
if (PHP_INT_SIZE < 8 && !function_exists('gmp_init')) {
die('FAIL 64-bit or GMP extension! Wrong PHP configuration.');
}
$headerAuth = headerVariable('Authorization', 'GoogleLogin_auth');
if ($headerAuth == '') {
die('FAIL get HTTP Authorization header! Wrong Web server configuration.');
}
echo 'PASS';
exit();
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function unauthorized() {
Minz_Log::warning('unauthorized() ' . debugInfo(), API_LOG);
header('HTTP/1.1 401 Unauthorized');
header('Content-Type: text/plain; charset=UTF-8');
header('Google-Bad-Token: true');
die('Unauthorized!');
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function authorizationToUser() {
//Input is 'GoogleLogin auth', but PHP replaces spaces by '_' http://php.net/language.variables.external
$headerAuth = headerVariable('Authorization', 'GoogleLogin_auth');
if ($headerAuth != '') {
$headerAuthX = explode('/', $headerAuth, 2);
if (count($headerAuthX) === 2) {
$user = $headerAuthX[0];
if (FreshRSS_user_Controller::checkUsername($user)) {
FreshRSS_Context::initUser($user);
if (FreshRSS_Context::$user_conf == null) {
Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.');
unauthorized();
}
if (!FreshRSS_Context::$user_conf->enabled) {
Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.');
unauthorized();
}
if ($headerAuthX[1] === sha1(FreshRSS_Context::$system_conf->salt . $user . FreshRSS_Context::$user_conf->apiPasswordHash)) {
return $user;
} else {
Minz_Log::warning('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1], API_LOG);
Minz_Log::warning('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1]);
unauthorized();
}
} else {
badRequest();
}
}
}
return '';
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function debugInfo() {
if (function_exists('getallheaders')) {
$ALL_HEADERS = getallheaders();
} else { //nginx http://php.net/getallheaders#84262
$ALL_HEADERS = array();
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) === 'HTTP_') {
$ALL_HEADERS[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
}
global $ORIGINAL_INPUT;
return print_r(
array(
'date' => date('c'),
'headers' => $ALL_HEADERS,
'_SERVER' => $_SERVER,
'_GET' => $_GET,
'_POST' => $_POST,
'_COOKIE' => $_COOKIE,
'INPUT' => $ORIGINAL_INPUT
), true);
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
function notImplemented() {
Minz_Log::warning('notImplemented() ' . debugInfo(), API_LOG);
header('HTTP/1.1 501 Not Implemented');
header('Content-Type: text/plain; charset=UTF-8');
die('Not Implemented!');
} | 0 | PHP | CWE-532 | Insertion of Sensitive Information into Log File | Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information. | https://cwe.mitre.org/data/definitions/532.html | vulnerable |
$encodedImage = $this->imageManager->make($file->getStream())->heighten(60, function ($constraint) {
$constraint->upsize();
})->encode('png'); | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
protected function assertFileMimes(UploadedFileInterface $file)
{
$allowedTypes = $this->getAllowedTypes();
// Block PHP files masquerading as images
$phpExtensions = ['php', 'php3', 'php4', 'php5', 'phtml'];
$fileExtension = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
if (in_array(trim(strtolower($fileExtension)), $phpExtensions)) {
$this->raise('mimes', [':values' => implode(', ', $allowedTypes)]);
}
$guessedExtension = MimeTypes::getDefault()->getExtensions($file->getClientMediaType())[0] ?? null;
if (! in_array($guessedExtension, $allowedTypes)) {
$this->raise('mimes', [':values' => implode(', ', $allowedTypes)]);
}
try {
$this->imageManager->make($file->getStream());
} catch (NotReadableException $_e) {
$this->raise('image');
}
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function handle(UploadAvatar $command)
{
$actor = $command->actor;
$user = $this->users->findOrFail($command->userId);
if ($actor->id !== $user->id) {
$actor->assertCan('edit', $user);
}
$this->validator->assertValid(['avatar' => $command->file]);
$image = $this->imageManager->make($command->file->getStream());
$this->events->dispatch(
new AvatarSaving($user, $actor, $image)
);
$this->uploader->upload($user, $image);
$user->save();
$this->dispatchEventsFor($user, $actor);
return $user;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
foreach ($printColumns as $field => $label) {
$value = $gridFieldColumnsComponent
? strip_tags($gridFieldColumnsComponent->getColumnContent($gridField, $item, $field))
: $gridField->getDataFieldValue($item, $field);
$itemRow->push(new ArrayData([
"CellString" => $value,
]));
} | 0 | PHP | CWE-862 | Missing Authorization | The product does not perform an authorization check when an actor attempts to access a resource or perform an action. | https://cwe.mitre.org/data/definitions/862.html | vulnerable |
public function testLimit()
{
$list = TestObject::get();
$button = new GridFieldPrintButton();
$button->setPrintColumns(['Name' => 'My Name']);
// Get paginated gridfield config
$config = GridFieldConfig::create()
->addComponent(new GridFieldPaginator(10))
->addComponent($button);
$gridField = new GridField('testfield', 'testfield', $list, $config);
/** @skipUpgrade */
new Form(Controller::curr(), 'Form', new FieldList($gridField), new FieldList());
// Printed data should ignore pagination limit
$printData = $button->generatePrintData($gridField);
$rows = $printData->ItemRows;
$this->assertEquals(42, $rows->count());
} | 0 | PHP | CWE-862 | Missing Authorization | The product does not perform an authorization check when an actor attempts to access a resource or perform an action. | https://cwe.mitre.org/data/definitions/862.html | vulnerable |
public static function is_absolute_url($url)
{
// Strip off the query and fragment parts of the URL before checking
if (($queryPosition = strpos($url ?? '', '?')) !== false) {
$url = substr($url ?? '', 0, $queryPosition - 1);
}
if (($hashPosition = strpos($url ?? '', '#')) !== false) {
$url = substr($url ?? '', 0, $hashPosition - 1);
}
$colonPosition = strpos($url ?? '', ':');
$slashPosition = strpos($url ?? '', '/');
return (
// Base check for existence of a host on a compliant URL
parse_url($url ?? '', PHP_URL_HOST)
// Check for more than one leading slash without a protocol.
// While not a RFC compliant absolute URL, it is completed to a valid URL by some browsers,
// and hence a potential security risk. Single leading slashes are not an issue though.
|| preg_match('%^\s*/{2,}%', $url ?? '')
|| (
// If a colon is found, check if it's part of a valid scheme definition
// (meaning its not preceded by a slash).
$colonPosition !== false
&& ($slashPosition === false || $colonPosition < $slashPosition)
)
);
} | 0 | PHP | CWE-601 | URL Redirection to Untrusted Site ('Open Redirect') | A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks. | https://cwe.mitre.org/data/definitions/601.html | vulnerable |
public function testIsSiteUrl()
{
$this->assertFalse(Director::is_site_url("http://test.com"));
$this->assertTrue(Director::is_site_url(Director::absoluteBaseURL()));
$this->assertFalse(Director::is_site_url("http://test.com?url=" . Director::absoluteBaseURL()));
$this->assertFalse(Director::is_site_url("http://test.com?url=" . urlencode(Director::absoluteBaseURL() ?? '')));
$this->assertFalse(Director::is_site_url("//test.com?url=" . Director::absoluteBaseURL()));
$this->assertFalse(Director::is_site_url('http://google.com\@test.com'));
$this->assertFalse(Director::is_site_url('http://google.com/@test.com'));
$this->assertFalse(Director::is_site_url('http://google.com:pass\@test.com'));
$this->assertFalse(Director::is_site_url('http://google.com:pass/@test.com'));
} | 0 | PHP | CWE-601 | URL Redirection to Untrusted Site ('Open Redirect') | A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks. | https://cwe.mitre.org/data/definitions/601.html | vulnerable |
$cookieOrder = $this->_loadOrderByCookie($cookie);
if (!is_null($cookieOrder)) {
if (is_null($cookieOrder->getCustomerId())) {
$cookieModel->renew($this->_cookieName, $this->_lifeTime, '/');
$order = $cookieOrder;
} else {
$errorMessage = 'Please log in to view your order details.';
$errors = true;
}
} else {
$errors = true;
}
}
if (!$errors && $order->getId()) {
Mage::register('current_order', $order);
return true;
}
Mage::getSingleton('core/session')->addError($this->__($errorMessage));
Mage::app()->getResponse()->setRedirect(Mage::getUrl('sales/guest/form'));
return false;
} | 0 | PHP | CWE-330 | Use of Insufficiently Random Values | The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. | https://cwe.mitre.org/data/definitions/330.html | vulnerable |
$parent = $item->getQuoteParentItemId();
if ($parent && !$item->getParentItem()) {
$item->setParentItem($this->getItemByQuoteItemId($parent));
} elseif (!$parent) {
$itemsCount++;
}
}
// Set items count
$this->setTotalItemCount($itemsCount);
}
if ($this->getCustomer()) {
$this->setCustomerId($this->getCustomer()->getId());
}
if ($this->hasBillingAddressId() && $this->getBillingAddressId() === null) {
$this->unsBillingAddressId();
}
if ($this->hasShippingAddressId() && $this->getShippingAddressId() === null) {
$this->unsShippingAddressId();
}
if (!$this->getId()) {
$this->setData('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6));
}
if ($this->getStatus() !== $this->getOrigData('status')) {
Mage::dispatchEvent('order_status_changed_before_save', ['order' => $this]);
}
return $this;
} | 0 | PHP | CWE-330 | Use of Insufficiently Random Values | The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. | https://cwe.mitre.org/data/definitions/330.html | vulnerable |
public function __construct(OtherSemanticTooltipEntryFetcher ...$other_semantic_tooltip_entry_fetchers)
{
$this->other_semantic_tooltip_entry_fetchers = $other_semantic_tooltip_entry_fetchers;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function __construct(GitRepository $repository, $url, array $hooklogs, CSRFSynchronizerToken $csrf)
{
$use_default_edit_modal = false;
parent::__construct($repository, 'jenkins', $url, [], $csrf, $use_default_edit_modal);
$this->remove_form_action = '/plugins/hudson_git/?group_id=' . (int) $repository->getProjectId(); | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$purfied_job_url = $hp->purify($triggered_job_url);
$purified_information .= '<a href="' . $purfied_job_url . '">' . $purfied_job_url . '</a><br>';
}
$purified_information .= '</div>';
}
if ($log->getStatusCode() !== null) {
$purified_information .= '<div class="hook-log-branch-source-status">';
$purified_information .= '<h4>' . dgettext("tuleap-hudson_git", "Branch source plugin:") . '</h4>';
$purified_information .= $log->getStatusCode();
$purified_information .= '</div>';
}
$this->hooklogs[] = new WebhookLogPresenter($log->getFormattedPushDate(), $purified_information);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function plugin_git_settings_additional_webhooks(array $params) //phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
{
if ($this->isAllowed($params['repository']->getProjectId())) {
$xzibit = new GitWebhooksSettingsEnhancer(
new Hook\HookDao(),
new LogFactory(
new JobDao(),
new ProjectJobDao(),
new GitRepositoryFactory(
new GitDao(),
ProjectManager::instance()
)
),
$this->getCSRF(),
self::getJenkinsServerFactory()
);
$xzibit->pimp($params);
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function getUserRemover()
{
return new UserRemover(
ProjectManager::instance(),
EventManager::instance(),
new ArtifactTypeFactory(false),
new UserRemoverDao(),
UserManager::instance(),
new ProjectHistoryDao(),
new UGroupManager()
);
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
private function getUserRemover()
{
return new UserRemover(
ProjectManager::instance(),
EventManager::instance(),
new ArtifactTypeFactory(false),
new UserRemoverDao(),
UserManager::instance(),
new ProjectHistoryDao(),
new UGroupManager()
);
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
public static function areRestrictedUsersAllowed()
{
return self::get(ForgeAccess::CONFIG) === ForgeAccess::RESTRICTED;
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
private function updateProjectVisibility(PFUser $user, Project $project, HTTPRequest $request)
{
if ($this->project_visibility_configuration->canUserConfigureProjectVisibility($user, $project)) {
if ($project->getAccess() !== $request->get('project_visibility')) {
if ($request->get('term_of_service')) {
$this->project_manager->setAccess($project, $request->get('project_visibility'));
$this->project_manager->clear($project->getID());
$this->ugroup_binding->reloadUgroupBindingInProject($project);
} else {
$GLOBALS['Response']->addFeedback(Feedback::ERROR, _("Please accept term of service"));
}
}
}
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
public function __construct(
BaseLanguage $language,
$platform_allows_restricted,
$project_visibility,
int $number_of_restricted_users_in_project,
ProjectVisibilityOptionsForPresenterGenerator $project_visibility_options_generator,
) {
$this->platform_allows_restricted = (bool) $platform_allows_restricted;
$this->restricted_warning_message = $language->getText(
'project_admin_editgroupinfo',
'restricted_warning'
);
$this->general_warning_message = $language->getText(
'project_admin_editgroupinfo',
'general_warning'
);
$this->purified_term_of_service_message = Codendi_HTMLPurifier::instance()->purify(
$language->getOverridableText('project_admin_editgroupinfo', 'term_of_service'),
CODENDI_PURIFIER_LIGHT
);
$this->project_visibility_label = _('Project visibility');
$this->accept_tos_message = _("Please accept term of service");
$this->options = $project_visibility_options_generator->generateVisibilityOptions(
$this->platform_allows_restricted,
$project_visibility
);
$this->number_of_restricted_users_in_project = $number_of_restricted_users_in_project;
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
public function getAdmins(?UGroupManager $ugm = null)
{
if (is_null($ugm)) {
$ugm = $this->getUGroupManager();
}
return $ugm->getDynamicUGroupsMembers(ProjectUGroup::PROJECT_ADMIN, $this->getID());
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
public function __construct(
string $project_default_visibility,
array $trove_categories,
array $field_list,
array $company_templates,
array $tuleap_templates,
array $external_templates,
) {
$this->tuleap_templates = json_encode($tuleap_templates);
$this->are_restricted_users_allowed = (bool) ForgeConfig::areRestrictedUsersAllowed();
$this->project_default_visibility = $project_default_visibility;
$this->projects_must_be_approved = (bool) ForgeConfig::get(
ProjectManager::CONFIG_PROJECT_APPROVAL,
true
);
$this->trove_categories = json_encode($trove_categories, JSON_THROW_ON_ERROR);
$this->is_description_mandatory = ProjectDescriptionUsageRetriever::isDescriptionMandatory();
$this->field_list = json_encode($field_list);
$this->company_templates = json_encode($company_templates);
$this->company_name = ForgeConfig::get('sys_org_name');
$this->can_user_choose_privacy = (bool) ForgeConfig::get(
ProjectManager::SYS_USER_CAN_CHOOSE_PROJECT_PRIVACY
);
$this->external_templates = json_encode($external_templates);
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
private function getUserRemover()
{
return new UserRemover(
ProjectManager::instance(),
$this->getEventManager(),
new ArtifactTypeFactory(false),
new UserRemoverDao(),
UserManager::instance(),
new ProjectHistoryDao(),
new UGroupManager()
);
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
public function removeUserFromProject($project_id, $user_id, $admin_action = true)
{
$project = $this->getProject($project_id);
if (! $this->dao->removeUserFromProject($project_id, $user_id)) {
$GLOBALS['Response']->addFeedback(
Feedback::ERROR,
$GLOBALS['Language']->getText('project_admin_index', 'user_not_removed')
);
return false;
}
$this->event_manager->processEvent('project_admin_remove_user', [
'group_id' => $project_id,
'user_id' => $user_id,
]);
$this->removeUserFromTrackerV3($project_id, $user_id);
if (! $this->removeUserFromProjectUgroups($project, $user_id)) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'del_user_from_ug_fail'));
}
$user_name = $this->getUserName($user_id);
$this->displayFeedback($project, $user_name, $admin_action);
$this->project_history_dao->groupAddHistory(
'removed_user',
$user_name . " ($user_id)",
$project_id
);
return true;
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
public function removeUserFromProject($project_id, $user_id)
{
$project_id = $this->da->escapeInt($project_id);
$user_id = $this->da->escapeInt($user_id);
$admin_flag = $this->da->quoteSmart('A');
$sql = "DELETE FROM user_group
WHERE group_id = $project_id
AND user_id = $user_id
AND admin_flags <> $admin_flag";
return $this->update($sql);
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
$ugroup_with_restricted->shouldReceive('removeUser')->with(
$restricted_user_in_ugroup_only,
\Mockery::on(
function (PFUser $user) {
return (int) $user->getId() === 0;
} | 0 | PHP | CWE-281 | Improper Preservation of Permissions | The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended. | https://cwe.mitre.org/data/definitions/281.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.