diff --git a/CTFd/challenges.py b/CTFd/challenges.py index b6364f2b..1ab223dc 100644 --- a/CTFd/challenges.py +++ b/CTFd/challenges.py @@ -33,6 +33,9 @@ def listing(): infos = get_infos() errors = get_errors() + if Configs.challenge_visibility == ChallengeVisibilityTypes.ADMINS: + infos.append("Challenge Visibility is set to Admins Only") + if ctf_started() is False: errors.append(f"{Configs.ctf_name} has not started yet") diff --git a/CTFd/utils/decorators/visibility.py b/CTFd/utils/decorators/visibility.py index de04f223..9e8289be 100644 --- a/CTFd/utils/decorators/visibility.py +++ b/CTFd/utils/decorators/visibility.py @@ -73,7 +73,13 @@ def check_challenge_visibility(f): return f(*args, **kwargs) else: if authed(): - abort(403) + if request.content_type == "application/json": + abort(403) + else: + abort( + 403, + description="Challenge Visibility is set to Admins Only", + ) else: return redirect(url_for("auth.login", next=request.full_path))