Skip to content
security.rst 3.18 KiB
Newer Older
Bengfort's avatar
Bengfort committed
Security
========
Bengfort's avatar
Bengfort committed

The main purpose of castellum is to handle data of test subjects. It is
important to be able to read and write this data in various ways. We are
also legally required to provide some specific forms of access, e.g.
exporting or deleting all data on a single subject.

On the other hand, we are also required to handle this data very
carefully. Among other things, we are required to split the data so that
users can only ever access the parts of the data they really need.

The security measures outlined in this section are meant to only allow access
where allowed and required.

Account restrictions
--------------------

-  Users are automatically logged out on inactivity
-  User accounts expire on a set date
-  (Mandatory) :ref:`2fa`
Bengfort's avatar
Bengfort committed
.. _permissions:

Bengfort's avatar
Bengfort committed
Permissions
-----------

Most actions in castellum are protected by one or more permission. For
easier handling, permissions are usually not assigned directly. Instead,
Bengfort's avatar
Bengfort committed
they are collected into meaningful groups (aka :ref:`roles`). Castellum comes
with some pre-defined sample groups, but you can adapt them to your needs.
Bengfort's avatar
Bengfort committed

Bengfort's avatar
Bengfort committed
Note that the django framework automatically generates a lot of
permissions. Only a few of them are actually used. The full list is:

-  ``studies.approve_study``
Bengfort's avatar
Bengfort committed
-  ``studies.view_study``
-  ``studies.change_study``
-  ``studies.delete_study``
-  ``studies.access_study``
-  ``subjects.view_subject``
-  ``subjects.change_subject``
-  ``subjects.delete_subject``
-  ``subjects.export_subject``
-  ``recruitment.recruit``
-  ``recruitment.conduct_study``
-  ``recruitment.search_participations``
-  ``recruitment.view_current_appointments``
-  ``recruitment.change_appointments``
Bengfort's avatar
Bengfort committed
-  ``castellum_auth.privacy_level_1``
-  ``castellum_auth.privacy_level_2``

Bengfort's avatar
Bengfort committed
Study membership
~~~~~~~~~~~~~~~~

If a user is a member of a study, they automatically gain the special
Bengfort's avatar
Bengfort committed
``access_study`` permission in the context of that study. Study managers can
also assign additional groups to study members that only apply in the context
Bengfort's avatar
Bengfort committed
of the study.

Bengfort's avatar
Bengfort committed
.. warning::
    By managing study memberships, study managers can escalate their own
    priviliges inside their studies. For example, they can allow themselves to
    see recruitment attributes of participants.
    All studies need to be approved before they can start recruitment. The
    approver should check for suspicious settings before approving the study.
Bengfort's avatar
Bengfort committed
    However, for practical reasons all study settings (including memberships)
    can still be changed after the approval. Some organizations will even
    choose to allow study managers to approve their own studies.
Bengfort's avatar
Bengfort committed
.. _privacy-level:

Bengfort's avatar
Bengfort committed
Privacy levels
~~~~~~~~~~~~~~

Every subject has a privacy level. A user is only allowed to access that
subject if they have a sufficient privacy level themselves. For recruitment
attributes, you can define separate privacy levels for read and write access. A
user's privacy level is controlled via the special permissions
``privacy_level_1`` and ``privacy_level_2``. The three levels (0-2) accord to
the data security levels of the Max Planck Society.

Bengfort's avatar
Bengfort committed
Monitoring
----------

Bengfort's avatar
Bengfort committed
In order to allow analysing suspicious behavior, critical actions such as
Bengfort's avatar
Bengfort committed
search, deletion, or login attempts are logged to a separate log file.