assets_guardian.plugins.dolibarr.matrixο
Classes
|
Verifies that rights on Dolibarr critical modules are authorized. |
|
Verifies that Dolibarr superadmins are authorized by the authorization matrix. |
- class assets_guardian.plugins.dolibarr.matrix.DolibarrCriticalModuleAccessRule(**kwargs: Any)[source]ο
Bases:
IMatrixRuleVerifies that rights on Dolibarr critical modules are authorized.
This rule inspects accesses of type module_permission on modules declared in CRITICAL_MODULES and verifies that the userβs profile authorizes this right in the matrix.
The matrix key used is (profile, module) -> permission_level. Example: (βDirectionβ, βbanqueβ) -> βmodifierβ
Dolibarr permissions are modeled as virtual Assets representing critical modules, which respects the asset-centric structure of Assets Guardian.
- evaluate(accesses: Iterable[Access], matrix: dict[tuple[str, str], str], profiles: dict[str, list[str]]) Iterable[Finding][source]ο
Verifies that each right on a critical module is authorized by the matrix.
The matrix must contain entries of the form: (profile, module) -> permission_key (e.g., (βDirectionβ, βbanqueβ) -> βmodifierβ).
A right is considered authorized if at least one of the userβs profiles has a matrix entry covering this module.
- Parameters:
accesses β All collected accesses for Dolibarr.
matrix β Authorization matrix (profile, module) -> authorized permission.
profiles β Mapping email -> list of profiles.
- Yields:
Finding β One Finding per unauthorized right on a critical module.
- property description: strο
Description of the rule.
- property name: strο
Name of the rule.
- property rule_category: RuleCategoryο
MATRIX (matrix rules).
- Type:
Rule category
- property severity: SeverityTypeο
Severity level of the rule.
- property target_entity: strο
Entity targeted by the rule.
- class assets_guardian.plugins.dolibarr.matrix.DolibarrSuperadminRule(**kwargs: Any)[source]ο
Bases:
IMatrixRuleVerifies that Dolibarr superadmins are authorized by the authorization matrix.
A user is superadmin if their admin field is 1 in Dolibarr. The matrix is queried with the key (profile, βDolibarrβ) to determine if the profile authorizes superadmin access.
- evaluate(accesses: Iterable[Access], matrix: dict[tuple[str, str], str], profiles: dict[str, list[str]]) Iterable[Finding][source]ο
Verifies each access of type group where the user is superadmin.
For each group access carrying the is_admin flag, we verify that the userβs profile authorizes the superadmin role in the matrix.
ARCH-LIMIT: The is_admin flag (Dolibarr admin) is duplicated in Access.metadata because IMatrixRule only receives accesses, not identities. See DolibarrCollector.__build_accesses_for_user().
- Parameters:
accesses β All collected accesses for Dolibarr.
matrix β Authorization matrix (profile, role) -> authorized permission.
profiles β Mapping email -> list of profiles.
- Yields:
Finding β One Finding per unauthorized superadmin according to the matrix.
- property description: strο
Description of the rule.
- property name: strο
Name of the rule.
- property rule_category: RuleCategoryο
MATRIX (matrix rules).
- Type:
Rule category
- property severity: SeverityTypeο
Severity level of the rule.
- property target_entity: strο
Entity targeted by the rule.