Issues (106)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

Classes/Hooks/T3libTceMain.php (4 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace AOE\Languagevisibility\Hooks;
4
5
/***************************************************************
6
 *  Copyright notice
7
 *
8
 *  (c) 2014 AOE GmbH <[email protected]>
9
 *
10
 *  All rights reserved
11
 *
12
 *  This script is part of the TYPO3 project. The TYPO3 project is
13
 *  free software; you can redistribute it and/or modify
14
 *  it under the terms of the GNU General Public License as published by
15
 *  the Free Software Foundation; either version 3 of the License, or
16
 *  (at your option) any later version.
17
 *
18
 *  The GNU General Public License can be found at
19
 *  http://www.gnu.org/copyleft/gpl.html.
20
 *
21
 *  This script is distributed in the hope that it will be useful,
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 *  GNU General Public License for more details.
25
 *
26
 *  This copyright notice MUST APPEAR in all copies of the script!
27
 ***************************************************************/
28
29
use AOE\Languagevisibility\CacheManager;
30
use AOE\Languagevisibility\Services\BeServices;
31
use AOE\Languagevisibility\Services\VisibilityService;
32
33
/**
34
 * Class T3libTceMain
35
 */
36
class T3libTceMain {
37
38
	/**
39
	 * @param string $table
40
	 * @param integer $id
41
	 * @param array $data
42
	 * @param integer $res (but only 0 and 1 is relevant so it's boolean technically)
43
	 * @param $tcemain
44
	 * @internal param object $this
45
	 * @return integer
46
	 */
47
	public function checkRecordUpdateAccess($table, $id, $data, $res, $tcemain) {
0 ignored issues
show
The parameter $data is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $tcemain is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
		if ($table == 'pages' && !BeServices::hasUserAccessToPageRecord($id, 'edit')) {
49
			$result = 0;
50
		} elseif (!BeServices::hasUserAccessToEditRecord($table, $id)) {
51
			$result = 0;
52
		} else {
53
			$result = $res;
54
		}
55
		return $result;
56
	}
57
58
	/**
59
	 * This function is called my TYPO each time an element is saved in the backend
60
	 *
61
	 * @param array $incomingFieldArray
62
	 * @param string $table
63
	 * @param unknown_type $id
64
	 * @param unknown_type $reference
65
	 */
66
	public function processDatamap_preProcessFieldArray(&$incomingFieldArray, $table, $id, &$reference) {
0 ignored issues
show
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $reference is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
		$data = $incomingFieldArray;
68
69
		if (! is_array($data)) {
70
			return; /** some strange DB situation */
71
		}
72
73
		if (in_array($table, VisibilityService::getSupportedTables())) {
74
			/**
75
			 * NOTE: This code does not affect new records because the field 'tx_languagevisibility_visibility' is not set
76
			 */
77
			if (isset($incomingFieldArray['tx_languagevisibility_visibility']) && is_array($incomingFieldArray['tx_languagevisibility_visibility'])) {
78
79
				if ($table == 'pages') {
80
81
					$incomingFieldArray['tx_languagevisibility_inheritanceflag_original'] = (in_array('no+', $incomingFieldArray['tx_languagevisibility_visibility'])) ? '1' : '0';
82
				} elseif ($table == 'pages_language_overlay') {
83
					$incomingFieldArray['tx_languagevisibility_inheritanceflag_overlayed'] = (in_array('no+', $incomingFieldArray['tx_languagevisibility_visibility'])) ? '1' : '0';
84
				}
85
86
				$incomingFieldArray['tx_languagevisibility_visibility'] = serialize($incomingFieldArray['tx_languagevisibility_visibility']);
87
88
					// flush all caches
89
				CacheManager::getInstance()->flushAllCaches();
90
91
				// Flush TYPO3 Caching Framework caches
92
				\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')
93
					->getCache('tx_languagevisibility')
94
					->flush();
95
			}
96
		}
97
	}
98
99
	/**
100
	 * This method is used to initialize new Elements with the default
101
	 *
102
	 * @param unknown_type $status
103
	 * @param unknown_type $table
104
	 * @param unknown_type $id
105
	 * @param unknown_type $fieldArray
106
	 * @param unknown_type $reference
107
	 */
108
	public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, &$reference) {
109
110
		if (in_array($table, VisibilityService::getSupportedTables())) {
111
			/**
112
			 * Now we set the default visibility for elements which did not get a defaultvisibility array.
113
			 * This can happen, if a user creates a new element AND the user has no access for the languagevisibility_field
114
			 */
115
			if ($status == 'new') {
116
				$row = array();
117
				$row['uid'] = $reference->substNEWwithIDs[$id];
118
119
				if ($fieldArray['pid'] == '-1') {
120
					$row = \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceVersionOfRecord($fieldArray['t3ver_wsid'], $table, $row['uid'], $fields = '*');
121
				}
122
123
				$newdata = array('tx_languagevisibility_visibility' => serialize(BeServices::getDefaultVisibilityArray()));
124
				$where = "tx_languagevisibility_visibility = '' AND uid=" . $row['uid'];
125
126
				$GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $newdata);
127
			}
128
129
			CacheManager::getInstance()->flushAllCaches();
130
131
			// Flush TYPO3 Caching Framework caches
132
			\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')
133
				->getCache('tx_languagevisibility')
134
				->flush();
135
		}
136
	}
137
}
138