Skip to content

Commit

Permalink
Merge branch 'main' into feat/rabbit-mq-missing-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
underdarknl authored Jan 9, 2025
2 parents 353685a + 98e81b6 commit 562cdba
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonar-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ jobs:
pattern: "*-coverage-unit-fixed"

- name: SonarCloud
uses: SonarSource/sonarcloud-github-action@v3.1.0
uses: SonarSource/sonarcloud-github-action@v4.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Binary file added docs/source/manual/img/question-port-mapping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions docs/source/manual/user-manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,75 @@ Based on the report, object and safeguard, select the relevant boefjes for your
The scan is an ongoing process, looking for information based on derivation and logical connections in the data model. The results of the scan appear over time, any findings can be viewed by object, at Findings and in the Crisis Room. In each context, reports can also be generated.


Questions & Configs
===================
OpenKAT can be used to customise OpenKAT to your own company policies and industry standards. This will allow you to set your security more or less strict depending on your needs and wishes. This can be done using the Question objects on the Objects page. By default no policies are applied. In order to set an policy you have to answer the policy questions and apply these. After applying the questions a Config is created which contains all the answers to your Questions. OpenKAT reads the applied Config files and ensures that all observations are measured against your applied policy.

To summarize: your personal policy is stored in Configs. In order to create a Config you have to answer the Questions. After answering all questions the Config is automatically generated and applied. Questions consist of a JSON schema, which is rendered as a form in the web interface.

Currently the following pre-defined policies are available:

- Disallowed hostnames in the CSP header
- Objects in the HTTP headers
- Port classification


Disallowed CSP hostnames
------------------------

**Why is this question introduced?**
Websites often load scripts and content from external servers (e.g. jQuery from a Content Delivery Network (CDN) like Cloudflare). This can be dangerous as you have limited control over the content that is inside the scripts that these external servers are serving. This Question allows you to check if the hostname in the CSP is allowed by your policy.

**What are the risks?**
Loading external content from websites you do not have control over could result in supply chain attacks. Attackers could serve malicious code (scripts) on CDN networks that is then automatically loaded into the browser of each website visitor.

**Limitations**
This question looks only for bad hostnames that are provided by the user (denylist). This means that findings for bad hostnames in the CSP header are only shown for those domains that are added to the list.

**Examples**
Provide hostnames which are unwanted, separate each hostname by a comma. You can specify the main domain (`bad.com`), subdomains are automatically taken into account (`script.bad.com`).

.. code-block:: RST
E.g. evil.com, bad.evil.com, attacker.com.
OOIs in headers
---------------

**Why is this question introduced?**
Some websites like SSO portals result in new objects on the Objects page for each time a boefje visited the website with a new session token. By specifying which session parameters are used the number of objects will be limited to only the paths on the server.

**What are the risks?**
There is no direct impact. This question helps reduce the number of duplicate items in the Objects list and thus helps in getting a better overview.

**Limitations**
It only checks for parameters in the URL, headers are ignored. There is currently no way to specify the parameters per hostname.

**Examples**
Provide the URL parameter that is to be ignored, separate each parameter by a comma. URL parameters can be found in the URL bar after the `?` sign. They are the values after the `&` and before the `=` signs.

The URL is: `https://example.com/index.php?session_id=12346&search=meow <dontredirect>`_ . This URL has two parameters:`session_id` and `search`, which both have a value (`123456` and `meow`). The parameter and value for `session_id=123456` are expected to clutter the Objects list, as for each new session the value `123456` is different. The next time you visit the website this might be `session_id=43215` and the next time `session_id=958367`. You can reduce the object clutter by adding the parameter `session_id` to the list as this will be the same for each session. Adding the value `123456` will not work, as this will be different each time.



Port mapping
------------

**Why is this question introduced?**
Maps open ports into specific categories based on the services in your environment. You can specify common TCP and UDP ports which will not trigger a finding (such as e-mail server ports). By adding ports to the database (db) and system administrator (sa) lists you tell OpenKAT which ports are likely used in your network. Depending on your port mapping OpenKAT will show different findings if the port is detected. The `aggregate_findings` functionality allows you to group findings by IP address rather than treating them as separate ports.

**What are the risks?**
There is no direct impact. This question helps to tune findings to your own demands. Having good insights in your network helps with risk mitigation.

**Limitations**
If a port is added to multiple lists the finding for the first list is shown. If a port is added to both sa_tcp_ports and db_tcp_ports, then the finding relating to the system administrator ports is shown, as this is the first in the list.

