Skip to content

Adding SOCIAL_AUTH_REDIRECT_IS_HTTPS, to enable use of HTTPS protocol when redirecting after login using social auth.#13614

Merged
valentijnscholten merged 4 commits intoDefectDojo:devfrom
marcelhorner:adding-social-auth-redirect-is-https
Nov 6, 2025
Merged

Adding SOCIAL_AUTH_REDIRECT_IS_HTTPS, to enable use of HTTPS protocol when redirecting after login using social auth.#13614
valentijnscholten merged 4 commits intoDefectDojo:devfrom
marcelhorner:adding-social-auth-redirect-is-https

Conversation

@marcelhorner
Copy link
Copy Markdown
Contributor

Description

When setting up DD_SECURE_SSL_REDIRECT to False and Azure auth, after login the redirect uses HTTP protocol by default. To enable DefectDojo to redirect with HTTPS protocol after login, which is required by Azure, we need to set SOCIAL_AUTH_REDIRECT_IS_HTTPS to True on Django framework.

This change adds the DD_SOCIAL_AUTH_REDIRECT_IS_HTTPS to to defectdojo\dojo\settings\settings.dist.py, making it possible to set SOCIAL_AUTH_REDIRECT_IS_HTTPS on Django framework.

Test results

I have a DefectDojo installation on a Kubernetes cluster. It was installed with helm and helm value file has DD_SECURE_SSL_REDIRECT: "False" config. After setting up auth on Azure I got an error about redirect not matching with Azure config.

After adding SOCIAL_AUTH_REDIRECT_IS_HTTPS var on defectdojo\dojo\settings\settings.dist.py and setting it to True on helm value file Azure auth proccess worked.

@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 Nov 4, 2025
@valentijnscholten valentijnscholten added this to the 2.53.0 milestone Nov 4, 2025
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good. Could you add something like ", or set the `DD_SOCIAL_AUTH_REDIRECT_IS_HTTPS "
to:

If during the login process you get the following error: *The
'redirect_uri' parameter must be an absolute URI that is whitelisted
in the client app settings.* and the `redirect_uri` HTTP
GET parameter starts with `http://` instead of
`https://` you need to add
`SOCIAL_AUTH_REDIRECT_IS_HTTPS = True` to Docker environment variables, or to your `local_settings.py` file.

…hen using helm to docs (docs/content/en/customize_dojo/user_management/configure_sso.md).
@github-actions github-actions Bot added the docs label Nov 4, 2025
@marcelhorner
Copy link
Copy Markdown
Contributor Author

Thanks! Looks good. Could you add something like ", or set the `DD_SOCIAL_AUTH_REDIRECT_IS_HTTPS " to:

If during the login process you get the following error: *The
'redirect_uri' parameter must be an absolute URI that is whitelisted
in the client app settings.* and the `redirect_uri` HTTP
GET parameter starts with `http://` instead of
`https://` you need to add
`SOCIAL_AUTH_REDIRECT_IS_HTTPS = True` to Docker environment variables, or to your `local_settings.py` file.

Done.

…hen using helm to docs (docs/content/en/customize_dojo/user_management/configure_sso.md).
Comment thread docs/content/en/customize_dojo/user_management/configure_sso.md Outdated
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to hijack the PR, but I reworded the docs text to align with how we describe these in other places. Thanks for the PR and sharing this solution!

Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@@ -511,7 +511,7 @@ If during the login process you get the following error: *The
in the client app settings.* and the `redirect_uri` HTTP
GET parameter starts with `http://` instead of
`https://` you need to add
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the wording does not fit to the setting.
and the redirect_uri HTTP
GET parameter starts with https:// instead of
http:// you need to add
(because the DD_SOCIAL_AUTH_REDIRECT_IS_HTTPS=(bool, False))

And shouldn't we make this setting always to True just because DefectDojo is a security tool?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And shouldn't we make this setting always to True just because DefectDojo is a security tool?

No as the default is false from the lib. We want to avoid potentially breaking SSO for some folks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds legit

@Maffooch Maffooch requested a review from Jino-T November 6, 2025 07:31
@valentijnscholten valentijnscholten merged commit 2f9a5aa into DefectDojo:dev Nov 6, 2025
151 checks passed
Maffooch pushed a commit to valentijnscholten/django-DefectDojo that referenced this pull request Feb 16, 2026
… when redirecting after login using social auth. (DefectDojo#13614)

* Adding SOCIAL_AUTH_REDIRECT_IS_HTTPS, to enable use of HTTPS protocol when redirecting after login.

* Adding description about how to setup SOCIAL_AUTH_REDIRECT_IS_HTTPS when using helm to docs (docs/content/en/customize_dojo/user_management/configure_sso.md).

* Adding description about how to setup SOCIAL_AUTH_REDIRECT_IS_HTTPS when using helm to docs (docs/content/en/customize_dojo/user_management/configure_sso.md).

* Apply suggestion from @valentijnscholten

---------

Co-authored-by: Marcel Horner <marcel.horner@stefanini.com>
Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants