1
|
## Security Review API
|
2
|
|
3
|
* hook_security_checks() and check returns
|
4
|
* Check help
|
5
|
* Standalone use of the checklist
|
6
|
* Drush
|
7
|
|
8
|
### hook_security_checks()
|
9
|
|
10
|
Checks returned from an implementation of hook_security_checks() look like the
|
11
|
following.
|
12
|
|
13
|
array(
|
14
|
$namespace => array(
|
15
|
$check_name => array(
|
16
|
'title' => 'Simple title of this check',
|
17
|
'callback' => 'function to invoke for check, see section on check returns',
|
18
|
'success' => 'One-line description of a successful check',
|
19
|
'failure' => 'One-line description of a failed check listing what the risk is',
|
20
|
)
|
21
|
)
|
22
|
)
|
23
|
|
24
|
The top level index is often the module name. Each check name (not title) should
|
25
|
attempt to be unique.
|
26
|
|
27
|
### Check return values
|
28
|
|
29
|
A check can return a boolean or NULL. A return value of TRUE means the check
|
30
|
passed and the 'success' description will be used. FALSE means failure. A return
|
31
|
value of NULL is used in case the check can not run for any reason, an example
|
32
|
being if a dependency is nesecessary to run the check and that depenency is not
|
33
|
met.
|
34
|
|
35
|
### Check help
|
36
|
|
37
|
Implement $callback . '_help' to provide help for a check.
|
38
|
|
39
|
Help functions should return an array like so:
|
40
|
|
41
|
array(
|
42
|
'title' => '',
|
43
|
'descriptions' => array('Check descriptions', 'Link off to something'),
|
44
|
'findings' => array(
|
45
|
'descriptions' => array('Descriptions of findings'),
|
46
|
'items' => array('Specific findings'),
|
47
|
)
|
48
|
)
|
49
|
|
50
|
Consult security_review.help.inc for details.
|
51
|
|
52
|
## Standalone use of the checklist
|
53
|
|
54
|
The Security Review module need not be installed to use the checklist, though
|
55
|
no logging, UI, or check result storage will be available.
|
56
|
|
57
|
To run the checklist include the following code in your own module.
|
58
|
|
59
|
include_once('security_review.inc');
|
60
|
$checklist = security_review_get_checklist();
|
61
|
$checklist_results = security_review_run($checklist);
|
62
|
|
63
|
Note that the some checks may take long to complete, so it is advised that you
|
64
|
plan accordingly or unset those checks.
|
65
|
|
66
|
## Drush
|
67
|
|
68
|
Run the checklist via Drush with the following command
|
69
|
|
70
|
drush security-review
|
71
|
|
72
|
Consult the Drush help on the security-review command for more information.
|
73
|
|
74
|
You can also run the drush command without installing the module so long as the
|
75
|
the security_review.drush.inc and security_review.inc files can be found by
|
76
|
drush. For instance you could place these files in your ~/.drush/ directory.
|