Skip to content

Security check report for housekeeping#476

Open
deseven wants to merge 8 commits into
redimp:mainfrom
deseven:security_check
Open

Security check report for housekeeping#476
deseven wants to merge 8 commits into
redimp:mainfrom
deseven:security_check

Conversation

@deseven
Copy link
Copy Markdown
Contributor

@deseven deseven commented May 3, 2026

Added a security check section for Housekeeping.

Implemented checks:

  • Anonymous users can edit the wiki
  • Anonymous users can upload files
  • Server name not set
  • CSP header missing
  • HTTPS not enabled
  • Fully open registrations
  • Plugins are being used
  • Custom HTML/CSS/JS is being used
  • Custom HTML tags/attrs whitelist
  • Missing of misconfigured reverse proxy

Most of the checks are performed on the backend side with a couple running on the frontend instead since we need to see the situation from the outside. Backend checks are solidly organized and easily extensible I think, while the frontend ones are a bit hacky, so if someone has any better ideas please share (not a blocker, though - could be improved later).

deseven and others added 8 commits May 3, 2026 16:16
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.
Replace the inline-styled severity badges in the housekeeping
security check with halfmoon's badge classes. Add badge-warning
and badge-notice variants in otterwiki.css since halfmoon ships
only primary/success/secondary/danger, so dark-mode and theme
colors are picked up consistently.
Replace the regex-based comment stripper with a BeautifulSoup
parse so custom HTML detection correctly ignores comments and
whitespace while still treating tag-only content (e.g. a bare
script or meta tag) as real custom HTML.

Yeah, this is nit picking.
Extend SecurityCheckResult with a `passed` flag and have the
pass/fail backend and frontend checks report both states. The
endpoint now returns {"issues": [...], "passed": [...]}, and the
housekeeping panel renders a second table behind a "Show passed
checks (N)" toggle that is collapsed by default. Admin gating is
also applied to the script block so non-admins do not receive the
(useless) JS.
REAL_IP_FROM is only relevant for the docker image bundled with
nginx, so flagging it on a generic install is misleading. Keep the
two generic signals (non-private remote with no proxy headers, and
X-Forwarded-For without X-Forwarded-Proto) and the documentation
links.
When the wiki is accessed via a loopback host (localhost or
127.0.0.0/8, ::1), the anonymous write/upload and HTTPS checks
drop from CRITICAL to MEDIUM and append a note explaining the
downgrade and that the wiki may still be reachable via tunnel or
port forward.
@redimp
Copy link
Copy Markdown
Owner

redimp commented May 3, 2026

Thanks for the PR, this is a really nice addition.

I went ahead and pushed a few follow-up commits with the changes I would otherwise have asked for in review:

  • Gate the endpoint and the panel on ADMIN, so the config and
    active plugin list aren't exposed to read-only accounts.
  • Reuse halfmoon's badge classes (with two new badge-warning /
    badge-notice variants in otterwiki.css) instead of inline
    styling, so dark mode and theming work out of the box.
  • Switch _has_html_content to BeautifulSoup since bs4 is already
    a hard dependency.
  • Drop the REAL_IP_FROM branches from the reverse proxy check;
    that variable only applies to the bundled docker/nginx setup
    and was misleading on a generic install.
  • Extend SecurityCheckResult with a passed flag and render a
    collapsible "Passed checks (N)" details section underneath the
    issues table, so admins also see what the wiki got right.
  • Downgrade the anonymous write/upload and HTTPS checks from
    CRITICAL to MEDIUM when the request comes in over a loopback
    host, with a note in the description explaining the downgrade.

Happy to iterate on any of these if you'd prefer a different
shape.

@deseven
Copy link
Copy Markdown
Contributor Author

deseven commented May 3, 2026

Makes sense to me and sorry about not checking for admin, I keep forgetting that this page is available for regular users too because of the drafts functionality. And no idea why I haven't added the admin check for the endpoint.

Security check with fatal security flaws 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants