Skip to content

Commit

Permalink
Merge branch 'main' into CA-376-set-up-pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Apr 26, 2024
2 parents aa44c77 + 3b07f9b commit 2d1825f
Show file tree
Hide file tree
Showing 26 changed files with 2,661 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:
functional-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
backend-directory: ./backend
working-directory: ./frontend
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/startup-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:
startup-functional-test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

services:
postgres:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
${{ env.working-directory }}/tests/reports/
retention-days: 5
startup-docker-compose-test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
COMPOSE_TEST: True
steps:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Check out the online documentation on https://intuitem.gitbook.io/ciso-assistant
28. CIS Controls v8*
29. CSA CCM (Cloud Controls Matrix)*
30. FADP (Federal Act on Data Protection) 🇨🇭
31. NIST SP 800-171 rev2 🇺🇸

<br/>

Expand All @@ -122,7 +123,7 @@ Checkout the [library](/backend/library/libraries/) and [tools](/tools/) for the
- SOX
- MASVS
- FedRAMP
- NIST 800-171
- NCSC Cyber Assessment Framework (CAF)
- UK Cyber Essentials
- and much more: just ask on [Discord](https://discord.gg/qvkaMdQ8da). If it's an open standard, we'll do it for you, *free of charge* 😉

Expand Down
2 changes: 0 additions & 2 deletions backend/app_tests/api/test_api_requirement_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
REQUIREMENT_NODE_URN = "urn:test:req_node.t:1"
REQUIREMENT_NODE_PARENT_URN = "urn:test:req_node.t"
REQUIREMENT_NODE_ORDER_ID = 1
REQUIREMENT_NODE_LEVEL = 2
REQUIREMENT_NODE_REFERENCE = "test ref"


Expand Down Expand Up @@ -57,7 +56,6 @@ def test_get_requirement_nodes(self, test):
"urn": REQUIREMENT_NODE_URN,
"parent_urn": REQUIREMENT_NODE_PARENT_URN,
"order_id": REQUIREMENT_NODE_ORDER_ID,
"level": REQUIREMENT_NODE_LEVEL,
"assessable": True,
"folder": test.folder,
"framework": Framework.objects.all()[0],
Expand Down
1 change: 0 additions & 1 deletion backend/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@
"view_framework",
"delete_framework",
"view_requirementnode",
"view_requirementlevel", # Permits to see the object on api by an admin
"view_library",
"add_library",
"delete_library",
Expand Down
7 changes: 6 additions & 1 deletion backend/core/management/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ def handle(self, *args, **kwargs):
nb_risk_assessments = RiskAssessment.objects.all().count()
nb_risk_scenarios = RiskScenario.objects.all().count()
nb_risk_acceptances = RiskAcceptance.objects.all().count()
created_at = Folder.get_root_folder().created_at
last_login = max(
x["last_login"] for x in User.objects.all().values("last_login")
)
self.stdout.write(
f"users={nb_users} first_logins={nb_first_login} libraries={nb_libraries} "
f"created_at={created_at.strftime('%Y-%m-%dT%H:%M')} last_login={last_login.strftime('%Y-%m-%dT%H:%M') if last_login else last_login} "
+ f"users={nb_users} first_logins={nb_first_login} libraries={nb_libraries} "
+ f"domains={nb_domains} projects={nb_projects} assets={nb_assets} "
+ f"threats={nb_threats} functions={nb_functions} measures={nb_measures} "
+ f"evidences={nb_evidences} compliance={nb_compliance_assessments} risk={nb_risk_assessments} "
Expand Down
27 changes: 0 additions & 27 deletions backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,6 @@ def library_entry(self):
if requirement_nodes:
res["requirement_nodes"] = requirement_nodes

requirement_levels = self.get_requirement_levels()
if requirement_levels:
res["requirement_levels"] = requirement_levels

return res

def get_requirement_nodes(self):
Expand All @@ -385,28 +381,6 @@ def process_node(self, node):
]
return node_dict

def get_requirement_levels(self):
levels_queryset = self.requirement_levels.all()
if levels_queryset.exists():
return [model_to_dict(level) for level in levels_queryset]
return []


class RequirementLevel(ReferentialObjectMixin):
framework = models.ForeignKey(
Framework,
on_delete=models.CASCADE,
null=True,
blank=True,
verbose_name=_("Framework"),
related_name="requirement_levels",
)
level = models.IntegerField(null=False, blank=False, verbose_name=_("Level"))

class Meta:
verbose_name = _("Requirements level")
verbose_name_plural = _("Requirements levels")


class RequirementNode(ReferentialObjectMixin):
threats = models.ManyToManyField(
Expand All @@ -433,7 +407,6 @@ class RequirementNode(ReferentialObjectMixin):
max_length=100, null=True, blank=True, verbose_name=_("Parent URN")
)
order_id = models.IntegerField(null=True, verbose_name=_("Order ID"))
level = models.IntegerField(null=True, verbose_name=_("Level"))
maturity = models.IntegerField(null=True, verbose_name=_("Maturity"))
assessable = models.BooleanField(null=False, verbose_name=_("Assessable"))

Expand Down
10 changes: 0 additions & 10 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,6 @@ class FrameworkWriteSerializer(FrameworkReadSerializer):
pass


class RequirementLevelReadSerializer(BaseModelSerializer):
class Meta:
model = RequirementLevel
fields = "__all__"


class RequirementLevelWriteSerializer(RequirementLevelReadSerializer):
pass


class RequirementNodeReadSerializer(BaseModelSerializer):
reference_controls = FieldsRelatedField(many=True)
threats = FieldsRelatedField(many=True)
Expand Down
3 changes: 0 additions & 3 deletions backend/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
basename="compliance-assessments",
)
router.register(r"requirement-nodes", RequirementViewSet, basename="requirement-nodes")
router.register(
r"requirement-levels", RequirementLevelViewSet, basename="requirement-levels"
)
router.register(
r"requirement-assessments",
RequirementAssessmentViewSet,
Expand Down
13 changes: 3 additions & 10 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,16 +1077,6 @@ class RequirementNodeViewSet(BaseModelViewSet):
search_fields = ["name", "description"]


class RequirementLevelViewSet(BaseModelViewSet):
"""
API endpoint that allows requirement levels to be viewed or edited.
"""

model = RequirementLevel
filterset_fields = ["framework"]
search_fields = ["name"]


class RequirementViewSet(BaseModelViewSet):
"""
API endpoint that allows requirements to be viewed or edited.
Expand Down Expand Up @@ -1126,6 +1116,9 @@ def attachment(self, request, pk):
response = HttpResponse(
evidence.attachment,
content_type=content_type,
headers={
"Content-Disposition": f"attachment; filename={evidence.filename()}"
},
status=status.HTTP_200_OK,
)
return response
Expand Down
Loading

0 comments on commit 2d1825f

Please sign in to comment.