Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[T2135] FIX: Security issue in project - Check domain of presentation video link. #62

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crowdfunding_compassion/models/crowdfunding_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from ..exceptions import InvalidDeadlineException

import re

class CrowdfundingProject(models.Model):
_name = "crowdfunding.project"
Expand Down Expand Up @@ -145,6 +146,13 @@ def _check_type(self):
_("Individual project can only have one participant.")
)

@api.constrains('presentation_video')
def _check_presentation_video(self):
if self.presentation_video:
domain = re.search(r"https?://([a-zA-Z0-9.-]+)", self.presentation_video)
if domain and not (domain.group(1) == 'www.youtube.com' or domain.group(1) == 'vimeo.com'):
raise ValidationError("The facebook link must be from the 'www.youtube.com' or 'vimeo.com' domain only.")
auclerc marked this conversation as resolved.
Show resolved Hide resolved

def _compute_description_short(self):
for project in self:
if len(project.description) > 100:
Expand Down
Loading