Issues (1940)

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.

programs/sync_client.php (3 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
/************************************************************************
3
 * OVIDENTIA http://www.ovidentia.org                                   *
4
 ************************************************************************
5
 * Copyright (c) 2003 by CANTICO ( http://www.cantico.fr )              *
6
 *                                                                      *
7
 * This file is part of Ovidentia.                                      *
8
 *                                                                      *
9
 * Ovidentia is free software; you can redistribute it and/or modify    *
10
 * it under the terms of the GNU General Public License as published by *
11
 * the Free Software Foundation; either version 2, or (at your option)  *
12
 * any later version.													*
13
 *																		*
14
 * This program is distributed in the hope that it will be useful, but  *
15
 * WITHOUT ANY WARRANTY; without even the implied warranty of			*
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.					*
17
 * See the  GNU General Public License for more details.				*
18
 *																		*
19
 * You should have received a copy of the GNU General Public License	*
20
 * along with this program; if not, write to the Free Software			*
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,*
22
 * USA.																	*
23
************************************************************************/
24
25
require_once dirname(__FILE__).'/functions.php';
26
require_once dirname(__FILE__).'/utilit/vacincl.php';
27
require_once dirname(__FILE__).'/utilit/right.class.php';
28
require_once dirname(__FILE__).'/utilit/agent.class.php';
29
require_once dirname(__FILE__).'/utilit/sync.ui.php';
30
require_once dirname(__FILE__).'/utilit/client.class.php';
31
32
/**
33
 * 
34
 * @param array $values
35
 */
36
function absences_syncClientSave($values)
37
{
38
	global $babDB;
39
	
40
	
41
	$babBody = bab_getInstance('babBody');
42
	/*@var $babBody babBody */
43
	
44
	$client = new absences_client;
45
	$checked_uuid = array();
46
	
47
	
48
	
49
	foreach($values['right'] as $uuid => $checked)
50
	{
51
		if ($checked)
52
		{
53
			
54
			$checked_uuid[] = $uuid;
55
			
56
			$right = absences_Right::getByUuid($uuid);
57
			
58
			if (!$right->getRow())
59
			{
60
				// the right does not exists in client database
61
				$new_right = $client->addRight($uuid);
62
				$babBody->addNextPageMessage(sprintf(absences_translate('The right %s has been created'), $new_right->description));
0 ignored issues
show
sprintf(absences_transla...new_right->description) is of type string, but the function expects a object<unknown_type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
63
			
64
			} else {
65
				// the right exists, update sync status
66
				$client->updateRight($uuid);
67
				$babBody->addNextPageMessage(sprintf(absences_translate('The right %s has been updated'), $right->description));
0 ignored issues
show
sprintf(absences_transla...), $right->description) is of type string, but the function expects a object<unknown_type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
68
			}
69
		}
70
	}
71
	
72
	$babDB->db_query('UPDATE absences_rights SET sync_status='.$babDB->quote(0).' WHERE uuid NOT IN('.$babDB->quote($checked_uuid).')');
73
	
74
	
75
	require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php';
76
	
77
	$url = bab_url::get_request('tg');
78
	$url->location();
79
	
80
}
81
82
83
84
85
86
function absences_syncClientEdit()
87
{
88
	$W = bab_Widgets();
89
	$page = $W->BabPage();
90
	
91
	if (isset($_POST['sync_client']))
92
	{
93
		
94
		if( isset($_POST['sync_client']['save'] ))
95
		{
96
			
97
			// modification uniquement
98
	
99
			$values = $_POST['sync_client'];
100
			absences_syncClientSave($values);
101
		}
102
	}
103
	
104
	$page->setTitle(absences_translate('Add vacation rights'));
105
	try {
106
		$editor = new absences_SyncClientEditor();
107
		$page->addItem($editor);
108
	} catch(Exception $e)
109
	{
110
		$page->addError($e->getMessage());
111
	}
112
	
113
	$page->displayHtml();
114
}
115
116
117
118
119
120
/* main */
121
bab_requireCredential();
122
$agent = absences_Agent::getCurrentUser();
123
if( !$agent->isManager())
124
{
125
	$babBody->msgerror = absences_translate("Access denied");
126
	return;
127
}
128
129
if ($agent->isInPersonnel())
130
{
131
	$babBody->addItemMenu("vacuser", absences_translate("Vacations"), absences_addon()->getUrl()."vacuser");
132
}
133
$babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu");
134
135
$idx = bab_rp('idx', "edit");
136
137
138 View Code Duplication
switch($idx)
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
139
{
140
	case 'edit':
141
		absences_syncClientEdit();
142
		$babBody->addItemMenu("edit", absences_translate("Edit"), absences_addon()->getUrl()."sync_client&idx=edit");
143
		break;
144
}
145
146
147
$babBody->setCurrentItemMenu($idx);
148
bab_siteMap::setPosition('absences','User');