Skip to content

Sso clean up#14615

Closed
Maffooch wants to merge 2 commits intoDefectDojo:devfrom
Maffooch:sso-clean-up
Closed

Sso clean up#14615
Maffooch wants to merge 2 commits intoDefectDojo:devfrom
Maffooch:sso-clean-up

Conversation

@Maffooch
Copy link
Copy Markdown
Contributor

⚠️ Pre-Approval check ⚠️

We don't want to waste your time, so if you're unsure whether your hypothetical enhancement meets the criteria for approval, please file an issue to get pre-approval before beginning work on a PR.
Learn more here: https://github.com/DefectDojo/django-DefectDojo/blob/master/readme-docs/CONTRIBUTING.md#submission-pre-approval

Description

Describe the feature / bug fix implemented by this PR.
If this is a new parser, the parser guide may be worth (re)reading.

Test results

Ideally you extend the test suite in tests/ and dojo/unittests to cover the changed in this PR.
Alternatively, describe what you have and haven't tested.

Documentation

Please update any documentation when needed in the documentation folder)

Checklist

This checklist is for your information.

  • Make sure to rebase your PR against the very latest dev.
  • Features/Changes should be submitted against the dev.
  • Bugfixes should be submitted against the bugfix branch.
  • Give a meaningful name to your PR, as it may end up being used in the release notes.
  • Your code is Ruff compliant (see ruff.toml).
  • Your code is python 3.13 compliant.
  • If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR.
  • Model changes must include the necessary migrations in the dojo/db_migrations folder.
  • Add applicable tests to the unit tests.
  • Add the proper label to categorize your PR.

Extra information

Please clear everything below when submitting your pull request, it's here purely for your information.

Moderators: Labels currently accepted for PRs:

  • Import Scans (for new scanners/importers)
  • enhancement
  • performance
  • feature
  • bugfix
  • maintenance (a.k.a chores)
  • dependencies
  • New Migration (when the PR introduces a DB migration)
  • settings_changes (when the PR introduces changes or new settings in settings.dist.py)

Contributors: Git Tips

Rebase on dev branch

If the dev branch has changed since you started working on it, please rebase your work after the current dev.

On your working branch mybranch:

git rebase dev mybranch

In case of conflict:

 git mergetool
 git rebase --continue

When everything's fine on your local branch, force push to your myOrigin remote:

git push myOrigin --force-with-lease

To cancel everything:

git rebase --abort

Squashing commits

git rebase -i origin/dev
  • Replace pick by fixup on the commits you want squashed out
  • Replace pick by reword on the first commit if you want to change the commit message
  • Save the file and quit your editor

Force push to your myOrigin remote:

git push myOrigin --force-with-lease

Maffooch and others added 2 commits March 30, 2026 22:32
Move all SSO functionality (OAuth2, SAML2, OIDC, remote user auth) into
dojo/sso/ so that removing SSO requires only deleting the directory and
removing packages from requirements.txt. All hooks in shared files use
try/except ImportError guards that gracefully degrade when dojo/sso/ is
absent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix import sorting in settings.dist.py
- Suppress C408 for dict() kwargs merging pattern
- Use Path() instead of os.path in sso/settings.py
- Use augmented assignment (+=) for dict key concatenation
- Use iterable unpacking instead of list concatenation
- Add noqa for intentional non-top-level imports (try/except guards)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Maffooch Maffooch requested a review from mtesauro as a code owner March 31, 2026 04:38
@github-actions github-actions Bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests ui labels Mar 31, 2026
@Maffooch Maffooch closed this Mar 31, 2026
@dryrunsecurity
Copy link
Copy Markdown

DryRun Security

This pull request includes a risky change where the login template inserts request.GET.next directly into href attributes (dojo/sso/templates/dojo/sso_login_buttons.html lines 5–8), which can lead to reflected XSS or open redirect vulnerabilities if the value is not validated or URL-encoded. Recommend validating/normalizing or URL-encoding the next parameter, or otherwise sanitizing/whitelisting allowed redirect targets to mitigate the issue.

🔴 Potential Cross-Site Scripting in dojo/sso/templates/dojo/sso_login_buttons.html (drs_b1e5940c)
Vulnerability Potential Cross-Site Scripting
Description The login template includes request.GET.next directly into multiple href attributes (e.g. ?next={{ request.GET.next }}) coming from user-controlled query parameters. If this value is not validated or URL-encoded before insertion it can lead to unsafe output in URLs and potentially enable reflected XSS or open redirect behavior depending on how the value is later used.

<a href="{% url 'social:begin' 'oidc' %}?next={{ request.GET.next }}" style="color: rgb(255, 255, 255)" class="btn btn-success" type="button">{{ SOCIAL_AUTH_OIDC_LOGIN_BUTTON_TEXT }}</a>
</div>
{% endif %}


Comment to provide feedback on these findings.

Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]

Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing

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

settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR ui unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant