Issues (850)

Security Analysis    4 potential vulnerabilities

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection (1)
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection (2)
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  Cross-Site Scripting (1)
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.
  Header Injection
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.

data-stores/class-getpaid-cache-helper.php (1 issue)

1
<?php
2
/**
3
 * GetPaid_Cache_Helper class.
4
 *
5
 */
6
7
defined( 'ABSPATH' ) || exit;
8
9
/**
10
 * GetPaid_Cache_Helper.
11
 */
12
class GetPaid_Cache_Helper {
13
14
	/**
15
	 * Transients to delete on shutdown.
16
	 *
17
	 * @var array Array of transient keys.
18
	 */
19
	private static $delete_transients = array();
20
21
	/**
22
	 * Hook in methods.
23
	 */
24
	public static function init() {
25
		add_action( 'shutdown', array( __CLASS__, 'delete_transients_on_shutdown' ), 10 );
26
		add_action( 'wp', array( __CLASS__, 'prevent_caching' ) );
27
	}
28
29
	/**
30
	 * Add a transient to delete on shutdown.
31
	 *
32
	 * @since 1.0.19
33
	 * @param string|array $keys Transient key or keys.
34
	 */
35
	public static function queue_delete_transient( $keys ) {
36
		self::$delete_transients = array_unique( array_merge( is_array( $keys ) ? $keys : array( $keys ), self::$delete_transients ) );
37
	}
38
39
	/**
40
	 * Transients that don't need to be cleaned right away can be deleted on shutdown to avoid repetition.
41
	 *
42
	 * @since 1.0.19
43
	 */
44
	public static function delete_transients_on_shutdown() {
45
		if ( self::$delete_transients ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression self::delete_transients of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
46
			foreach ( self::$delete_transients as $key ) {
47
				delete_transient( $key );
48
			}
49
			self::$delete_transients = array();
50
		}
51
	}
52
53
	/**
54
	 * Get prefix for use with wp_cache_set. Allows all cache in a group to be invalidated at once.
55
	 *
56
	 * @param  string $group Group of cache to get.
57
	 * @return string
58
	 */
59
	public static function get_cache_prefix( $group ) {
60
		// Get cache key.
61
		$prefix = wp_cache_get( 'getpaid_' . $group . '_cache_prefix', $group );
62
63
		if ( false === $prefix ) {
64
			$prefix = microtime();
65
			wp_cache_set( 'getpaid_' . $group . '_cache_prefix', $prefix, $group );
66
		}
67
68
		return 'getpaid_cache_' . $prefix . '_';
69
	}
70
71
	/**
72
	 * Invalidate cache group.
73
	 *
74
	 * @param string $group Group of cache to clear.
75
	 * @since 1.0.19
76
	 */
77
	public static function invalidate_cache_group( $group ) {
78
		wp_cache_set( 'getpaid_' . $group . '_cache_prefix', microtime(), $group );
79
	}
80
81
	/**
82
	 * Prevent caching on certain pages
83
	 */
84
	public static function prevent_caching() {
85
		if ( ! is_blog_installed() ) {
86
			return;
87
		}
88
89
		if ( wpinv_is_checkout() || wpinv_is_success_page() || wpinv_is_invoice_history_page() || wpinv_is_subscriptions_history_page() ) {
90
			self::set_nocache_constants();
91
			nocache_headers();
92
		}
93
94
	}
95
96
	/**
97
	 * Get transient version.
98
	 *
99
	 *
100
	 * @param  string  $group   Name for the group of transients we need to invalidate.
101
	 * @param  boolean $refresh true to force a new version.
102
	 * @return string transient version based on time(), 10 digits.
103
	 */
104
	public static function get_transient_version( $group, $refresh = false ) {
105
		$transient_name  = $group . '-transient-version';
106
		$transient_value = get_transient( $transient_name );
107
108
		if ( false === $transient_value || true === $refresh ) {
109
			$transient_value = (string) time();
110
111
			set_transient( $transient_name, $transient_value );
112
		}
113
114
		return $transient_value;
115
	}
116
117
	/**
118
	 * Set constants to prevent caching by some plugins.
119
	 *
120
	 * @param  mixed $return Value to return. Previously hooked into a filter.
121
	 * @return mixed
122
	 */
123
	public static function set_nocache_constants( $return = true ) {
124
		getpaid_maybe_define_constant( 'DONOTCACHEPAGE', true );
125
		getpaid_maybe_define_constant( 'DONOTCACHEOBJECT', true );
126
		getpaid_maybe_define_constant( 'DONOTCACHEDB', true );
127
		return $return;
128
	}
129
130
}
131
132
GetPaid_Cache_Helper::init();
133