Skip to content

Commit

Permalink
Fix: Security fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Feb 6, 2022
1 parent 6ac4f6c commit b7395f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/automations/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ def leave(self, task):
task.finished = now()
task.locked = 0
task.save()
return None # Stops execution


class Repeat(Node):
Expand Down
9 changes: 8 additions & 1 deletion src/automations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Create your views here.
import datetime
import urllib.parse

from django.contrib.auth.mixins import (
LoginRequiredMixin,
Expand Down Expand Up @@ -79,7 +80,13 @@ def form_valid(self, form):
if getattr(self.node, "_success_url", None):
return redirect(self.node._success_url)
elif "back" in self.request.GET:
return redirect(self.request.GET.get("back"))
url = urllib.parse.urlparse(
self.request.GET.get("back")
) # prevent redirect
this_site = urllib.parse.urlunparse(
("", "", url.path, url.params, url.query, url.fragment)
)
return redirect(this_site)
return super().form_valid(form)

def get_success_url(self):
Expand Down

0 comments on commit b7395f9

Please sign in to comment.