Skip to content

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Dec 26, 2025

The try-except here was catching all exceptions which would hide any structural problems like missing columns due to migration problems as it was swallowing the errors and return a default System_Settings object.

I tried catching only specific errors or returning None instead, but this would break startup in too many places and would prevent users from being able to start any container to go into and fix problems.

This PR now adds displaying of error messages in the UI to make it clear "something is wrong".

image

Refactor get_from_db method to handle specific exception.
@valentijnscholten valentijnscholten added this to the 2.54.0 milestone Dec 26, 2025
@valentijnscholten valentijnscholten changed the title Handle System_Settings.DoesNotExist in get_from_db Handle System_Settings.DoesNotExist in middleware Dec 26, 2025
@valentijnscholten valentijnscholten changed the title Handle System_Settings.DoesNotExist in middleware Handle System_Settings errors better in middleware Dec 26, 2025
@dryrunsecurity
Copy link

DryRun Security

This pull request includes code that catches all exceptions during a database lookup and displays the raw exception string (str(e)) to users, risking information disclosure of sensitive infrastructure details (hostnames, usernames, schema info). The issue is non-blocking but should be fixed to log detailed errors internally and show a generic, non-sensitive message to users.

Information Disclosure via Detailed Error Message in dojo/middleware.py
Vulnerability Information Disclosure via Detailed Error Message
Description The code catches all exceptions during a database lookup and captures the raw exception string (str(e)) to be displayed to the user via a warning message. Database exceptions often contain sensitive infrastructure details (hostnames, user names, schema info) that should not be exposed to end users, especially unauthenticated ones.

error_msg = str(e)
if hasattr(DojoSytemSettingsMiddleware._thread_local, "system_settings_error"):
# Only store the first error to avoid duplicates
pass


All finding details can be found in the DryRun Security Dashboard.

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