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

Add a new guard clause to the oauth2 client credentials flow. #1050

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

decko
Copy link
Member

@decko decko commented Aug 26, 2024

Closes #1049

@decko decko force-pushed the oauth2_fixes branch 3 times, most recently from 73a5c0a to 64d63ae Compare August 27, 2024 14:34
CHANGES/1049.bugfix Outdated Show resolved Hide resolved
pulp-glue/pulp_glue/common/authentication.py Outdated Show resolved Hide resolved
Comment on lines 87 to 85
if scope := " ".join(self.scopes):
data["scope"] = scope
Copy link
Member

Choose a reason for hiding this comment

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

This would be an actual change, but what is the issue we are solving here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Some Idps doesn't require a scope parameter to issue a token. And since it's not required, maybe sending it as an empty value could cause an issue with the IdP itself.

Copy link
Member

Choose a reason for hiding this comment

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

"Maybe" is a bit vague. Can you find a place in rcf6749 being specific about this?

Copy link
Member Author

Choose a reason for hiding this comment

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

https://datatracker.ietf.org/doc/html/rfc6749#section-4.4.2

scope
         OPTIONAL.  The scope of the access request as described by
         [Section 3.3](https://datatracker.ietf.org/doc/html/rfc6749#section-3.

Copy link
Member

Choose a reason for hiding this comment

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

This tells me it's optional. But is it allowed to send an empty string? If yes, does it convey a different semantic?

Copy link
Member Author

@decko decko Sep 4, 2024

Choose a reason for hiding this comment

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

As we stated, if the scope is to be used, it must not be empty. https://datatracker.ietf.org/doc/html/rfc6749#section-3.3

@decko decko changed the title Add new guard clauses to the oauth2 client credentials flow. Add a new guard clause to the oauth2 client credentials flow. Aug 27, 2024
mdellweg
mdellweg previously approved these changes Sep 4, 2024
@mdellweg mdellweg enabled auto-merge (rebase) September 4, 2024 08:05
auto-merge was automatically disabled September 4, 2024 09:41

Head branch was pushed to by a user without write access

According to the section 3.3 of RFC 6749 OAuth2 Access Token Scope,
this is the notation that defines how the scope should be send to the
IdentityProvider:
     `scope = scope-token *( SP scope-token )`

Basically it should be omitted if it's empty.
@mdellweg mdellweg merged commit 9459971 into pulp:main Sep 4, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some guards are failing
2 participants