Issues (279)

Security Analysis    no request data  

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/Kohana/Jam/Association.php (1 issue)

Labels
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 defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * Core class that all associations must extend
5
 *
6
 * @package    Jam
7
 * @category   Associations
8
 * @author     Ivan Kerin
9
 * @copyright  (c) 2011-2012 Despark Ltd.
10
 * @license    http://www.opensource.org/licenses/isc-license.txt
11
 */
12
abstract class Kohana_Jam_Association extends Jam_Attribute {
13
14
	const NULLIFY  = 'nullify';
15
	const ERASE    = 'erase';
16
	const DELETE   = 'delete';
17
18
	/**
19
	 * Get the primary key from whatever value you have
20
	 *
21
	 * @param  string $model_name The name of the model
22
	 * @param  string|integer|Jam_Validated|array $value the value or a container of the value
23
	 * @return string|integer|NULL NULL when no value is provided or could be extracted.
24
	 */
25 46
	public static function primary_key($model_name, $value)
26
	{
27 46
		if ( ! $value)
28 4
			return NULL;
29
30 42
		if ($value instanceof Jam_Validated)
31 18
			return $value->id();
32
33 26
		if (is_integer($value) OR is_numeric($value))
34 13
			return (int) $value;
35
36 14
		if (is_string($value))
37 5
			return $value;
38
39 9
		if (is_array($value))
40 9
			return Arr::get($value, Jam::meta($model_name)->primary_key());
0 ignored issues
show
It seems like \Jam::meta($model_name)->primary_key() targeting Kohana_Jam_Meta::primary_key() can also be of type object<Jam_Meta>; however, Kohana_Arr::get() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
41
	}
42
43 17
	public static function is_changed($value)
44
	{
45 17
		if ($value instanceof Jam_Model AND ( ! $value->loaded() OR $value->changed()))
46 1
			return TRUE;
47
48 16
		return is_array($value);
49
	}
50
51
	public $foreign_model = NULL;
52
53
	public $readonly = NULL;
54
55
	/**
56
	 * If set to true, will delete the association object when this one gets deleted
57
	 * possible values are Jam_Association::DELETE and Jam_Association::ERASE and Jam_Association::NULLIFY
58
	 * Jam_Association::DELETE will run the delete event of the associated model, Jam_Association::ERASE will not
59
	 *
60
	 * @var boolean|string
61
	 */
62
	public $dependent = FALSE;
63
64
	/**
65
	 * See if the association is polymorphic.
66
	 * This is overloaded in the associations themselves
67
	 *
68
	 * @return boolean
69
	 */
70 5
	public function is_polymorphic()
71
	{
72 5
		return FALSE;
73
	}
74
75
	abstract public function join($table, $type = NULL);
76
77
	public function set(Jam_Validated $model, $value, $is_changed)
78
	{
79
		return $value;
80
	}
81
}
82