Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Update auth.py tried to solve the issue no #15871 #16352

Closed
wants to merge 1 commit into from

Conversation

omsai11
Copy link

@omsai11 omsai11 commented Sep 18, 2023

500 error when auth is null for a UIA request #15871

Pull Request Checklist

authdict = clientdict.pop("auth", {})
if "session" in authdict:
sid = authdict["session"]

    # Convert the URI and method to strings.
    uri = request.uri.decode("utf-8")
    method = request.method.decode("utf-8")

    # If there's no session ID, create a new session.
    if not sid:
        new_session_data = get_new_session_data() if get_new_session_data else {}

        session = await self.store.create_ui_auth_session(
            clientdict, uri, method, description
        )

Above one is the original code:

when we put condition this:
authdict = clientdict.pop("auth", {})
if "session" in authdict:
sid = authdict["session"]

    # Convert the URI and method to strings.
    uri = request.uri.decode("utf-8")
    method = request.method.decode("utf-8")

    # If there's no session ID, create a new session.      // handling code 
    if not sid:
        new_session_data = get_new_session_data() if get_new_session_data else {}

        session = await self.store.create_ui_auth_session(
            clientdict, uri, method, description
        )

it will work because we are avoiding null values if it occurs it we handled by the handling code

@omsai11 omsai11 requested a review from a team as a code owner September 18, 2023 18:26
Copy link
Member

@clokep clokep left a comment

Choose a reason for hiding this comment

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

This is similar to #15944 and #16153 which were rejected. Please take a look at the comments there -- we need to add more up-front validation instead of ignoring invalid data.

@omsai11
Copy link
Author

omsai11 commented Sep 18, 2023

Sorry actually i am a begineer and new to open source contribution thats why didnt checks

@omsai11
Copy link
Author

omsai11 commented Sep 18, 2023

@clokep ok sir i will watch into it

@clokep clokep added the X-Awaiting-Changes A contributed PR which needs changes and re-review before it can be merged label Sep 18, 2023
@clokep clokep closed this Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
X-Awaiting-Changes A contributed PR which needs changes and re-review before it can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants