-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Advance OIDC to enable groups mapping #13489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bugfix
Are you sure you want to change the base?
Advance OIDC to enable groups mapping #13489
Conversation
b265c56 to
252f404
Compare
🔴 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
|
| 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. |
django-DefectDojo/dojo/group/utils.py
Lines 46 to 47 in 4a5bb81
| 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. |
django-DefectDojo/dojo/pipeline.py
Lines 122 to 125 in 4a5bb81
| 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.
|
@valentijnscholten could you please take a look here? |
Uh oh!
There was an error while loading. Please reload this page.