-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix/add initial backend view and url route DO NOT MERGE #3421
base: master
Are you sure you want to change the base?
fix/add initial backend view and url route DO NOT MERGE #3421
Conversation
response = JsonResponse({"message": f"campaign {id_campaign} expired"}) | ||
else: | ||
action = request.POST.get("action") | ||
response.set_cookie(f"{id_campaign}_{action}", "true", expires=date_expiry) |
Check warning
Code scanning / CodeQL
Failure to use secure cookies Medium
response = JsonResponse({"message": f"campaign {id_campaign} expired"}) | ||
else: | ||
action = request.POST.get("action") | ||
response.set_cookie(f"{id_campaign}_{action}", "true", expires=date_expiry) |
Check warning
Code scanning / CodeQL
Construction of a cookie using user-supplied input Medium
user-supplied input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have some checks here to make sure they fall within a range of accepted values
@@ -174,9 +174,31 @@ def _get_tags_as_dict(): | |||
return tags_dict | |||
|
|||
|
|||
def show_survey_banner(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately would need to delete this code after survey expiry is over
|
||
|
||
class SetNotificationCookie(View): | ||
def post(self, request, *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to make this generic but maybe would need to hardcode to survey campaign to avoid the security issues flagged below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you then set a base class and extend from it? Or perhaps a util function can be used here?
Description of change
Rough outline of how we could use the accepted/dimissed cookie. We could call the backend with js* or turn the survey into a django form.