Skip to content

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

Merged
mdellweg merged 1 commit into
pulp:mainfrom
decko:oauth2_fixes
Sep 4, 2024
Merged

Add a new guard clause to the oauth2 client credentials flow.#1050
mdellweg merged 1 commit into
pulp:mainfrom
decko:oauth2_fixes

Conversation

@decko
Copy link
Copy Markdown
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
Comment thread CHANGES/1049.bugfix Outdated
Comment thread pulp-glue/pulp_glue/common/authentication.py Outdated
Comment on lines +87 to +85
if scope := " ".join(self.scopes):
data["scope"] = scope
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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