assets_guardian.plugins.gitlab.compare

Functions

index_users(users)

Indexes users by their external identifier.

Classes

GitlabDeletedUserComparisonRule(**kwargs)

Detects deleted users in GitLab.

GitlabNewUserComparisonRule(**kwargs)

Detects new GitLab users created or added.

GitlabUserPrivilegeComparisonRule(**kwargs)

Detects changes in GitLab users' administrator privileges.

GitlabUserStatusComparisonRule(**kwargs)

Detects user status changes (active/blocked) on GitLab.

class assets_guardian.plugins.gitlab.compare.GitlabDeletedUserComparisonRule(**kwargs: Any)[source]

Bases: IComparisonRule

Detects deleted users in GitLab.

evaluate(old_entries: Iterable[Identity], new_entries: Iterable[Identity]) Iterable[Finding][source]

Compares lists to identify deleted users.

Parameters:
  • old_entries – The old identities (baseline).

  • new_entries – The new collected identities.

Yields:

Finding – Detected discrepancy for each deleted user.

property description: str

Description of the rule.

property name: str

Name of the rule.

property severity: SeverityType

Severity level of the rule.

property target_entity: str

Entity targeted by the rule.

class assets_guardian.plugins.gitlab.compare.GitlabNewUserComparisonRule(**kwargs: Any)[source]

Bases: IComparisonRule

Detects new GitLab users created or added.

evaluate(old_entries: Iterable[Identity], new_entries: Iterable[Identity]) Iterable[Finding][source]

Compares lists to identify new users.

Parameters:
  • old_entries – The old identities (baseline).

  • new_entries – The new collected identities.

Yields:

Finding – Detected discrepancy for each new user.

property description: str

Description of the rule.

property name: str

Name of the rule.

property severity: SeverityType

Severity level of the rule.

property target_entity: str

Entity targeted by the rule.

class assets_guardian.plugins.gitlab.compare.GitlabUserPrivilegeComparisonRule(**kwargs: Any)[source]

Bases: IComparisonRule

Detects changes in GitLab users’ administrator privileges.

evaluate(old_entries: Iterable[Identity], new_entries: Iterable[Identity]) Iterable[Finding][source]

Compares lists to identify privilege changes.

Parameters:
  • old_entries – The old identities (baseline).

  • new_entries – The new collected identities.

Yields:

Finding – Detected discrepancy for each user whose admin role changed.

property description: str

Description of the rule.

property name: str

Name of the rule.

property severity: SeverityType

Severity level of the rule.

property target_entity: str

Entity targeted by the rule.

class assets_guardian.plugins.gitlab.compare.GitlabUserStatusComparisonRule(**kwargs: Any)[source]

Bases: IComparisonRule

Detects user status changes (active/blocked) on GitLab.

evaluate(old_entries: Iterable[Identity], new_entries: Iterable[Identity]) Iterable[Finding][source]

Compares lists to identify status changes.

Parameters:
  • old_entries – The old identities (baseline).

  • new_entries – The new collected identities.

Yields:

Finding – Detected discrepancy for each user whose status changed.

property description: str

Description of the rule.

property name: str

Name of the rule.

property severity: SeverityType

Severity level of the rule.

property target_entity: str

Entity targeted by the rule.

assets_guardian.plugins.gitlab.compare.index_users(users: Iterable[Identity]) dict[str, Identity][source]

Indexes users by their external identifier.

Parameters:

users – The user identities to index.

Returns:

Dictionary mapping external_id to the Identity object.

Return type:

dict[str, Identity]