diff --git a/backend/core/migrations/0048_alter_asset_security_objectives.py b/backend/core/migrations/0048_alter_asset_security_objectives.py new file mode 100644 index 0000000000..e19cca04a8 --- /dev/null +++ b/backend/core/migrations/0048_alter_asset_security_objectives.py @@ -0,0 +1,52 @@ +# Generated by Django 5.1.4 on 2025-01-11 11:53 + +import core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("core", "0047_loadedlibrary_publication_date_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="asset", + name="security_objectives", + field=models.JSONField( + blank=True, + default=dict, + help_text="The security objectives of the asset", + validators=[ + core.validators.JSONSchemaInstanceValidator( + { + "$id": "https://ciso-assistant.com/schemas/assets/security_objectives.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The security objectives of the asset", + "properties": { + "objectives": { + "patternProperties": { + "^[a-z_]+$": { + "properties": { + "is_enabled": {"type": "boolean"}, + "value": { + "maximum": 3, + "minimum": 0, + "type": "integer", + }, + }, + "type": "object", + } + }, + "type": "object", + } + }, + "title": "Security objectives", + "type": "object", + } + ) + ], + verbose_name="Security objectives", + ), + ), + ] diff --git a/backend/core/models.py b/backend/core/models.py index e02d82d096..5f0cdb49dd 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -1434,6 +1434,7 @@ class Type(models.TextChoices): "value": { "type": "integer", "minimum": 0, + "maximum": 3, }, "is_enabled": { "type": "boolean",