diff --git a/app.py b/app.py index 2b0f3e7..9b5833a 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,7 @@ management UI. Authentication via Authelia forward-auth headers. All monitoring and alerting is handled by the separate monitor.py daemon. """ import hashlib +import html import ipaddress import json import logging @@ -132,10 +133,12 @@ def require_auth(f): ) allowed = _config().get('auth', {}).get('allowed_groups', ['admin']) if not any(g in allowed for g in user['groups']): + safe_user = html.escape(user['username']) + safe_groups = html.escape(', '.join(allowed)) return ( f'
Your account ({user["username"]}) is not in an allowed group ' - f'({", ".join(allowed)}).
', + f'Your account ({safe_user}) is not in an allowed group ' + f'({safe_groups}).
', 403, ) return f(*args, **kwargs)