diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 2eedc1e35..b94bdd6ec 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -8,7 +8,7 @@ authors = [ ] [tool.poetry.dependencies] -python = ">= 3.10, < 3.12" +python = ">= 3.10, < 3.13" # Django # ------------------------------------------------------------------------------ django = "4.2.8" # https://www.djangoproject.com/ diff --git a/backend/unittests/access_control/api/test_authorization_api_configurations.py b/backend/unittests/access_control/api/test_authorization_api_configurations.py index 4d6ba85cd..9525cdbb1 100644 --- a/backend/unittests/access_control/api/test_authorization_api_configurations.py +++ b/backend/unittests/access_control/api/test_authorization_api_configurations.py @@ -6,14 +6,14 @@ class TestAuthorizationApiConfigurations(TestAuthorizationBase): def test_authorization_api_configurations(self): - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('product_data', OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])])), ('name', 'db_api_configuration_internal'), ('base_url', 'http://localhost:8080'), ('project_key', 'secobserve'), ('api_key', '__secret__'), ('product', 1), ('parser', 2)]), OrderedDict([('id', 2), ('product_data', OrderedDict([('id', 2), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_external'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', None), ('security_gate_active', False), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', None), ('repository_default_branch', 3), ('members', [3, 4, 5])])), ('name', 'db_api_configuration_external'), ('base_url', 'http://localhost:8080'), ('project_key', 'secobserve'), ('api_key', '__secret__'), ('product', 2), ('parser', 2)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'db_api_configuration_internal', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 1, 'parser': 2}), OrderedDict({'id': 2, 'product_data': OrderedDict({'id': 2, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_external', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': None, 'security_gate_active': False, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': None, 'repository_default_branch': 3, 'members': [3, 4, 5]}), 'name': 'db_api_configuration_external', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 2, 'parser': 2})]})" self._test_api( APITest( "db_admin", "get", "/api/api_configurations/", None, 200, expected_data ) ) - expected_data = "OrderedDict([('count', 1), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('product_data', OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])])), ('name', 'db_api_configuration_internal'), ('base_url', 'http://localhost:8080'), ('project_key', 'secobserve'), ('api_key', '__secret__'), ('product', 1), ('parser', 2)])])])" + expected_data = "OrderedDict({'count': 1, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'db_api_configuration_internal', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 1, 'parser': 2})]})" self._test_api( APITest( "db_internal_write", @@ -25,7 +25,7 @@ def test_authorization_api_configurations(self): ) ) - expected_data = "{'id': 1, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'name': 'db_api_configuration_internal', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 1, 'parser': 2}" + expected_data = "{'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'db_api_configuration_internal', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 1, 'parser': 2}" self._test_api( APITest( "db_internal_write", @@ -83,7 +83,7 @@ def test_authorization_api_configurations(self): ) ) - expected_data = "{'id': 3, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'name': 'string', 'base_url': 'string', 'project_key': 'string', 'api_key': 'string', 'product': 1, 'parser': 2}" + expected_data = "{'id': 3, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'string', 'base_url': 'string', 'project_key': 'string', 'api_key': 'string', 'product': 1, 'parser': 2}" self._test_api( APITest( "db_internal_write", @@ -109,7 +109,7 @@ def test_authorization_api_configurations(self): ) ) - expected_data = "{'id': 1, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'name': 'changed', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 1, 'parser': 2}" + expected_data = "{'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'changed', 'base_url': 'http://localhost:8080', 'project_key': 'secobserve', 'api_key': '__secret__', 'product': 1, 'parser': 2}" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_branches.py b/backend/unittests/access_control/api/test_authorization_branches.py index ff7928260..3152fd7b6 100644 --- a/backend/unittests/access_control/api/test_authorization_branches.py +++ b/backend/unittests/access_control/api/test_authorization_branches.py @@ -6,12 +6,12 @@ class TestAuthorizationBranches(TestAuthorizationBase): def test_authorization_branches(self): - expected_data = "OrderedDict([('count', 3), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('name_with_product', 'db_branch_internal_dev (db_product_internal)'), ('is_default_branch', True), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_branch_internal_dev'), ('last_import', None), ('housekeeping_protect', False), ('product', 1)]), OrderedDict([('id', 2), ('name_with_product', 'db_branch_internal_main (db_product_internal)'), ('is_default_branch', False), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_branch_internal_main'), ('last_import', None), ('housekeeping_protect', False), ('product', 1)]), OrderedDict([('id', 3), ('name_with_product', 'db_branch_external (db_product_external)'), ('is_default_branch', True), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_branch_external'), ('last_import', None), ('housekeeping_protect', False), ('product', 2)])])])" + expected_data = "OrderedDict({'count': 3, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'name_with_product': 'db_branch_internal_dev (db_product_internal)', 'is_default_branch': True, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_branch_internal_dev', 'last_import': None, 'housekeeping_protect': False, 'product': 1}), OrderedDict({'id': 2, 'name_with_product': 'db_branch_internal_main (db_product_internal)', 'is_default_branch': False, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_branch_internal_main', 'last_import': None, 'housekeeping_protect': False, 'product': 1}), OrderedDict({'id': 3, 'name_with_product': 'db_branch_external (db_product_external)', 'is_default_branch': True, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_branch_external', 'last_import': None, 'housekeeping_protect': False, 'product': 2})]})" self._test_api( APITest("db_admin", "get", "/api/branches/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('name_with_product', 'db_branch_internal_dev (db_product_internal)'), ('is_default_branch', True), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_branch_internal_dev'), ('last_import', None), ('housekeeping_protect', False), ('product', 1)]), OrderedDict([('id', 2), ('name_with_product', 'db_branch_internal_main (db_product_internal)'), ('is_default_branch', False), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_branch_internal_main'), ('last_import', None), ('housekeeping_protect', False), ('product', 1)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'name_with_product': 'db_branch_internal_dev (db_product_internal)', 'is_default_branch': True, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_branch_internal_dev', 'last_import': None, 'housekeeping_protect': False, 'product': 1}), OrderedDict({'id': 2, 'name_with_product': 'db_branch_internal_main (db_product_internal)', 'is_default_branch': False, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_branch_internal_main', 'last_import': None, 'housekeeping_protect': False, 'product': 1})]})" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_general_rules.py b/backend/unittests/access_control/api/test_authorization_general_rules.py index 6bc3ef5d0..6cd3eec80 100644 --- a/backend/unittests/access_control/api/test_authorization_general_rules.py +++ b/backend/unittests/access_control/api/test_authorization_general_rules.py @@ -8,7 +8,7 @@ class TestAuthorizationGeneralRules(TestAuthorizationBase): def test_authorization_general_rules(self): # --- general_rules --- - expected_data = "OrderedDict([('count', 1), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 3), ('name', 'db_general_rule'), ('description', ''), ('scanner_prefix', ''), ('title', ''), ('description_observation', ''), ('origin_component_name_version', ''), ('origin_docker_image_name_tag', ''), ('origin_endpoint_url', ''), ('origin_service_name', ''), ('origin_source_file', ''), ('new_severity', ''), ('new_status', ''), ('enabled', True), ('parser', 1)])])])" + expected_data = "OrderedDict({'count': 1, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 3, 'name': 'db_general_rule', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': '', 'enabled': True, 'parser': 1})]})" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_notifications.py b/backend/unittests/access_control/api/test_authorization_notifications.py index e78538e86..f7a441856 100644 --- a/backend/unittests/access_control/api/test_authorization_notifications.py +++ b/backend/unittests/access_control/api/test_authorization_notifications.py @@ -6,12 +6,12 @@ class TestAuthorizationNotifications(TestAuthorizationBase): def test_authorization_notifications(self): - expected_data = "OrderedDict([('count', 6), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('message', 'message_exception_internal'), ('product_name', 'db_product_internal'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_internal_write'), ('name', 'exception_internal'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Exception'), ('function', ''), ('arguments', ''), ('user', 2), ('product', 1), ('observation', 1)]), OrderedDict([('id', 2), ('message', 'message_exception_external'), ('product_name', 'db_product_external'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_external'), ('name', 'exception_external'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Exception'), ('function', ''), ('arguments', ''), ('user', 4), ('product', 2), ('observation', 2)]), OrderedDict([('id', 3), ('message', ''), ('product_name', 'db_product_internal'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_internal_write'), ('name', 'security_gate_internal'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Security gate'), ('function', ''), ('arguments', ''), ('user', 2), ('product', 1), ('observation', 1)]), OrderedDict([('id', 4), ('message', ''), ('product_name', 'db_product_external'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_external'), ('name', 'security_gate_internal'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Security gate'), ('function', ''), ('arguments', ''), ('user', 4), ('product', 2), ('observation', 2)]), OrderedDict([('id', 5), ('message', 'message_task_internal'), ('product_name', 'db_product_internal'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_internal_write'), ('name', 'task_internal'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Task'), ('function', 'function_task_internal'), ('arguments', 'arguments_task_internal'), ('user', 2), ('product', 1), ('observation', 1)]), OrderedDict([('id', 6), ('message', 'message_task_external'), ('product_name', 'db_product_external'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_external'), ('name', 'task_external'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Task'), ('function', 'function_task_external'), ('arguments', 'arguments_task_external'), ('user', 4), ('product', 2), ('observation', 2)])])])" + expected_data = "OrderedDict({'count': 6, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'message': 'message_exception_internal', 'product_name': 'db_product_internal', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_internal_write', 'name': 'exception_internal', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Exception', 'function': '', 'arguments': '', 'user': 2, 'product': 1, 'observation': 1}), OrderedDict({'id': 2, 'message': 'message_exception_external', 'product_name': 'db_product_external', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_external', 'name': 'exception_external', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Exception', 'function': '', 'arguments': '', 'user': 4, 'product': 2, 'observation': 2}), OrderedDict({'id': 3, 'message': '', 'product_name': 'db_product_internal', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_internal_write', 'name': 'security_gate_internal', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Security gate', 'function': '', 'arguments': '', 'user': 2, 'product': 1, 'observation': 1}), OrderedDict({'id': 4, 'message': '', 'product_name': 'db_product_external', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_external', 'name': 'security_gate_internal', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Security gate', 'function': '', 'arguments': '', 'user': 4, 'product': 2, 'observation': 2}), OrderedDict({'id': 5, 'message': 'message_task_internal', 'product_name': 'db_product_internal', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_internal_write', 'name': 'task_internal', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Task', 'function': 'function_task_internal', 'arguments': 'arguments_task_internal', 'user': 2, 'product': 1, 'observation': 1}), OrderedDict({'id': 6, 'message': 'message_task_external', 'product_name': 'db_product_external', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_external', 'name': 'task_external', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Task', 'function': 'function_task_external', 'arguments': 'arguments_task_external', 'user': 4, 'product': 2, 'observation': 2})]})" self._test_api( APITest("db_admin", "get", "/api/notifications/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 3), ('message', ''), ('product_name', 'db_product_internal'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_internal_write'), ('name', 'security_gate_internal'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Security gate'), ('function', ''), ('arguments', ''), ('user', 2), ('product', 1), ('observation', 1)]), OrderedDict([('id', 5), ('message', '...'), ('product_name', 'db_product_internal'), ('observation_title', 'db_observation_internal'), ('user_full_name', 'db_internal_write'), ('name', 'task_internal'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('type', 'Task'), ('function', 'function_task_internal'), ('arguments', 'arguments_task_internal'), ('user', 2), ('product', 1), ('observation', 1)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 3, 'message': '', 'product_name': 'db_product_internal', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_internal_write', 'name': 'security_gate_internal', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Security gate', 'function': '', 'arguments': '', 'user': 2, 'product': 1, 'observation': 1}), OrderedDict({'id': 5, 'message': '...', 'product_name': 'db_product_internal', 'observation_title': 'db_observation_internal', 'user_full_name': 'db_internal_write', 'name': 'task_internal', 'created': '2022-12-15T17:10:35.518000+01:00', 'type': 'Task', 'function': 'function_task_internal', 'arguments': 'arguments_task_internal', 'user': 2, 'product': 1, 'observation': 1})]})" self._test_api( APITest( "db_internal_write", @@ -60,7 +60,9 @@ def test_authorization_notifications(self): ) ) - expected_data = "OrderedDict([('count', 0), ('next', None), ('previous', None), ('results', [])])" + expected_data = ( + "OrderedDict({'count': 0, 'next': None, 'previous': None, 'results': []})" + ) self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_observations.py b/backend/unittests/access_control/api/test_authorization_observations.py index 76203e503..8bbab2d07 100644 --- a/backend/unittests/access_control/api/test_authorization_observations.py +++ b/backend/unittests/access_control/api/test_authorization_observations.py @@ -6,12 +6,12 @@ class TestAuthorizationObservations(TestAuthorizationBase): def test_authorization_observations(self): - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('product_data', OrderedDict([('id', 1), ('product_group_name', 'db_product_group'), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1)])), ('branch_name', 'db_branch_internal_dev'), ('parser_data', OrderedDict([('id', 1), ('name', 'db_parser_file'), ('type', 'DAST'), ('source', 'File')])), ('scanner_name', 'db_parser'), ('origin_component_name_version', ''), ('title', 'db_observation_internal'), ('description', ''), ('recommendation', ''), ('current_severity', 'Medium'), ('parser_severity', 'Medium'), ('rule_severity', ''), ('assessment_severity', ''), ('current_status', 'Duplicate'), ('parser_status', 'Open'), ('rule_status', 'Duplicate'), ('assessment_status', ''), ('scanner_observation_id', ''), ('vulnerability_id', ''), ('origin_component_name', ''), ('origin_component_version', ''), ('origin_component_purl', ''), ('origin_component_cpe', ''), ('origin_component_dependencies', ''), ('origin_docker_image_name', ''), ('origin_docker_image_tag', ''), ('origin_docker_image_name_tag', ''), ('origin_docker_image_name_tag_short', ''), ('origin_endpoint_url', ''), ('origin_endpoint_scheme', ''), ('origin_endpoint_hostname', ''), ('origin_endpoint_port', None), ('origin_endpoint_path', ''), ('origin_endpoint_params', ''), ('origin_endpoint_query', ''), ('origin_endpoint_fragment', ''), ('origin_service_name', 'db_service_internal_backend'), ('origin_source_file', ''), ('origin_source_line_start', None), ('origin_source_line_end', None), ('cvss3_score', None), ('cvss3_vector', ''), ('cwe', None), ('epss_score', None), ('epss_percentile', None), ('found', None), ('scanner', 'db_parser'), ('upload_filename', 'parser.json'), ('api_configuration_name', ''), ('import_last_seen', '2022-12-15T17:14:20.870000+01:00'), ('created', '2022-12-15T17:10:35.513000+01:00'), ('modified', '2022-12-16T17:13:18.282000+01:00'), ('last_observation_log', '2022-12-16T17:13:18.281000+01:00'), ('identity_hash', '6eef8088480aa2523aeeb64ad35f876a942cc3172cfb36752f3a052a4f88642c'), ('issue_tracker_issue_id', ''), ('product', 1), ('branch', 1), ('parser', 1), ('origin_service', 1), ('general_rule', None), ('product_rule', 1)]), OrderedDict([('id', 2), ('product_data', OrderedDict([('id', 2), ('product_group_name', ''), ('name', 'db_product_external'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', None), ('security_gate_active', False), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', None), ('repository_default_branch', 3)])), ('branch_name', ''), ('parser_data', OrderedDict([('id', 1), ('name', 'db_parser_file'), ('type', 'DAST'), ('source', 'File')])), ('scanner_name', 'db_parser'), ('origin_component_name_version', ''), ('title', 'db_observation_internal'), ('description', ''), ('recommendation', ''), ('current_severity', 'Medium'), ('parser_severity', 'Medium'), ('rule_severity', ''), ('assessment_severity', ''), ('current_status', 'False positive'), ('parser_status', 'Open'), ('rule_status', 'False positive'), ('assessment_status', ''), ('scanner_observation_id', ''), ('vulnerability_id', ''), ('origin_component_name', ''), ('origin_component_version', ''), ('origin_component_purl', ''), ('origin_component_cpe', ''), ('origin_component_dependencies', ''), ('origin_docker_image_name', ''), ('origin_docker_image_tag', ''), ('origin_docker_image_name_tag', ''), ('origin_docker_image_name_tag_short', ''), ('origin_endpoint_url', ''), ('origin_endpoint_scheme', ''), ('origin_endpoint_hostname', ''), ('origin_endpoint_port', None), ('origin_endpoint_path', ''), ('origin_endpoint_params', ''), ('origin_endpoint_query', ''), ('origin_endpoint_fragment', ''), ('origin_service_name', ''), ('origin_source_file', ''), ('origin_source_line_start', None), ('origin_source_line_end', None), ('cvss3_score', None), ('cvss3_vector', ''), ('cwe', None), ('epss_score', None), ('epss_percentile', None), ('found', None), ('scanner', 'db_parser'), ('upload_filename', 'parser.json'), ('api_configuration_name', ''), ('import_last_seen', '2022-12-15T17:14:20.876000+01:00'), ('created', '2022-12-15T17:10:35.521000+01:00'), ('modified', '2022-12-16T17:13:18.283000+01:00'), ('last_observation_log', '2022-12-16T17:13:18.283000+01:00'), ('identity_hash', 'bc8e59b7687fe3533616b3914c636389c131eac3bdbda1b67d8d26f890a74007'), ('issue_tracker_issue_id', ''), ('product', 2), ('branch', None), ('parser', 1), ('origin_service', None), ('general_rule', None), ('product_rule', 2)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'product_data': OrderedDict({'id': 1, 'product_group_name': 'db_product_group', 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1}), 'branch_name': 'db_branch_internal_dev', 'parser_data': OrderedDict({'id': 1, 'name': 'db_parser_file', 'type': 'DAST', 'source': 'File'}), 'scanner_name': 'db_parser', 'origin_component_name_version': '', 'title': 'db_observation_internal', 'description': '', 'recommendation': '', 'current_severity': 'Medium', 'parser_severity': 'Medium', 'rule_severity': '', 'assessment_severity': '', 'current_status': 'Duplicate', 'parser_status': 'Open', 'rule_status': 'Duplicate', 'assessment_status': '', 'scanner_observation_id': '', 'vulnerability_id': '', 'origin_component_name': '', 'origin_component_version': '', 'origin_component_purl': '', 'origin_component_cpe': '', 'origin_component_dependencies': '', 'origin_docker_image_name': '', 'origin_docker_image_tag': '', 'origin_docker_image_name_tag': '', 'origin_docker_image_name_tag_short': '', 'origin_endpoint_url': '', 'origin_endpoint_scheme': '', 'origin_endpoint_hostname': '', 'origin_endpoint_port': None, 'origin_endpoint_path': '', 'origin_endpoint_params': '', 'origin_endpoint_query': '', 'origin_endpoint_fragment': '', 'origin_service_name': 'db_service_internal_backend', 'origin_source_file': '', 'origin_source_line_start': None, 'origin_source_line_end': None, 'cvss3_score': None, 'cvss3_vector': '', 'cwe': None, 'epss_score': None, 'epss_percentile': None, 'found': None, 'scanner': 'db_parser', 'upload_filename': 'parser.json', 'api_configuration_name': '', 'import_last_seen': '2022-12-15T17:14:20.870000+01:00', 'created': '2022-12-15T17:10:35.513000+01:00', 'modified': '2022-12-16T17:13:18.282000+01:00', 'last_observation_log': '2022-12-16T17:13:18.281000+01:00', 'identity_hash': '6eef8088480aa2523aeeb64ad35f876a942cc3172cfb36752f3a052a4f88642c', 'issue_tracker_issue_id': '', 'product': 1, 'branch': 1, 'parser': 1, 'origin_service': 1, 'general_rule': None, 'product_rule': 1}), OrderedDict({'id': 2, 'product_data': OrderedDict({'id': 2, 'product_group_name': '', 'name': 'db_product_external', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': None, 'security_gate_active': False, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': None, 'repository_default_branch': 3}), 'branch_name': '', 'parser_data': OrderedDict({'id': 1, 'name': 'db_parser_file', 'type': 'DAST', 'source': 'File'}), 'scanner_name': 'db_parser', 'origin_component_name_version': '', 'title': 'db_observation_internal', 'description': '', 'recommendation': '', 'current_severity': 'Medium', 'parser_severity': 'Medium', 'rule_severity': '', 'assessment_severity': '', 'current_status': 'False positive', 'parser_status': 'Open', 'rule_status': 'False positive', 'assessment_status': '', 'scanner_observation_id': '', 'vulnerability_id': '', 'origin_component_name': '', 'origin_component_version': '', 'origin_component_purl': '', 'origin_component_cpe': '', 'origin_component_dependencies': '', 'origin_docker_image_name': '', 'origin_docker_image_tag': '', 'origin_docker_image_name_tag': '', 'origin_docker_image_name_tag_short': '', 'origin_endpoint_url': '', 'origin_endpoint_scheme': '', 'origin_endpoint_hostname': '', 'origin_endpoint_port': None, 'origin_endpoint_path': '', 'origin_endpoint_params': '', 'origin_endpoint_query': '', 'origin_endpoint_fragment': '', 'origin_service_name': '', 'origin_source_file': '', 'origin_source_line_start': None, 'origin_source_line_end': None, 'cvss3_score': None, 'cvss3_vector': '', 'cwe': None, 'epss_score': None, 'epss_percentile': None, 'found': None, 'scanner': 'db_parser', 'upload_filename': 'parser.json', 'api_configuration_name': '', 'import_last_seen': '2022-12-15T17:14:20.876000+01:00', 'created': '2022-12-15T17:10:35.521000+01:00', 'modified': '2022-12-16T17:13:18.283000+01:00', 'last_observation_log': '2022-12-16T17:13:18.283000+01:00', 'identity_hash': 'bc8e59b7687fe3533616b3914c636389c131eac3bdbda1b67d8d26f890a74007', 'issue_tracker_issue_id': '', 'product': 2, 'branch': None, 'parser': 1, 'origin_service': None, 'general_rule': None, 'product_rule': 2})]})" self._test_api( APITest("db_admin", "get", "/api/observations/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 1), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('product_data', OrderedDict([('id', 1), ('product_group_name', 'db_product_group'), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1)])), ('branch_name', 'db_branch_internal_dev'), ('parser_data', OrderedDict([('id', 1), ('name', 'db_parser_file'), ('type', 'DAST'), ('source', 'File')])), ('scanner_name', 'db_parser'), ('origin_component_name_version', ''), ('title', 'db_observation_internal'), ('description', ''), ('recommendation', ''), ('current_severity', 'Medium'), ('parser_severity', 'Medium'), ('rule_severity', ''), ('assessment_severity', ''), ('current_status', 'Duplicate'), ('parser_status', 'Open'), ('rule_status', 'Duplicate'), ('assessment_status', ''), ('scanner_observation_id', ''), ('vulnerability_id', ''), ('origin_component_name', ''), ('origin_component_version', ''), ('origin_component_purl', ''), ('origin_component_cpe', ''), ('origin_component_dependencies', ''), ('origin_docker_image_name', ''), ('origin_docker_image_tag', ''), ('origin_docker_image_name_tag', ''), ('origin_docker_image_name_tag_short', ''), ('origin_endpoint_url', ''), ('origin_endpoint_scheme', ''), ('origin_endpoint_hostname', ''), ('origin_endpoint_port', None), ('origin_endpoint_path', ''), ('origin_endpoint_params', ''), ('origin_endpoint_query', ''), ('origin_endpoint_fragment', ''), ('origin_service_name', 'db_service_internal_backend'), ('origin_source_file', ''), ('origin_source_line_start', None), ('origin_source_line_end', None), ('cvss3_score', None), ('cvss3_vector', ''), ('cwe', None), ('epss_score', None), ('epss_percentile', None), ('found', None), ('scanner', 'db_parser'), ('upload_filename', 'parser.json'), ('api_configuration_name', ''), ('import_last_seen', '2022-12-15T17:14:20.870000+01:00'), ('created', '2022-12-15T17:10:35.513000+01:00'), ('modified', '2022-12-16T17:13:18.282000+01:00'), ('last_observation_log', '2022-12-16T17:13:18.281000+01:00'), ('identity_hash', '6eef8088480aa2523aeeb64ad35f876a942cc3172cfb36752f3a052a4f88642c'), ('issue_tracker_issue_id', ''), ('product', 1), ('branch', 1), ('parser', 1), ('origin_service', 1), ('general_rule', None), ('product_rule', 1)])])])" + expected_data = "OrderedDict({'count': 1, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'product_data': OrderedDict({'id': 1, 'product_group_name': 'db_product_group', 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1}), 'branch_name': 'db_branch_internal_dev', 'parser_data': OrderedDict({'id': 1, 'name': 'db_parser_file', 'type': 'DAST', 'source': 'File'}), 'scanner_name': 'db_parser', 'origin_component_name_version': '', 'title': 'db_observation_internal', 'description': '', 'recommendation': '', 'current_severity': 'Medium', 'parser_severity': 'Medium', 'rule_severity': '', 'assessment_severity': '', 'current_status': 'Duplicate', 'parser_status': 'Open', 'rule_status': 'Duplicate', 'assessment_status': '', 'scanner_observation_id': '', 'vulnerability_id': '', 'origin_component_name': '', 'origin_component_version': '', 'origin_component_purl': '', 'origin_component_cpe': '', 'origin_component_dependencies': '', 'origin_docker_image_name': '', 'origin_docker_image_tag': '', 'origin_docker_image_name_tag': '', 'origin_docker_image_name_tag_short': '', 'origin_endpoint_url': '', 'origin_endpoint_scheme': '', 'origin_endpoint_hostname': '', 'origin_endpoint_port': None, 'origin_endpoint_path': '', 'origin_endpoint_params': '', 'origin_endpoint_query': '', 'origin_endpoint_fragment': '', 'origin_service_name': 'db_service_internal_backend', 'origin_source_file': '', 'origin_source_line_start': None, 'origin_source_line_end': None, 'cvss3_score': None, 'cvss3_vector': '', 'cwe': None, 'epss_score': None, 'epss_percentile': None, 'found': None, 'scanner': 'db_parser', 'upload_filename': 'parser.json', 'api_configuration_name': '', 'import_last_seen': '2022-12-15T17:14:20.870000+01:00', 'created': '2022-12-15T17:10:35.513000+01:00', 'modified': '2022-12-16T17:13:18.282000+01:00', 'last_observation_log': '2022-12-16T17:13:18.281000+01:00', 'identity_hash': '6eef8088480aa2523aeeb64ad35f876a942cc3172cfb36752f3a052a4f88642c', 'issue_tracker_issue_id': '', 'product': 1, 'branch': 1, 'parser': 1, 'origin_service': 1, 'general_rule': None, 'product_rule': 1})]})" self._test_api( APITest( "db_internal_write", @@ -22,7 +22,7 @@ def test_authorization_observations(self): expected_data, ) ) - expected_data = "{'id': 1, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'branch_name': 'db_branch_internal_dev', 'parser_data': OrderedDict([('id', 1), ('name', 'db_parser_file'), ('type', 'DAST'), ('source', 'File')]), 'observation_logs': [OrderedDict([('id', 2), ('severity', ''), ('status', 'Duplicate'), ('comment', 'Set by product rule'), ('created', '2022-12-15T17:10:35.524000+01:00'), ('user', 2)]), OrderedDict([('id', 1), ('severity', 'Medium'), ('status', 'Open'), ('comment', 'Set by parser'), ('created', '2022-12-15T17:10:35.518000+01:00'), ('user', 2)])], 'references': [], 'evidences': [OrderedDict([('id', 1), ('name', 'db_evidence_internal')])], 'origin_source_file_url': None, 'issue_tracker_issue_url': None, 'title': 'db_observation_internal', 'description': '', 'recommendation': '', 'current_severity': 'Medium', 'parser_severity': 'Medium', 'rule_severity': '', 'assessment_severity': '', 'current_status': 'Duplicate', 'parser_status': 'Open', 'rule_status': 'Duplicate', 'assessment_status': '', 'scanner_observation_id': '', 'vulnerability_id': '', 'origin_component_name': '', 'origin_component_version': '', 'origin_component_name_version': '', 'origin_component_purl': '', 'origin_component_cpe': '', 'origin_component_dependencies': '', 'origin_docker_image_name': '', 'origin_docker_image_tag': '', 'origin_docker_image_name_tag': '', 'origin_docker_image_name_tag_short': '', 'origin_endpoint_url': '', 'origin_endpoint_scheme': '', 'origin_endpoint_hostname': '', 'origin_endpoint_port': None, 'origin_endpoint_path': '', 'origin_endpoint_params': '', 'origin_endpoint_query': '', 'origin_endpoint_fragment': '', 'origin_service_name': 'db_service_internal_backend', 'origin_source_file': '', 'origin_source_line_start': None, 'origin_source_line_end': None, 'cvss3_score': None, 'cvss3_vector': '', 'cwe': None, 'epss_score': None, 'epss_percentile': None, 'found': None, 'scanner': 'db_parser', 'upload_filename': 'parser.json', 'api_configuration_name': '', 'import_last_seen': '2022-12-15T17:14:20.870000+01:00', 'created': '2022-12-15T17:10:35.513000+01:00', 'modified': '2022-12-16T17:13:18.282000+01:00', 'last_observation_log': '2022-12-16T17:13:18.281000+01:00', 'identity_hash': '6eef8088480aa2523aeeb64ad35f876a942cc3172cfb36752f3a052a4f88642c', 'issue_tracker_issue_id': '', 'product': 1, 'branch': 1, 'parser': 1, 'origin_service': 1, 'general_rule': None, 'product_rule': 1}" + expected_data = "{'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'branch_name': 'db_branch_internal_dev', 'parser_data': OrderedDict({'id': 1, 'name': 'db_parser_file', 'type': 'DAST', 'source': 'File'}), 'observation_logs': [OrderedDict({'id': 2, 'severity': '', 'status': 'Duplicate', 'comment': 'Set by product rule', 'created': '2022-12-15T17:10:35.524000+01:00', 'user': 2}), OrderedDict({'id': 1, 'severity': 'Medium', 'status': 'Open', 'comment': 'Set by parser', 'created': '2022-12-15T17:10:35.518000+01:00', 'user': 2})], 'references': [], 'evidences': [OrderedDict({'id': 1, 'name': 'db_evidence_internal'})], 'origin_source_file_url': None, 'issue_tracker_issue_url': None, 'title': 'db_observation_internal', 'description': '', 'recommendation': '', 'current_severity': 'Medium', 'parser_severity': 'Medium', 'rule_severity': '', 'assessment_severity': '', 'current_status': 'Duplicate', 'parser_status': 'Open', 'rule_status': 'Duplicate', 'assessment_status': '', 'scanner_observation_id': '', 'vulnerability_id': '', 'origin_component_name': '', 'origin_component_version': '', 'origin_component_name_version': '', 'origin_component_purl': '', 'origin_component_cpe': '', 'origin_component_dependencies': '', 'origin_docker_image_name': '', 'origin_docker_image_tag': '', 'origin_docker_image_name_tag': '', 'origin_docker_image_name_tag_short': '', 'origin_endpoint_url': '', 'origin_endpoint_scheme': '', 'origin_endpoint_hostname': '', 'origin_endpoint_port': None, 'origin_endpoint_path': '', 'origin_endpoint_params': '', 'origin_endpoint_query': '', 'origin_endpoint_fragment': '', 'origin_service_name': 'db_service_internal_backend', 'origin_source_file': '', 'origin_source_line_start': None, 'origin_source_line_end': None, 'cvss3_score': None, 'cvss3_vector': '', 'cwe': None, 'epss_score': None, 'epss_percentile': None, 'found': None, 'scanner': 'db_parser', 'upload_filename': 'parser.json', 'api_configuration_name': '', 'import_last_seen': '2022-12-15T17:14:20.870000+01:00', 'created': '2022-12-15T17:10:35.513000+01:00', 'modified': '2022-12-16T17:13:18.282000+01:00', 'last_observation_log': '2022-12-16T17:13:18.281000+01:00', 'identity_hash': '6eef8088480aa2523aeeb64ad35f876a942cc3172cfb36752f3a052a4f88642c', 'issue_tracker_issue_id': '', 'product': 1, 'branch': 1, 'parser': 1, 'origin_service': 1, 'general_rule': None, 'product_rule': 1}" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_product_api_tokens.py b/backend/unittests/access_control/api/test_authorization_product_api_tokens.py index 173190aee..6d9745944 100644 --- a/backend/unittests/access_control/api/test_authorization_product_api_tokens.py +++ b/backend/unittests/access_control/api/test_authorization_product_api_tokens.py @@ -7,7 +7,7 @@ class TestAuthorizationProductApiTokens(TestAuthorizationBase): def test_authorization_product_api_tokens(self): expected_data = ( - "{'results': [OrderedDict([('id', 2), ('role', )])]}" + "{'results': [OrderedDict({'id': 2, 'role': })]}" ) self._test_api( APITest( @@ -57,7 +57,7 @@ def test_authorization_product_api_tokens(self): ) expected_data = ( - "{'results': [OrderedDict([('id', 1), ('role', )])]}" + "{'results': [OrderedDict({'id': 1, 'role': })]}" ) self._test_api( APITest( diff --git a/backend/unittests/access_control/api/test_authorization_product_groups.py b/backend/unittests/access_control/api/test_authorization_product_groups.py index eb1c42c30..6b91e7274 100644 --- a/backend/unittests/access_control/api/test_authorization_product_groups.py +++ b/backend/unittests/access_control/api/test_authorization_product_groups.py @@ -6,12 +6,12 @@ class TestAuthorizationProductGroups(TestAuthorizationBase): def test_product_groups_authorization(self): - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 3), ('name', 'db_product_group'), ('description', ''), ('products_count', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None)]), OrderedDict([('id', 4), ('name', 'db_product_group_admin_only'), ('description', ''), ('products_count', 0), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 3, 'name': 'db_product_group', 'description': '', 'products_count': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None}), OrderedDict({'id': 4, 'name': 'db_product_group_admin_only', 'description': '', 'products_count': 0, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None})]})" self._test_api( APITest("db_admin", "get", "/api/product_groups/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 1), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 3), ('name', 'db_product_group'), ('description', ''), ('products_count', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None)])])])" + expected_data = "OrderedDict({'count': 1, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 3, 'name': 'db_product_group', 'description': '', 'products_count': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None})]})" self._test_api( APITest( "db_product_group_user", diff --git a/backend/unittests/access_control/api/test_authorization_product_members.py b/backend/unittests/access_control/api/test_authorization_product_members.py index e6ee3e730..a3959b261 100644 --- a/backend/unittests/access_control/api/test_authorization_product_members.py +++ b/backend/unittests/access_control/api/test_authorization_product_members.py @@ -6,14 +6,14 @@ class TestAuthorizationProductMembers(TestAuthorizationBase): def test_authorization_product_members(self): - expected_data = "OrderedDict([('count', 5), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('user_data', OrderedDict([('id', 2), ('username', 'db_internal_write'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_write'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 5), ('product', 1), ('user', 2)]), OrderedDict([('id', 2), ('user_data', OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 1), ('product', 1), ('user', 3)]), OrderedDict([('id', 3), ('user_data', OrderedDict([('id', 4), ('username', 'db_external'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_external'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', True), ('setting_theme', 'light'), ('permissions', []), ('setting_list_properties', '')])), ('role', 5), ('product', 2), ('user', 4)]), OrderedDict([('id', 4), ('user_data', OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 1), ('product', 2), ('user', 3)]), OrderedDict([('id', 6), ('user_data', OrderedDict([('id', 6), ('username', 'db_product_group_user'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_product_group_user'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 5), ('product', 3), ('user', 6)])])])" + expected_data = "OrderedDict({'count': 5, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'user_data': OrderedDict({'id': 2, 'username': 'db_internal_write', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_write', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 5, 'product': 1, 'user': 2}), OrderedDict({'id': 2, 'user_data': OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 1, 'product': 1, 'user': 3}), OrderedDict({'id': 3, 'user_data': OrderedDict({'id': 4, 'username': 'db_external', 'first_name': '', 'last_name': '', 'full_name': 'db_external', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': True, 'setting_theme': 'light', 'permissions': [], 'setting_list_properties': ''}), 'role': 5, 'product': 2, 'user': 4}), OrderedDict({'id': 4, 'user_data': OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 1, 'product': 2, 'user': 3}), OrderedDict({'id': 6, 'user_data': OrderedDict({'id': 6, 'username': 'db_product_group_user', 'first_name': '', 'last_name': '', 'full_name': 'db_product_group_user', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 5, 'product': 3, 'user': 6})]})" self._test_api( APITest( "db_admin", "get", "/api/product_members/", None, 200, expected_data ) ) - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('user_data', OrderedDict([('id', 2), ('username', 'db_internal_write'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_write'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 5), ('product', 1), ('user', 2)]), OrderedDict([('id', 2), ('user_data', OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 1), ('product', 1), ('user', 3)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'user_data': OrderedDict({'id': 2, 'username': 'db_internal_write', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_write', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 5, 'product': 1, 'user': 2}), OrderedDict({'id': 2, 'user_data': OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 1, 'product': 1, 'user': 3})]})" self._test_api( APITest( "db_internal_write", @@ -26,7 +26,7 @@ def test_authorization_product_members(self): ) ) - expected_data = "OrderedDict([('count', 3), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('user_data', OrderedDict([('id', 2), ('username', 'db_internal_write'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_write'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 5), ('product', 1), ('user', 2)]), OrderedDict([('id', 2), ('user_data', OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 1), ('product', 1), ('user', 3)]), OrderedDict([('id', 6), ('user_data', OrderedDict([('id', 6), ('username', 'db_product_group_user'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_product_group_user'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])), ('role', 5), ('product', 3), ('user', 6)])])])" + expected_data = "OrderedDict({'count': 3, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'user_data': OrderedDict({'id': 2, 'username': 'db_internal_write', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_write', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 5, 'product': 1, 'user': 2}), OrderedDict({'id': 2, 'user_data': OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 1, 'product': 1, 'user': 3}), OrderedDict({'id': 6, 'user_data': OrderedDict({'id': 6, 'username': 'db_product_group_user', 'first_name': '', 'last_name': '', 'full_name': 'db_product_group_user', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 5, 'product': 3, 'user': 6})]})" self._test_api( APITest( "db_product_group_user", @@ -37,7 +37,7 @@ def test_authorization_product_members(self): expected_data, ) ) - expected_data = "{'id': 1, 'user_data': OrderedDict([('id', 2), ('username', 'db_internal_write'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_write'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), 'role': 5, 'product': 1, 'user': 2}" + expected_data = "{'id': 1, 'user_data': OrderedDict({'id': 2, 'username': 'db_internal_write', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_write', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 5, 'product': 1, 'user': 2}" self._test_api( APITest( "db_internal_write", @@ -86,7 +86,7 @@ def test_authorization_product_members(self): expected_data, ) ) - expected_data = "{'id': 7, 'user_data': OrderedDict([('id', 1), ('username', 'db_admin'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_admin'), ('email', ''), ('is_active', True), ('is_superuser', True), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), 'role': 3, 'product': 1, 'user': 1}" + expected_data = "{'id': 7, 'user_data': OrderedDict({'id': 1, 'username': 'db_admin', 'first_name': '', 'last_name': '', 'full_name': 'db_admin', 'email': '', 'is_active': True, 'is_superuser': True, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 3, 'product': 1, 'user': 1}" self._test_api( APITest( "db_internal_write", @@ -113,7 +113,7 @@ def test_authorization_product_members(self): ) ) - expected_data = "{'id': 7, 'user_data': OrderedDict([('id', 1), ('username', 'db_admin'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_admin'), ('email', ''), ('is_active', True), ('is_superuser', True), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), 'role': 2, 'product': 1, 'user': 1}" + expected_data = "{'id': 7, 'user_data': OrderedDict({'id': 1, 'username': 'db_admin', 'first_name': '', 'last_name': '', 'full_name': 'db_admin', 'email': '', 'is_active': True, 'is_superuser': True, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), 'role': 2, 'product': 1, 'user': 1}" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_product_rules.py b/backend/unittests/access_control/api/test_authorization_product_rules.py index ff5e9cf2c..a6d5339cf 100644 --- a/backend/unittests/access_control/api/test_authorization_product_rules.py +++ b/backend/unittests/access_control/api/test_authorization_product_rules.py @@ -6,12 +6,12 @@ class TestAuthorizationProductRules(TestAuthorizationBase): def test_authorization_product_rules(self): - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('product_data', OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])])), ('name', 'db_product_rule_internal'), ('description', ''), ('scanner_prefix', ''), ('title', ''), ('description_observation', ''), ('origin_component_name_version', ''), ('origin_docker_image_name_tag', ''), ('origin_endpoint_url', ''), ('origin_service_name', ''), ('origin_source_file', ''), ('new_severity', ''), ('new_status', 'Duplicate'), ('enabled', True), ('product', 1), ('parser', 1)]), OrderedDict([('id', 2), ('product_data', OrderedDict([('id', 2), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_external'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', None), ('security_gate_active', False), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', None), ('repository_default_branch', 3), ('members', [3, 4, 5])])), ('name', 'db_product_rule_external'), ('description', ''), ('scanner_prefix', ''), ('title', ''), ('description_observation', ''), ('origin_component_name_version', ''), ('origin_docker_image_name_tag', ''), ('origin_endpoint_url', ''), ('origin_service_name', ''), ('origin_source_file', ''), ('new_severity', ''), ('new_status', 'False positive'), ('enabled', True), ('product', 2), ('parser', 1)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'db_product_rule_internal', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'Duplicate', 'enabled': True, 'product': 1, 'parser': 1}), OrderedDict({'id': 2, 'product_data': OrderedDict({'id': 2, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_external', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': None, 'security_gate_active': False, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': None, 'repository_default_branch': 3, 'members': [3, 4, 5]}), 'name': 'db_product_rule_external', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'False positive', 'enabled': True, 'product': 2, 'parser': 1})]})" self._test_api( APITest("db_admin", "get", "/api/product_rules/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 1), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('product_data', OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])])), ('name', 'db_product_rule_internal'), ('description', ''), ('scanner_prefix', ''), ('title', ''), ('description_observation', ''), ('origin_component_name_version', ''), ('origin_docker_image_name_tag', ''), ('origin_endpoint_url', ''), ('origin_service_name', ''), ('origin_source_file', ''), ('new_severity', ''), ('new_status', 'Duplicate'), ('enabled', True), ('product', 1), ('parser', 1)])])])" + expected_data = "OrderedDict({'count': 1, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'db_product_rule_internal', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'Duplicate', 'enabled': True, 'product': 1, 'parser': 1})]})" self._test_api( APITest( "db_internal_write", @@ -23,7 +23,7 @@ def test_authorization_product_rules(self): ) ) - expected_data = "{'id': 1, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'name': 'db_product_rule_internal', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'Duplicate', 'enabled': True, 'product': 1, 'parser': 1}" + expected_data = "{'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'db_product_rule_internal', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'Duplicate', 'enabled': True, 'product': 1, 'parser': 1}" self._test_api( APITest( "db_internal_write", @@ -73,7 +73,7 @@ def test_authorization_product_rules(self): ) ) - expected_data = "{'id': 4, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'name': 'string', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': '', 'enabled': True, 'product': 1, 'parser': 1}" + expected_data = "{'id': 4, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'string', 'description': '', 'scanner_prefix': '', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': '', 'enabled': True, 'product': 1, 'parser': 1}" self._test_api( APITest( "db_internal_write", @@ -100,7 +100,7 @@ def test_authorization_product_rules(self): ) ) - expected_data = "{'id': 1, 'product_data': OrderedDict([('id', 1), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), 'name': 'changed', 'description': '', 'scanner_prefix': 'also_changed', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'Duplicate', 'enabled': True, 'product': 1, 'parser': 1}" + expected_data = "{'id': 1, 'product_data': OrderedDict({'id': 1, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), 'name': 'changed', 'description': '', 'scanner_prefix': 'also_changed', 'title': '', 'description_observation': '', 'origin_component_name_version': '', 'origin_docker_image_name_tag': '', 'origin_endpoint_url': '', 'origin_service_name': '', 'origin_source_file': '', 'new_severity': '', 'new_status': 'Duplicate', 'enabled': True, 'product': 1, 'parser': 1}" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_products.py b/backend/unittests/access_control/api/test_authorization_products.py index d811ed818..5d9157ffe 100644 --- a/backend/unittests/access_control/api/test_authorization_products.py +++ b/backend/unittests/access_control/api/test_authorization_products.py @@ -6,12 +6,12 @@ class TestAuthorizationProducts(TestAuthorizationBase): def test_authorization_products(self): - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('product_group_name', 'db_product_group'), ('product_group_repository_branch_housekeeping_active', None), ('product_group_security_gate_active', None), ('repository_default_branch_name', 'db_branch_internal_dev'), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])]), OrderedDict([('id', 2), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('product_group_name', ''), ('product_group_repository_branch_housekeeping_active', None), ('product_group_security_gate_active', None), ('repository_default_branch_name', 'db_branch_external'), ('name', 'db_product_external'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', None), ('security_gate_active', False), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', None), ('repository_default_branch', 3), ('members', [3, 4, 5])])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'product_group_name': 'db_product_group', 'product_group_repository_branch_housekeeping_active': None, 'product_group_security_gate_active': None, 'repository_default_branch_name': 'db_branch_internal_dev', 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]}), OrderedDict({'id': 2, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'product_group_name': '', 'product_group_repository_branch_housekeeping_active': None, 'product_group_security_gate_active': None, 'repository_default_branch_name': 'db_branch_external', 'name': 'db_product_external', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': None, 'security_gate_active': False, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': None, 'repository_default_branch': 3, 'members': [3, 4, 5]})]})" self._test_api( APITest("db_admin", "get", "/api/products/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 1), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('permissions', {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }), ('product_group_name', 'db_product_group'), ('product_group_repository_branch_housekeeping_active', None), ('product_group_security_gate_active', None), ('repository_default_branch_name', 'db_branch_internal_dev'), ('name', 'db_product_internal'), ('description', ''), ('repository_prefix', ''), ('repository_branch_housekeeping_active', None), ('repository_branch_housekeeping_keep_inactive_days', None), ('repository_branch_housekeeping_exempt_branches', ''), ('security_gate_passed', True), ('security_gate_active', None), ('security_gate_threshold_critical', None), ('security_gate_threshold_high', None), ('security_gate_threshold_medium', None), ('security_gate_threshold_low', None), ('security_gate_threshold_none', None), ('security_gate_threshold_unkown', None), ('apply_general_rules', True), ('notification_ms_teams_webhook', ''), ('notification_email_to', ''), ('issue_tracker_active', False), ('issue_tracker_type', ''), ('issue_tracker_base_url', ''), ('issue_tracker_username', ''), ('issue_tracker_api_key', ''), ('issue_tracker_project_id', ''), ('issue_tracker_labels', ''), ('issue_tracker_issue_type', ''), ('issue_tracker_status_closed', ''), ('last_observation_change', '2022-12-16T17:13:18.283000+01:00'), ('product_group', 3), ('repository_default_branch', 1), ('members', [2, 3])])])])" + expected_data = "OrderedDict({'count': 1, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'permissions': {, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , }, 'product_group_name': 'db_product_group', 'product_group_repository_branch_housekeeping_active': None, 'product_group_security_gate_active': None, 'repository_default_branch_name': 'db_branch_internal_dev', 'name': 'db_product_internal', 'description': '', 'repository_prefix': '', 'repository_branch_housekeeping_active': None, 'repository_branch_housekeeping_keep_inactive_days': None, 'repository_branch_housekeeping_exempt_branches': '', 'security_gate_passed': True, 'security_gate_active': None, 'security_gate_threshold_critical': None, 'security_gate_threshold_high': None, 'security_gate_threshold_medium': None, 'security_gate_threshold_low': None, 'security_gate_threshold_none': None, 'security_gate_threshold_unkown': None, 'apply_general_rules': True, 'notification_ms_teams_webhook': '', 'notification_email_to': '', 'issue_tracker_active': False, 'issue_tracker_type': '', 'issue_tracker_base_url': '', 'issue_tracker_username': '', 'issue_tracker_api_key': '', 'issue_tracker_project_id': '', 'issue_tracker_labels': '', 'issue_tracker_issue_type': '', 'issue_tracker_status_closed': '', 'last_observation_change': '2022-12-16T17:13:18.283000+01:00', 'product_group': 3, 'repository_default_branch': 1, 'members': [2, 3]})]})" self._test_api( APITest( "db_internal_write", "get", "/api/products/", None, 200, expected_data diff --git a/backend/unittests/access_control/api/test_authorization_services.py b/backend/unittests/access_control/api/test_authorization_services.py index 020d3f20f..06354704b 100644 --- a/backend/unittests/access_control/api/test_authorization_services.py +++ b/backend/unittests/access_control/api/test_authorization_services.py @@ -6,12 +6,12 @@ class TestAuthorizationServices(TestAuthorizationBase): def test_authorization_services(self): - expected_data = "OrderedDict([('count', 3), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('name_with_product', 'db_service_internal_backend (db_product_internal)'), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_service_internal_backend'), ('product', 1)]), OrderedDict([('id', 2), ('name_with_product', 'db_service_internal_frontend (db_product_internal)'), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_service_internal_frontend'), ('product', 1)]), OrderedDict([('id', 3), ('name_with_product', 'db_service_external (db_product_external)'), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_service_external'), ('product', 2)])])])" + expected_data = "OrderedDict({'count': 3, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'name_with_product': 'db_service_internal_backend (db_product_internal)', 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_service_internal_backend', 'product': 1}), OrderedDict({'id': 2, 'name_with_product': 'db_service_internal_frontend (db_product_internal)', 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_service_internal_frontend', 'product': 1}), OrderedDict({'id': 3, 'name_with_product': 'db_service_external (db_product_external)', 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_service_external', 'product': 2})]})" self._test_api( APITest("db_admin", "get", "/api/services/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('name_with_product', 'db_service_internal_backend (db_product_internal)'), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_service_internal_backend'), ('product', 1)]), OrderedDict([('id', 2), ('name_with_product', 'db_service_internal_frontend (db_product_internal)'), ('open_critical_observation_count', 0), ('open_high_observation_count', 0), ('open_medium_observation_count', 0), ('open_low_observation_count', 0), ('open_none_observation_count', 0), ('open_unkown_observation_count', 0), ('name', 'db_service_internal_frontend'), ('product', 1)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'name_with_product': 'db_service_internal_backend (db_product_internal)', 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_service_internal_backend', 'product': 1}), OrderedDict({'id': 2, 'name_with_product': 'db_service_internal_frontend (db_product_internal)', 'open_critical_observation_count': 0, 'open_high_observation_count': 0, 'open_medium_observation_count': 0, 'open_low_observation_count': 0, 'open_none_observation_count': 0, 'open_unkown_observation_count': 0, 'name': 'db_service_internal_frontend', 'product': 1})]})" self._test_api( APITest( "db_internal_write", diff --git a/backend/unittests/access_control/api/test_authorization_users.py b/backend/unittests/access_control/api/test_authorization_users.py index 3d3512413..4ad8a1823 100644 --- a/backend/unittests/access_control/api/test_authorization_users.py +++ b/backend/unittests/access_control/api/test_authorization_users.py @@ -6,12 +6,12 @@ class TestAuthorizationUsers(TestAuthorizationBase): def test_authorization_users(self): - expected_data = "OrderedDict([('count', 5), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('username', 'db_admin'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_admin'), ('email', ''), ('is_active', True), ('is_superuser', True), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 2), ('username', 'db_internal_write'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_write'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 4), ('username', 'db_external'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_external'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', True), ('setting_theme', 'light'), ('permissions', []), ('setting_list_properties', '')]), OrderedDict([('id', 6), ('username', 'db_product_group_user'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_product_group_user'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])])])" + expected_data = "OrderedDict({'count': 5, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'username': 'db_admin', 'first_name': '', 'last_name': '', 'full_name': 'db_admin', 'email': '', 'is_active': True, 'is_superuser': True, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 2, 'username': 'db_internal_write', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_write', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 4, 'username': 'db_external', 'first_name': '', 'last_name': '', 'full_name': 'db_external', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': True, 'setting_theme': 'light', 'permissions': [], 'setting_list_properties': ''}), OrderedDict({'id': 6, 'username': 'db_product_group_user', 'first_name': '', 'last_name': '', 'full_name': 'db_product_group_user', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''})]})" self._test_api( APITest("db_admin", "get", "/api/users/", None, 200, expected_data) ) - expected_data = "OrderedDict([('count', 5), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('username', 'db_admin'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_admin'), ('email', ''), ('is_active', True), ('is_superuser', True), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 2), ('username', 'db_internal_write'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_write'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 4), ('username', 'db_external'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_external'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', True), ('setting_theme', 'light'), ('permissions', []), ('setting_list_properties', '')]), OrderedDict([('id', 6), ('username', 'db_product_group_user'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_product_group_user'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')])])])" + expected_data = "OrderedDict({'count': 5, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'username': 'db_admin', 'first_name': '', 'last_name': '', 'full_name': 'db_admin', 'email': '', 'is_active': True, 'is_superuser': True, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 2, 'username': 'db_internal_write', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_write', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 4, 'username': 'db_external', 'first_name': '', 'last_name': '', 'full_name': 'db_external', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': True, 'setting_theme': 'light', 'permissions': [], 'setting_list_properties': ''}), OrderedDict({'id': 6, 'username': 'db_product_group_user', 'first_name': '', 'last_name': '', 'full_name': 'db_product_group_user', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''})]})" self._test_api( APITest("db_internal_write", "get", "/api/users/", None, 200, expected_data) ) @@ -33,7 +33,7 @@ def test_authorization_users(self): ) ) - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 3), ('username', 'db_internal_read'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_internal_read'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', False), ('setting_theme', 'light'), ('permissions', [, ]), ('setting_list_properties', '')]), OrderedDict([('id', 4), ('username', 'db_external'), ('first_name', ''), ('last_name', ''), ('full_name', 'db_external'), ('email', ''), ('is_active', True), ('is_superuser', False), ('is_external', True), ('setting_theme', 'light'), ('permissions', []), ('setting_list_properties', '')])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 3, 'username': 'db_internal_read', 'first_name': '', 'last_name': '', 'full_name': 'db_internal_read', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': False, 'setting_theme': 'light', 'permissions': [, ], 'setting_list_properties': ''}), OrderedDict({'id': 4, 'username': 'db_external', 'first_name': '', 'last_name': '', 'full_name': 'db_external', 'email': '', 'is_active': True, 'is_superuser': False, 'is_external': True, 'setting_theme': 'light', 'permissions': [], 'setting_list_properties': ''})]})" self._test_api( APITest("db_external", "get", "/api/users/", None, 200, expected_data) ) diff --git a/backend/unittests/access_control/api/test_authorization_vulnerability_checks.py b/backend/unittests/access_control/api/test_authorization_vulnerability_checks.py index fb1d7b841..ff46b5427 100644 --- a/backend/unittests/access_control/api/test_authorization_vulnerability_checks.py +++ b/backend/unittests/access_control/api/test_authorization_vulnerability_checks.py @@ -6,7 +6,7 @@ class TestAuthorizationVulnerabilityChecks(TestAuthorizationBase): def test_authorization_vulnerability_checks(self): - expected_data = "OrderedDict([('count', 3), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('branch_name', ''), ('scanner_name', 'scanner_internal_no_branch'), ('filename', 'filename_internal_no_branch'), ('api_configuration_name', ''), ('scanner', 'scanner_internal_no_branch / 1.0.0'), ('first_import', '2022-12-15T17:10:35.521000+01:00'), ('last_import', '2022-12-15T17:10:35.854000+01:00'), ('last_import_observations_new', 1), ('last_import_observations_updated', 2), ('last_import_observations_resolved', 3), ('product', 1), ('branch', None)]), OrderedDict([('id', 2), ('branch_name', 'db_branch_internal_dev'), ('scanner_name', 'scanner_internal_dev'), ('filename', ''), ('api_configuration_name', 'api_configuration_internal_dev'), ('scanner', 'scanner_internal_dev'), ('first_import', '2022-12-16T17:10:35.521000+01:00'), ('last_import', '2022-12-16T17:10:35.854000+01:00'), ('last_import_observations_new', 4), ('last_import_observations_updated', 5), ('last_import_observations_resolved', 6), ('product', 1), ('branch', 1)]), OrderedDict([('id', 3), ('branch_name', 'db_branch_external'), ('scanner_name', 'scanner_external'), ('filename', 'filename_external'), ('api_configuration_name', ''), ('scanner', 'scanner_external'), ('first_import', '2022-12-17T17:10:35.521000+01:00'), ('last_import', '2022-12-17T17:10:35.854000+01:00'), ('last_import_observations_new', 7), ('last_import_observations_updated', 8), ('last_import_observations_resolved', 9), ('product', 2), ('branch', 3)])])])" + expected_data = "OrderedDict({'count': 3, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'branch_name': '', 'scanner_name': 'scanner_internal_no_branch', 'filename': 'filename_internal_no_branch', 'api_configuration_name': '', 'scanner': 'scanner_internal_no_branch / 1.0.0', 'first_import': '2022-12-15T17:10:35.521000+01:00', 'last_import': '2022-12-15T17:10:35.854000+01:00', 'last_import_observations_new': 1, 'last_import_observations_updated': 2, 'last_import_observations_resolved': 3, 'product': 1, 'branch': None}), OrderedDict({'id': 2, 'branch_name': 'db_branch_internal_dev', 'scanner_name': 'scanner_internal_dev', 'filename': '', 'api_configuration_name': 'api_configuration_internal_dev', 'scanner': 'scanner_internal_dev', 'first_import': '2022-12-16T17:10:35.521000+01:00', 'last_import': '2022-12-16T17:10:35.854000+01:00', 'last_import_observations_new': 4, 'last_import_observations_updated': 5, 'last_import_observations_resolved': 6, 'product': 1, 'branch': 1}), OrderedDict({'id': 3, 'branch_name': 'db_branch_external', 'scanner_name': 'scanner_external', 'filename': 'filename_external', 'api_configuration_name': '', 'scanner': 'scanner_external', 'first_import': '2022-12-17T17:10:35.521000+01:00', 'last_import': '2022-12-17T17:10:35.854000+01:00', 'last_import_observations_new': 7, 'last_import_observations_updated': 8, 'last_import_observations_resolved': 9, 'product': 2, 'branch': 3})]})" self._test_api( APITest( "db_admin", @@ -18,7 +18,7 @@ def test_authorization_vulnerability_checks(self): ) ) - expected_data = "OrderedDict([('count', 2), ('next', None), ('previous', None), ('results', [OrderedDict([('id', 1), ('branch_name', ''), ('scanner_name', 'scanner_internal_no_branch'), ('filename', 'filename_internal_no_branch'), ('api_configuration_name', ''), ('scanner', 'scanner_internal_no_branch / 1.0.0'), ('first_import', '2022-12-15T17:10:35.521000+01:00'), ('last_import', '2022-12-15T17:10:35.854000+01:00'), ('last_import_observations_new', 1), ('last_import_observations_updated', 2), ('last_import_observations_resolved', 3), ('product', 1), ('branch', None)]), OrderedDict([('id', 2), ('branch_name', 'db_branch_internal_dev'), ('scanner_name', 'scanner_internal_dev'), ('filename', ''), ('api_configuration_name', 'api_configuration_internal_dev'), ('scanner', 'scanner_internal_dev'), ('first_import', '2022-12-16T17:10:35.521000+01:00'), ('last_import', '2022-12-16T17:10:35.854000+01:00'), ('last_import_observations_new', 4), ('last_import_observations_updated', 5), ('last_import_observations_resolved', 6), ('product', 1), ('branch', 1)])])])" + expected_data = "OrderedDict({'count': 2, 'next': None, 'previous': None, 'results': [OrderedDict({'id': 1, 'branch_name': '', 'scanner_name': 'scanner_internal_no_branch', 'filename': 'filename_internal_no_branch', 'api_configuration_name': '', 'scanner': 'scanner_internal_no_branch / 1.0.0', 'first_import': '2022-12-15T17:10:35.521000+01:00', 'last_import': '2022-12-15T17:10:35.854000+01:00', 'last_import_observations_new': 1, 'last_import_observations_updated': 2, 'last_import_observations_resolved': 3, 'product': 1, 'branch': None}), OrderedDict({'id': 2, 'branch_name': 'db_branch_internal_dev', 'scanner_name': 'scanner_internal_dev', 'filename': '', 'api_configuration_name': 'api_configuration_internal_dev', 'scanner': 'scanner_internal_dev', 'first_import': '2022-12-16T17:10:35.521000+01:00', 'last_import': '2022-12-16T17:10:35.854000+01:00', 'last_import_observations_new': 4, 'last_import_observations_updated': 5, 'last_import_observations_resolved': 6, 'product': 1, 'branch': 1})]})" self._test_api( APITest( "db_internal_write", diff --git a/docker/backend/dev/django/Dockerfile b/docker/backend/dev/django/Dockerfile index 2af260b8d..0aaa98a11 100644 --- a/docker/backend/dev/django/Dockerfile +++ b/docker/backend/dev/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.6-alpine as python +FROM python:3.12.1-alpine as python # Python build stage FROM python as python-build-stage diff --git a/docker/backend/prod/django/Dockerfile b/docker/backend/prod/django/Dockerfile index 54e9a4518..af11ddd84 100644 --- a/docker/backend/prod/django/Dockerfile +++ b/docker/backend/prod/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.6-alpine as python +FROM python:3.12.1-alpine as python # Python build stage FROM python as python-build-stage diff --git a/docker/backend/unittests/django/Dockerfile b/docker/backend/unittests/django/Dockerfile index 1445b9b20..ba4ab430d 100644 --- a/docker/backend/unittests/django/Dockerfile +++ b/docker/backend/unittests/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.6-alpine as python +FROM python:3.12.1-alpine as python # Python build stage FROM python as python-build-stage