Skip to content

Commit 30be0d2

Browse files
committed
fix: restrict housekeeping security check to admins
Guard the /-/housekeeping/security-check endpoint with a has_permission("ADMIN") check and hide the corresponding panel in the housekeeping template from non-admin users to avoid leaking configuration details and active plugin names.
1 parent d7fa043 commit 30be0d2

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

otterwiki/templates/tools/housekeeping.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ <h3 class="card-title">Broken WikiLinks</h3>
8787
</div>
8888
{% endif %}
8989
{#-#}
90+
{% if has_permission("ADMIN") %}
9091
<div class="card m-auto m-lg-20">
9192
<div class="mw-full">
9293
<h3 class="card-title">Security Check</h3>
@@ -115,6 +116,7 @@ <h3 class="card-title">Security Check</h3>
115116
</div>
116117
</div>
117118
</div>
119+
{% endif %}
118120
{#-#}
119121
{% endblock %}{# content #}
120122
{% block js %}

otterwiki/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,12 @@ def housekeeping():
217217
@app.route("/-/housekeeping/security-check", methods=["GET"])
218218
@login_required
219219
def security_check():
220+
from otterwiki.auth import has_permission
220221
from otterwiki.security_check import run_backend_checks
221222

223+
if not has_permission("ADMIN"):
224+
abort(403)
225+
222226
results = run_backend_checks()
223227
return jsonify(results=results)
224228

0 commit comments

Comments
 (0)