summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-08-18 14:49:35 +0200
committerBen Fuhrmannek2021-08-18 14:49:35 +0200
commit3f558f11805225f335d700db6076ce75ae4b17b3 (patch)
tree978fec414e74ff3b394659895346ef94a4cd13f0 /doc
parent06e1790f1054dd9e02af0e469abfb18d6ca0ff8d (diff)
document allowed linebreaks and sim() alias to simulation()
Diffstat (limited to 'doc')
-rw-r--r--doc/source/config.rst55
1 files changed, 33 insertions, 22 deletions
diff --git a/doc/source/config.rst b/doc/source/config.rst
index 84e3fa9..9e9fb83 100644
--- a/doc/source/config.rst
+++ b/doc/source/config.rst
@@ -1,16 +1,6 @@
1Configuration 1Configuration
2============= 2=============
3 3
4Options are chainable by using dots (``.``) and string parameters
5**must** be quoted, while booleans and integers aren't.
6
7Comments are prefixed either with ``#``, or ``;``.
8
9Some rules apply in a specific ``function`` (context) on a specific ``variable``
10(data), like ``disable_function``. Others can only be enabled/disabled, like
11``harden_random``.
12
13
14.. warning:: 4.. warning::
15 5
16 If you configure Snuffleupagus incorrectly, your website *might* not work 6 If you configure Snuffleupagus incorrectly, your website *might* not work
@@ -21,17 +11,6 @@ Some rules apply in a specific ``function`` (context) on a specific ``variable``
21 read the present documentation about how to configure them, 11 read the present documentation about how to configure them,
22 evaluate your threat model and write your configuration file accordingly. 12 evaluate your threat model and write your configuration file accordingly.
23 13
24Most of the features can be used in ``simulation`` mode by appending the
25``.simulation()`` option to them (eg. ``sp.readonly_exec.simulation().enable();``) to see
26whether or not they could break your website. The simulation mode won't block the request,
27but will write a warning in the log.
28
29The rules are evaluated in the order that they are written, the **first** one
30to match will terminate the evaluation (except for rules in simulation mode).
31
32Configuration file format
33-------------------------
34
35Since PHP *ini-like* configuration model isn't flexible enough, 14Since PHP *ini-like* configuration model isn't flexible enough,
36Snuffleupagus is using its own format in the file specified by 15Snuffleupagus is using its own format in the file specified by
37the directive ``sp.configuration_file`` **in** your ``php.ini`` file, 16the directive ``sp.configuration_file`` **in** your ``php.ini`` file,
@@ -61,6 +40,38 @@ your logs of course. We do **not** recommend to use it of course, but sometimes
61it might be useful to be able to "debug in production" without breaking your 40it might be useful to be able to "debug in production" without breaking your
62website. 41website.
63 42
43Configuration file format
44-------------------------
45
46Options are chainable by using dots (``.``).
47
48Some options have a string parameter, that **must** be quoted with double quotes, e.g. ``"string"``.
49
50Comments are prefixed either with ``#``, or ``;``.
51
52Some rules apply in a specific ``function`` (context) on a specific ``variable``
53(data), like ``disable_function``. Others can only be enabled/disabled, like
54``harden_random``.
55
56Most of the features can be used in ``simulation`` mode by appending the
57``.simulation()`` or ``.sim()`` option to them (eg. ``sp.readonly_exec.simulation().enable();``) to see
58whether or not they could break your website. The simulation mode won't block the request,
59but will write a warning in the log.
60
61The rules are evaluated in the order that they are written, the **first** one
62to match will terminate the evaluation (except for rules in simulation mode).
63
64Rules can be split into lines and contain whitespace for easier readability and maintenance: (This feature is available since version 0.8.0.)
65
66::
67
68 sp.disable_function.function("mail")
69 .param("to").value_r("\\n")
70 .alias("newline in mail() To:")
71 .drop();
72
73The terminating ``;`` is optional for now, but it should be used for future compatibility.
74
64Miscellaneous 75Miscellaneous
65------------- 76-------------
66 77
@@ -380,7 +391,7 @@ It's currently not possible to:
380 `for now <https://github.com/jvoisin/snuffleupagus/issues/190>`__). 391 `for now <https://github.com/jvoisin/snuffleupagus/issues/190>`__).
381 This is why hooked ``print`` will be displayed as ``echo`` in the logs. 392 This is why hooked ``print`` will be displayed as ``echo`` in the logs.
382- Hook `strlen`, since in latest PHP versions, this function is usually 393- Hook `strlen`, since in latest PHP versions, this function is usually
383 optimized away by the compiled. 394 optimized away by the compiler.
384 395
385 396
386Examples 397Examples