-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExtensionInterface.php
More file actions
79 lines (70 loc) · 2.05 KB
/
Copy pathExtensionInterface.php
File metadata and controls
79 lines (70 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Patchstack\Extensions;
/**
* Any extension must implement the methods of the interface.
* Some CMS systems might implement some of the logic completely different than others.
*/
interface ExtensionInterface
{
/**
* Log the request, this can be of type BLOCK, LOG or REDIRECT.
*
* @param int $ruleId
* @param string $bodyData
* @param string $blockType
* @return void
*/
public function logRequest($ruleId, $bodyData, $blockType);
/**
* Determine if the current visitor can bypass the firewall.
* If $isMuCall is true, we MUST avoid any function calls that checks the current authorization of the user,
* this includes current_user_can. Otherwise, a fatal error is thrown.
*
* @param bool $isMuCall
* @return bool
*/
public function canBypass($isMuCall);
/**
* Determine if the visitor is blocked from the website.
*
* @param int $minutes
* @param int $blockTime
* @param int $attempts
* @return bool
*/
public function isBlocked($minutes, $blockTime, $attempts);
/**
* Force exit the page when a request has been blocked.
*
* @param int $ruleId
* @return void
*/
public function forceExit($ruleId);
/**
* Get the IP address of the request.
* Do NOT blindly rely on IP address headers which can be spoofed, such as X-Forwarded-For.
*
* @return string
*/
public function getIpAddress();
/**
* Get the hostname of the environment.
* This is only used for open redirect vulnerabilities.
*
* @return string
*/
public function getHostName();
/**
* Determine if the request should be passed without going through the firewall.
*
* @param array $whitelistRules
* @param array $request
*/
public function isWhitelisted($whitelistRules, $request);
/**
* Determine if the current request is a file upload request.
*
* @return boolean
*/
public function isFileUploadRequest();
}