Skip to content
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

Refactor prepareIntrospectionResponse to use ensureType to avoid panic behaviour #7231

Open
MohamedSabthar opened this issue Oct 4, 2024 · 0 comments

Comments

@MohamedSabthar
Copy link
Member

Description:
In the current implementation of the oauth2, the prepareIntrospectionResponse method panics in multiple places. This is primarily caused by the use of explicit casting (Diamond Operator). However, using diamond operator is not recommended as it leads to unexpected failures.

Expected Behavior:

  • The current casting logic should be refactored to use the ensureType method instead.
  • If an error occurs while using ensureType, the introspection response should be considered invalid and OAuth2 validation should fail due to authorization server does not follow the RFC specification.

Solution:

  • Refactor all instances where diamond-operator/checkpanic is used in the prepareIntrospectionResponse method to use ensureType.
  • Handle the error gracefully by marking the introspection response as invalid.

OS, DB, other environment details and versions:

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

@MohamedSabthar MohamedSabthar self-assigned this Oct 4, 2024
@MohamedSabthar MohamedSabthar changed the title Refactor prepareIntrospectionResponse to Use ensureType to avoid panic Refactor prepareIntrospectionResponse to use ensureType to avoid panic behaviour Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: BackLog
Development

No branches or pull requests

1 participant