Issues (25)

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.

lib/Admin/UserSettings.php (1 issue)

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
/**
4
 * The dashboard-specific functionality of the plugin.
5
 *
6
 * @link       https://log.pt
7
 * @since      1.0.0
8
 *
9
 * @package    RedmineEmbed
10
 * @subpackage RedmineEmbed/Admin
11
 */
12
13
namespace logoscon\WP\RedmineEmbed\Admin;
14
15
use logoscon\WP\RedmineEmbed\Plugin;
16
17
/**
18
 * The dashboard-specific functionality of the plugin.
19
 *
20
 * Defines the plugin name, version, and two examples hooks for how to
21
 * enqueue the dashboard-specific stylesheet and JavaScript.
22
 *
23
 * @package    RedmineEmbed
24
 * @subpackage RedmineEmbed/Admin
25
 * @author     log.OSCON, Lda. <[email protected]>
26
 */
27
class UserSettings {
28
29
	/**
30
	 * The plugin's instance.
31
	 *
32
	 * @since  1.0.0
33
	 * @access private
34
	 * @var    Plugin $plugin This plugin's instance.
35
	 */
36
	private $plugin;
37
38
	/**
39
	 * Initialize the class and set its properties.
40
	 *
41
	 * @since 1.0.0
42
	 *
43
	 * @param Plugin $plugin This plugin's instance.
44
	 */
45
	public function __construct( Plugin $plugin ) {
46
		$this->plugin = $plugin;
47
	}
48
49
	/**
50
	 * Display the user profile form field.
51
	 *
52
	 * @param  \WP_User $user User instance.
53
	 */
54
	public function show_user_profile( \WP_User $user ) {
55
		$url = $this->plugin->get_option( 'root_url', '' );
56
57
		if ( empty( $url ) ) {
58
			return;
59
		}
60
61
		if ( ! \current_user_can( 'edit_user', $user->ID ) ) {
62
			return;
63
		}
64
65
		$api_key = \get_user_option( 'redmine_embed_api_key', $user->ID );
66
67
		?>
68
		<h3><?php \_e( 'Redmine', 'redmine-embed' ); ?></h3>
69
		<table class="form-table">
70
			<tr>
71
				<th><label for="redmine_embed_api_key"><?php
72
					\_e( 'API Key', 'redmine-embed' );
73
				?></label></th>
74
				<td>
75
					<input type="text" name="redmine_embed_api_key"
76
						id="redmine_embed_api_key" class="regular-text"
77
						value="<?php echo \esc_attr( $api_key ); ?>">
78
					<br>
79
					<span class="description"><?php
80
						printf(
81
							\__( 'Enter your API key for the Redmine install at %s. It may be found on the right-hand pane of your account page.', 'redmine-embed' ),
82
							\esc_url( $url )
83
						);
84
					?></span>
85
				</td>
86
			</tr>
87
		</table>
88
		<?php
89
	}
90
91
	/**
92
	 * Update saved fields on the edited user profile.
93
	 * @param int $user_id Edited user ID.
94
	 */
95
	public function edit_user_profile_update( $user_id ) {
0 ignored issues
show
edit_user_profile_update uses the super-global variable $_POST which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
96
		if ( ! \current_user_can( 'edit_user', $user_id ) ) {
97
			return;
98
		}
99
100
		$api_key = \sanitize_key( $_POST['redmine_embed_api_key'] );
101
102
		\update_user_option( $user_id, 'redmine_embed_api_key', $api_key );
103
	}
104
105
}
106