fix(findings): increase uid max length to 600 (#7501)

Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
Prowler Bot
2025-04-14 15:18:08 +02:00
committed by GitHub
parent d8e575e6dc
commit 7a27a8ddf5
7 changed files with 56 additions and 6 deletions
+5
View File
@@ -2,6 +2,11 @@
All notable changes to the **Prowler API** are documented in this file.
## [v1.6.1] (Prowler UNRELEASED)
### Changed
- Changed `findings.uid` field length from `varchar(300)` to `varchar(600)` [(#7498)](https://github.com/prowler-cloud/prowler/pull/7498).
---
## [v1.6.0] (Prowler v5.5.0)
+1 -1
View File
@@ -35,7 +35,7 @@ name = "prowler-api"
package-mode = false
# Needed for the SDK compatibility
requires-python = ">=3.11,<3.13"
version = "1.6.0"
version = "1.6.1"
[project.scripts]
celery = "src.backend.config.settings.celery"
@@ -0,0 +1,17 @@
# Generated by Django 5.1.7 on 2025-04-14 06:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0016_finding_compliance_resource_details_and_more"),
]
operations = [
migrations.AlterField(
model_name="finding",
name="uid",
field=models.CharField(max_length=600),
),
]
+1 -1
View File
@@ -641,7 +641,7 @@ class Finding(PostgresPartitionedModel, RowLevelSecurityProtectedModel):
updated_at = models.DateTimeField(auto_now=True, editable=False)
first_seen_at = models.DateTimeField(editable=False, null=True)
uid = models.CharField(max_length=300)
uid = models.CharField(max_length=600)
delta = FindingDeltaEnumField(
choices=DeltaChoices.choices,
blank=True,
+2 -2
View File
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: Prowler API
version: 1.6.0
version: 1.6.1
description: |-
Prowler API specification.
@@ -6228,7 +6228,7 @@ components:
properties:
uid:
type: string
maxLength: 300
maxLength: 600
delta:
enum:
- new
+29 -1
View File
@@ -1,6 +1,6 @@
import pytest
from api.models import Resource, ResourceTag
from api.models import Finding, Resource, ResourceTag, StatusChoices
@pytest.mark.django_db
@@ -92,3 +92,31 @@ class TestResourceModel:
assert len(resource.tags.filter(tenant_id=tenant_id)) == 0
assert resource.get_tags(tenant_id=tenant_id) == {}
@pytest.mark.django_db
class TestFindingModel:
def test_add_finding_with_long_uid(
self, providers_fixture, scans_fixture, resources_fixture
):
provider, *_ = providers_fixture
tenant_id = provider.tenant_id
long_uid = "1" * 500
_ = Finding.objects.create(
tenant_id=tenant_id,
uid=long_uid,
delta=Finding.DeltaChoices.NEW,
check_metadata={},
status=StatusChoices.PASS,
status_extended="",
severity="high",
impact="high",
raw_result={},
check_id="test_check",
scan=scans_fixture[0],
first_seen_at=None,
muted=False,
compliance={},
)
assert Finding.objects.filter(uid=long_uid).exists()
+1 -1
View File
@@ -247,7 +247,7 @@ class SchemaView(SpectacularAPIView):
def get(self, request, *args, **kwargs):
spectacular_settings.TITLE = "Prowler API"
spectacular_settings.VERSION = "1.6.0"
spectacular_settings.VERSION = "1.6.1"
spectacular_settings.DESCRIPTION = (
"Prowler API specification.\n\nThis file is auto-generated."
)