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

Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
Prowler Bot
2025-04-15 12:17:43 +02:00
committed by GitHub
parent a8b102794c
commit 09be60948d
7 changed files with 31 additions and 54 deletions
-6
View File
@@ -2,12 +2,6 @@
All notable changes to the **Prowler API** are documented in this file.
## [v1.6.1] (Prowler v5.5.1)
### 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.1"
version = "1.6.0"
[project.scripts]
celery = "src.backend.config.settings.celery"
@@ -1,17 +0,0 @@
# 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=600)
uid = models.CharField(max_length=300)
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.1
version: 1.6.0
description: |-
Prowler API specification.
@@ -6228,7 +6228,7 @@ components:
properties:
uid:
type: string
maxLength: 600
maxLength: 300
delta:
enum:
- new
+26 -26
View File
@@ -1,6 +1,6 @@
import pytest
from api.models import Finding, Resource, ResourceTag, StatusChoices
from api.models import Resource, ResourceTag
@pytest.mark.django_db
@@ -94,29 +94,29 @@ class TestResourceModel:
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
# @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()
# 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.1"
spectacular_settings.VERSION = "1.6.0"
spectacular_settings.DESCRIPTION = (
"Prowler API specification.\n\nThis file is auto-generated."
)