mirror of
https://github.com/Cacti/documentation.git
synced 2026-12-06 15:13:53 +09:00
* docs: [1.2.x] refresh the manual front page The front page opened with version notes before saying what Cacti is, used headings as sentences in the credits, and its table of contents listed seven sections while the page has ten. Open with a short description and a getting-started sequence, link the website and forums, give the credits real headings, and list every section in the table of contents in page order. Record Jeff Pasnak under In Memoriam with a link to the 1.2.31 release announcement. Correct label typos and wrap long entries with reference links. Existing section anchors are unchanged, and every page is still linked. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] fix typos, unrendered headings and forum links A check of every page linked from the front page found misspellings in eleven pages, three Mactrack headings written without a space after the hashes, which render as plain text, and two forum links still using http. Correct the spellings, add the missing space so the headings render, and point the forum links at https, where they already redirect. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] align the plugin pages with the plugin READMEs The supported plugins list and the Syslog and Mactrack pages had drifted from the README and INFO files in the plugin repositories. Update the descriptions that the READMEs contradict: Monitor's Thold requirement, the Router Configs transfer methods, the ReportIt release and Cacti versions, the WMI collection methods and its development status, and NUT support in Apcupsd. Add the Syslog requirements, the upgrade procedure, the dedicated database settings and the remote collector settings, and correct the database grant and a misplaced code fence. Add the Mactrack requirements and a short section on history partitioning and ignored ports that links to the README. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] correct grammar, spelling and broken Markdown A read of every page linked from the front page found grammar and spelling errors throughout, and Markdown that does not render as intended. Correct grammar, spelling, punctuation and product-name capitalization in 95 pages without changing headings, code blocks, link targets or the meaning of the text. Repair the Markdown defects: a code fence in the SSH tunnel how-to that never closed, malformed bold markers in the user management and device defaults pages, a release notes table with no blank line before it, split rows in the tree sorting table, and LDAP list items missing their markers. Correct three interface labels quoted with typos. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] correct statements that differ from the 1.2.x source Reviewers of the linked pages flagged statements that looked wrong. Each was compared with the Cacti 1.2.x source at 1523aa04b, and only those the source or the page itself settles are changed. Correct interface labels and option names (Index Count Changed, Permissive, Not Selected, Utilities, the BCC description, the gear icon for plugin install), the default Maximum Value of U for a new data source item, the sysDescr object name, the PHP floor wording in the requirements table, the Mactrack wildcard character and the snmptrapd -On option. Repair cross-references, example values that disagree with their commands, two table captions, a split list and several sentences with missing words. Statements the source does not settle are left as written. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
91 lines
3.1 KiB
Markdown
91 lines
3.1 KiB
Markdown
# Security
|
|
|
|
## General Validation
|
|
|
|
Never trust input regardless of where it is coming from! The responsibility
|
|
falls on the library functions to ensure that potentially dangerous input does
|
|
not introduce a security hole. Some sort of sanitization, validation, or quoting
|
|
must be provided for **all** arguments in a function. This ensures that bad
|
|
data does not make its way into an SQL string, a filename, an executable, or
|
|
even another function.
|
|
|
|
## Request Validation
|
|
|
|
For Plugin Developers, Cacti includes settings to allow you to know when
|
|
you are using unvalidated data. They include:
|
|
|
|
* get_filter_request_var('somevariable') - This function call, by default,
|
|
will validate that the variable `$_REQUEST['somevariable']` returned
|
|
is actually an integer, if not, Cacti will block the page
|
|
function from continuing.
|
|
|
|
* get_filter_request_var('somevariable', 'options') - This version of the
|
|
function can do all sorts of verification and sanitization.
|
|
|
|
* set_request_var('somevariable', 'somevalue') - This function will set
|
|
the Cacti request variable superglobal with a value.
|
|
|
|
Generally speaking, you should never use either `$_GET`, `$_REQUEST` or
|
|
`$_POST` in your Cacti code. Use the validators. When you do, you can
|
|
turn on the Cacti setting `Log Input Validation Issues` when you are
|
|
developing, and your Cacti log will include warnings when an invalid
|
|
variable has been encountered.
|
|
|
|
## Prepared Statements
|
|
|
|
The second method of hardening your Cacti application is through the use
|
|
of prepared SQL statements. When you use prepared SQL statements, the
|
|
Database API will validate that all variables have been properly escaped
|
|
making it much more difficult to perform SQL injection attacks on Cacti.
|
|
|
|
Examples of non-prepared function calls and prepared include:
|
|
|
|
```php
|
|
$somevalue = db_fetch_cell("SELECT COUNT(*)
|
|
FROM host
|
|
WHERE id = $somevariable");
|
|
```
|
|
|
|
In the case above, it would be very easy to exploit Cacti. The example
|
|
below is the correct way to protect against attacks.
|
|
|
|
```php
|
|
$somevalue = db_fetch_cell_prepared('SELECT COUNT(*)
|
|
FROM host
|
|
WHERE id = ?',
|
|
array($somevariable));
|
|
```
|
|
|
|
## Output Escaping
|
|
|
|
Cacti provides an escaping function to reduce the likelihood of XSS
|
|
vulnerabilities in Cacti leading to exploitation of other Web Sites.
|
|
Cacti itself has a very restrictive XSS mitigation policy in effect
|
|
by default, but following proper output escaping minimizes problems.
|
|
|
|
The following example is how to, and not to escape output:
|
|
|
|
```php
|
|
print "<tr><td>" . $some_variable . "</td></tr>";
|
|
```
|
|
|
|
Using the print statement above, for values that come from the database
|
|
can lead to Stored XSS vulnerabilities in your code. So, it's better
|
|
to use the following:
|
|
|
|
```php
|
|
print "<tr><td>" . html_escape($some_variable) . "</td></tr>";
|
|
```
|
|
|
|
## JavaScript Validation
|
|
|
|
Relying on JavaScript-based validation is nice for instant feedback to the
|
|
user, but should not replace validation checking in the PHP code.
|
|
|
|
If you follow the simple rules above, your Plugin will be much safer
|
|
for others to use and will more easily pass internal security and
|
|
pen tests.
|
|
|
|
---
|
|
Copyright (c) 2004-2026 The Cacti Group
|