Issues (1191)

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.

index.php (6 issues)

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
	include('php/jodel-web.php');
3
	$posts;
4
5
	//Get Post Details
6
	if(isset($_GET['postId']) && isset($_GET['getPostDetails']))
7
	{
8
		$userHandleBuffer = [];
9
10
		$accountCreator = new GetPostDetails();
11
		$accountCreator->setAccessToken($jodelAccountForView->accessToken);
12
		$data = $accountCreator->execute();
13
14
		if(array_key_exists('error', $data))
15
		{
16
			echo $data['error'];
17
			exit();
18
			renderTemplate('The post has been blocked');
19
			exit();
20
		}
21
22
		if(array_key_exists('status_code', $data) && $data->status_code == 404)
23
		{
24
			header('HTTP/1.1 410 Gone');
25
			include 'error-pages/410.php';
26
			exit();
27
		}
28
29
		$posts[0] = $data;
30
		$ojHandle = $posts[0]['user_handle'];
31
32
		if(array_key_exists('children', $data))
33
		{
34
			foreach($data['children'] as $key => $child)
35
			{
36
				//is Comment from OJ?
37
				if($ojHandle == $child['user_handle'])
38
				{
39
					$data['children'][$key]['user_handle'] = 'OJ';
40
				}
41
				else
42
				{
43
					$numberForUser = array_search($child['user_handle'], $userHandleBuffer);
44
					if($numberForUser === FALSE)
45
					{
46
						array_push($userHandleBuffer, $child['user_handle']);
47
						$data['children'][$key]['user_handle'] = count($userHandleBuffer);
48
					}
49
					else
50
					{
51
						$data['children'][$key]['user_handle'] = $numberForUser + 1;
52
					}
53
				}
54
				array_push($posts, $data['children'][$key]);
55
			}
56
		}
57
	}
58
	//Get Posts and Hashtags
59
	else
60
	{
61
		$posts = $view->getPosts($jodelAccountForView);
62
	}
63
	if(!isset($posts[0]))
64
	{
65
		error_log('Fehler: ' . print_r($posts, true) . print_r($posts['recent'], true) . print_r($posts['posts'], true));
66
		$title = $view->getTitle();
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
67
		$description = $view->getMetaDescription();
68
	}
69
	else
70
	{
71
		$title = $view->getTitle($posts[0]);
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
72
		$description = $view->getMetaDescription($posts[0]);
73
	}
74
75
	if($view->isDetailedView)
76
	{
77
		$backButton = $view->back()->toUrl() . '#postId-' . $view->postId;
78
	}
79
	else
80
	{
81
		$backButton = '';
82
	}
83
	include 'templates/header.php';
84
?>
85
		
86
		<div class="mainContent container">		
87
			<div class="content row">
88
				<article class="topContent col-sm-8">
89
					<div id="errorMsg"></div>
90
91
					<content id="posts">
92
						<?php
93
							foreach($posts as $post)
94
							{
95
								$view->lastPostId = $post['post_id'];
96
								$view->jodelToHtml($post);
97
							} ?>
98
					</content>
99
					
100
					<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?>
101
						<p id="loading">
102
							Loading…
103
						</p>
104
					<?php } ?>
105
				</article>
106
			
107
				<aside class="topSidebar col-sm-4 sidebar-outer">
108
					<div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>">
109
						<article>
110
							<div>
111
								<h2>Position / Hashtag</h2>
112
								<form action="index.php" method="get">
113
									<input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 139 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
114
									<label>try: #jhj</label><br>
115
									<input type="submit" value="Set Location" /> 
116
								</form>
117
							</div>
118
						</article>
119
120
						<article>
121
							<div>
122
								<h2>Karma</h2>
123
								<?php echo $jodelAccountForKarma->getKarma(); ?>
124
							</div>
125
						</article>
126
127
						<article>
128
							<div>
129
								<?php if(!$jodelAccountForView->isAccountVerified())
130
								{
131
								?>
132
								<h2>New Jodel</h2>
133
								
134
								<button href="templates/captcha.php" data-title="Verify Captcha" data-width="1200" data-toggle="lightbox" data-gallery="remoteload">I am not a robot</button>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 165 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
135
136
								<?php 
137
								}
138
								else
139
								{
140
									if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?>
141
									<h2>Comment on Jodel</h2>
142
									<form enctype="multipart/form-data" method="POST">				
143
											<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" />
144
											<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 137 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
145
											<input type="hidden" name="MAX_FILE_SIZE" value="999990000" />
146
											<input name="image" type="file" />
147
										<input type="submit" value="SEND" /> 
148
									</form>
149
										<?php } else { ?>
150
									<h2>New Jodel</h2>
151
									<form enctype="multipart/form-data" method="POST">
152
										<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 124 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
153
										<br />
154
										<select id="postColorPicker" name="color">
155
											<option value="06A3CB">Blue</option>
156
											<option value="8ABDB0">Teal</option>
157
											<option value="9EC41C">Green</option>
158
											<option value="FFBA00">Yellow</option>
159
											<option value="DD5F5F">Red</option>
160
											<option value="FF9908">Orange</option>
161
										</select> 
162
										<input type="hidden" name="MAX_FILE_SIZE" value="999990000" />
163
										<input name="image" type="file" />
164
										<input type="submit" value="SEND" /> 
165
									</form>
166
								<?php } ?>
167
							<?php } ?>
168
							</div>
169
						</article>
170
					</div>
171
				</aside>
172
			</div>
173
			<?php include 'templates/nav-bottom.php';?>
174
		</div>
175
		<?php
176
			$includeEmojiAndAjax = TRUE;
177
			include 'templates/footer.php';
178
		?>