mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Be stricter about meaning of severe query param
`severe` can mean one of three things: - `yes` – user has told us this is an emergency - `no` – user has told us this isn’t an emergency - Anything else – user hasn’t been asked the question or has hacked/mangled the URL This commit adds some stricter sanitisation of the `severe` query parameter and does so up front, rather than spreading it across multiple functions.
This commit is contained in:
@@ -48,11 +48,14 @@ def feedback(ticket_type):
|
||||
if not form.feedback.data:
|
||||
form.feedback.data = session.pop('feedback_message', '')
|
||||
|
||||
severe = request.args.get('severe')
|
||||
if request.args.get('severe') in ['yes', 'no']:
|
||||
severe = convert_to_boolean(request.args.get('severe'))
|
||||
else:
|
||||
severe = None
|
||||
|
||||
urgent = (
|
||||
in_business_hours() or
|
||||
(ticket_type == 'problem' and convert_to_boolean(severe))
|
||||
(ticket_type == 'problem' and severe)
|
||||
)
|
||||
|
||||
anonymous = (
|
||||
@@ -208,7 +211,7 @@ def needs_triage(ticket_type, severe):
|
||||
def needs_escalation(ticket_type, severe):
|
||||
return all((
|
||||
ticket_type == 'problem',
|
||||
convert_to_boolean(severe),
|
||||
severe,
|
||||
not current_user.is_authenticated,
|
||||
not in_business_hours(),
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user