Skip to content

Conversation

@manuel-sommer
Copy link
Contributor

@manuel-sommer manuel-sommer commented Oct 21, 2025

  • Implement OIDC groups to be parsed.
  • Added Unittests for update_oidc_groups and update_azure_groups

@github-actions github-actions bot added the settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR label Oct 21, 2025
@github-actions github-actions bot added the New Migration Adding a new migration file. Take care when merging. label Oct 30, 2025
@manuel-sommer manuel-sommer marked this pull request as ready for review October 31, 2025 06:47
@github-actions github-actions bot added the docs label Oct 31, 2025
@dryrunsecurity
Copy link

dryrunsecurity bot commented Oct 31, 2025

DryRun Security

🔴 Risk threshold exceeded.

This pull request modifies sensitive files (dojo/group/utils.py, dojo/pipeline.py, dojo/models.py and a DB migration) flagged by the configured codepaths scanner, and includes a missing group ownership assignment bug that can leave newly-created groups orphaned during initial social auth, plus a potential ReDoS risk in update_oidc_groups due to use of an administrator-configured regex. Reviewers should verify the intent/authorization for these sensitive edits, fix the post-save handler to handle missing Dojo_User profiles during social login, and consider hardening or safely evaluating the OIDC group-filter regex.

🔴 Configured Codepaths Edit in dojo/group/utils.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/pipeline.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/pipeline.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/models.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/db_migrations/0247_alter_dojo_group_social_provider.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/models.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/group/utils.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/pipeline.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/pipeline.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/pipeline.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/models.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/group/utils.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/pipeline.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
Missing Group Ownership Assignment in dojo/group/utils.py
Vulnerability Missing Group Ownership Assignment
Description The group_post_save_handler is a post_save signal receiver for Django's Group model. It attempts to assign the currently logged-in user as the owner of a newly created group. However, during the initial social authentication flow (specifically, when a new user logs in via OIDC or AzureAD), the Dojo_User profile object might not yet exist, even though a standard auth.User object has been created. The get_current_user() function returns the auth.User object. The handler then attempts to retrieve the Dojo_User profile associated with this auth.User. If the Dojo_User does not exist at this point, the handler logs an error and returns early, skipping the critical step of assigning the user as a member and owner of the newly created Dojo_Group. This results in an 'orphaned' group that has no assigned owner or members, making it unmanageable through the application's UI or API.

logger.error(f"Group post-save: No Dojo_User found for user with pk '{user.pk}'.")
return

Regular Expression Denial of Service (ReDoS) in dojo/pipeline.py
Vulnerability Regular Expression Denial of Service (ReDoS)
Description The update_oidc_groups function uses a regular expression defined in settings.OIDC_GROUPS_FILTER to filter group names received from an OIDC provider. While the regex is configured by a privileged administrator, a malicious or misconfigured OIDC provider could send a crafted group name that, when evaluated against a poorly constructed regex (e.g., one susceptible to catastrophic backtracking), could lead to excessive CPU consumption. This could cause a denial of service for the user attempting to log in, and potentially impact the server's performance if the regex operation is resource-intensive enough.

if group_filter and not re.search(group_filter, group_name):
logger.debug(f"Skipping group '{group_name}' due to OIDC_GROUPS_FILTER: {group_filter}")
continue
filtered_group_names.append(group_name)

We've notified @mtesauro.


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

@manuel-sommer
Copy link
Contributor Author

@valentijnscholten could you please take a look here?

@manuel-sommer manuel-sommer changed the title Implement OIDC groups mapping Advance OIDC to enable groups mapping Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs New Migration Adding a new migration file. Take care when merging. settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant