Skip to content

Fix InsecureTransportError raising#810

Merged
lepture merged 1 commit intoauthlib:mainfrom
azmeuk:795-django-request-payload
Aug 27, 2025
Merged

Fix InsecureTransportError raising#810
lepture merged 1 commit intoauthlib:mainfrom
azmeuk:795-django-request-payload

Conversation

@azmeuk
Copy link
Member

@azmeuk azmeuk commented Aug 27, 2025

What kind of change does this PR introduce?

There was an issue with InsecureTransportError being raised while the request has not fully been initialized by Django/Flask. Then the authorization server would try to catch the exception and enrich with request.payload.state, that don't exist because the request is not initialized.

The fix is to avoid enriching the 'state' parameter for exceptions raised during the request initialization, that for the moment can only be InsecureTransportError.

fixes #795

Checklist

  • You ran the linters with prek.
  • You wrote unit test to demonstrate the bug you are fixing, or to stress the feature you are bringing.
  • You reached 100% of code coverage on the code you edited, without abusive use of pragma: no cover

  • You consent that the copyright of your pull request source code belongs to Authlib's author.

There was an issue with InsecureTransportError being raised while the
request has not fully been initialized by Django/Flask. Then the
authorization server would try to catch the exception and enrich with
request.payload.state, that don't exist because the request is not
initialized.

The fix is to avoid enriching the 'state' parameter for exceptions
raised during the request initialization, that for the moment can only
be InsecureTransportError.
@lepture lepture merged commit 8c81922 into authlib:main Aug 27, 2025
8 checks passed
@azmeuk azmeuk deleted the 795-django-request-payload branch August 27, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants