Was wondering how important is it to enforce certain things on the database level.
right now i got a video model
class Video(models.Model):
videoemb = models.FileField(max_length=500, upload_to=uploadPath, null=False, validators=[FileExtensionValidator(allowed_extensions=["mov","mp4","avi","wmv"])])
author = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
description = models.TextField(max_length=500)
created_at = models.DateTimeField(auto_now_add=True)
vidID = models.CharField(default=randVidID, editable=False)
ratingn = models.BigIntegerField(default = 0)
ratingp = models.BigIntegerField(default = 0)
title = models.CharField(max_length=100)
thumbnail = models.ImageField(editable=False, max_length=255, default="image/image.png")
created = models.IntegerField(editable=False, default=0)
class Meta:
ordering=['-created_at']
And im validating the videoemb to only accept those file extensions, but that doesnt enforce it on the database level, which brings me to my question, how important is it that i also do it on the database level? Are there potential security risks if i dont, and if so what are they?