**Examples**
Enter ports separated by a comma. Such as: 21,22,3389.

.. image:: img/question-port-mapping.png
:alt: Port mapping order

Trusted timestamps in OpenKAT
=============================

Expand Down
38 changes: 17 additions & 21 deletions mula/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,40 +390,36 @@ check for `Schedule` objects whose `deadline_at` has passed and will push the
## Project structure

```
$ tree -L 3 --dirsfirst
.
├── docs/ # additional documentation
├── scheduler/ # scheduler python module
│   ├── config # application settings configuration
│   ├── connectors # external service connectors
│   │   ├── listeners # channel/socket listeners
│   │   ├── services # rest api connectors
│   │   └── __init__.py
│   ├── clients/ # external service clients
│   │   ├── amqp/ # amqp clients
│   │   ├── http/ # http api clients
│   │   ├── __init__.py
│   │   ├── connector.py
│   │   └── errors.py
│   ├── config/ # application settings configuration
│   ├── context/ # shared application context
│   ├── models/ # internal model definitions
│   ├── queues/ # priority queue definition
│   ├── rankers/ # priority/score calculations
│   ├── storage/ # data abstraction layer
│   ├── schedulers/ # schedulers
│   │   ├── boefje.py # boefje scheduler implementation
│   │   ├── normalizer.py # normalizer scheduler implementation
│   │   ├── report.py # report scheduler implementation
│   │   ├── queue/ # priority queue implementation
│   │   ├── rankers/ # rankers for tasks
│   │   ├── schedulers/
│ │   │   ├── __init__.py
│ │   │   ├── boefje.py # boefje scheduler implementation
│ │   │   ├── normalizer.py # normalizer scheduler implementation
│ │   │   └── report.py # report scheduler implementation
│   │   ├── __init__.py
│   │   └── scheduler.py # abstract base class for schedulers
│   ├── storage/ # data abstraction layer
│   ├── server/ # http rest api server
│   ├── utils/ # common utility functions
│   ├── __init__.py
│   ├── __main__.py
│   ├── app.py # openkat scheduler app implementation
│   └── version.py # version information
└─── tests/
   ├── factories/
   ├── integration/
   ├── mocks/
   ├── scripts/
   ├── simulation/
   ├── unit/
   ├── utils/
   └── __init__.py
└─── tests/ # test suite
```

The following describes the main components of the scheduler application:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ <h1>{% translate "OpenKAT setup" %}</h1>
{% include "partials/stepper.html" %}

<h2>{% translate "Account setup" %}</h2>
<h3>{% translate "Accounts" %}</h3>
<h4>{% translate "Organization setup with separate accounts:" %}</h4>
<p>
{% blocktranslate trimmed %}
Expand All @@ -36,7 +35,7 @@ <h4>{% translate "Single account setup:" %}</h4>
{% if organization %}
<div class="button-container">
<a href="{% url "step_choose_user_type" organization.code %}"
class="button">{% translate "Create separate accounts" %}</a>
class="button ghost">{% translate "Create separate accounts" %}</a>
<a href="{% url "step_introduction" organization.code %}"
class="button ">{% translate "Continue with this account, onboard me!" %}</a>
</div>
Expand Down
6 changes: 1 addition & 5 deletions rocky/rocky/locale/django.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-18 09:24+0000\n"
"POT-Creation-Date: 2025-01-03 20:02+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -1637,10 +1637,6 @@ msgstr ""
msgid "Account setup"
msgstr ""

#: onboarding/templates/account/step_2c_account_setup_intro.html
msgid "Accounts"
msgstr ""

#: onboarding/templates/account/step_2c_account_setup_intro.html
msgid "Organization setup with separate accounts:"
msgstr ""
Expand Down
3 changes: 2 additions & 1 deletion rocky/tests/integration/test_report_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from datetime import date

from reports.runner.report_runner import LocalReportRunner

Expand Down Expand Up @@ -89,7 +90,7 @@ def test_run_report_task(octopoes_api_connector: OctopoesAPIConnector, report_ru
assert len(subreports) == 2

assert report.name == "Concatenated report for 2 objects"
assert "DNS Report for a.example.com in 2024" in {x.name for x in subreports}
assert f"DNS Report for a.example.com in {date.today().year}" in {x.name for x in subreports}

# FIXME: the naming logic in reports/views/mixins.py 107-112 is not right. We expect to find example.com in this
# set, but instead only find a.example.com because when ooi_name is 'example.com', the check:
Expand Down

0 comments on commit 562cdba

Please sign in to comment.