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

Error response code not compliant to RFC 6749 #2545

Closed
neelalex opened this issue Oct 16, 2023 · 8 comments · Fixed by #2596
Closed

Error response code not compliant to RFC 6749 #2545

neelalex opened this issue Oct 16, 2023 · 8 comments · Fixed by #2596
Assignees
Labels
accepted Accepted the issue
Milestone

Comments

@neelalex
Copy link

neelalex commented Oct 16, 2023

What version of UAA are you running?

76.22.0 (latest)

How are you deploying the UAA?

as part of a commercial Cloud Foundry distribution

What did you do?

I am trying to generate access tokens using the token endpoint - {authenticationUrl}/oauth/token

What did you expect to see? What goal are you trying to achieve with the UAA?

with invalid client credentials, the error response was expected to be as follows:

  • Code: 401 Unauthorized
  • Body:
    - “error”: “invalid_grant”
    • “error_description”: “Bad credentials”

What did you see instead?

with invalid client credentials, the error response is as follows:

  • Code: 401 Unauthorized
  • Body:
    - “error”: “unauthorized”
    • “error_description”: “Bad credentials”

Question 1: in RFC6749 section 5.2 - “unauthorized” is not in the list of allowed ‘error codes’. We should use an error response code from this available list of codes.
Question 2: in RFC6749 section 5.2 - suggests a 400 unless specified otherwise. Any reason why we use a 401?

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/186262249

The labels on this github issue will be updated when the story is started.

@neelalex
Copy link
Author

Is there any update on the same?

@strehle
Copy link
Member

strehle commented Oct 18, 2023

Hi @neelalex

Ok, I simply checked client credential agains some others.

Others reply with

401
{"error":"invalid_client","error_description":"Client authentication failed"}

Azure tells a long story in error_description, but also invalid_client in error

So yes, we should fix it in UAA.

Are you able to create a fixing PR ? This would increase the time until we get the fix.

@strehle
Copy link
Member

strehle commented Oct 18, 2023

@Tallicia FYI, BadCredential in UAA is not from OAuth2Exception , so we should move to own Exception . In spring-security-oauth2 library there would be an extra Exception -> BadClientCredentialsException, but this is depcrecated because the library is depcrecated... so we need to do it on our own

@strehle strehle added accepted Accepted the issue and removed unscheduled labels Oct 18, 2023
@strehle strehle self-assigned this Oct 19, 2023
@strehle strehle added this to the 76.24.0 milestone Oct 19, 2023
@strehle strehle linked a pull request Oct 25, 2023 that will close this issue
@strehle strehle modified the milestones: 76.24.0, 76.25.0 Oct 26, 2023
@neelalex
Copy link
Author

Hi team,
I can see there is a Pull Request open, when can we expect the fix to be available and in which version?

@strehle
Copy link
Member

strehle commented Oct 26, 2023

yes the PR is in review, it is small but we need some time. We will change only the error text, but if a client would use exsisting error text, it would fail

@strehle strehle modified the milestones: 76.25.0, 76.26.0 Nov 3, 2023
strehle added a commit that referenced this issue Nov 13, 2023
return invalid_client in oauth2 error response body

Fix for issue #2545
strehle added a commit that referenced this issue Nov 13, 2023
return invalid_client in oauth2 error response body

Fix for issue #2545
@strehle
Copy link
Member

strehle commented Nov 16, 2023

created #2596 as alternative

@strehle
Copy link
Member

strehle commented Nov 16, 2023

@neelalex we will fix this soon with PR #2596 , please check if this would solve it for you

strehle added a commit that referenced this issue Nov 17, 2023
return invalid_client in oauth2 error response body

Fix for issue #2545
@cf-gitbot cf-gitbot removed the accepted Accepted the issue label Nov 17, 2023
@cf-gitbot cf-gitbot added delivered accepted Accepted the issue and removed delivered labels Mar 19, 2024
joaopapereira added a commit to joaopapereira/cf-cli that referenced this issue Jun 18, 2024
Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <[email protected]>
strehle added a commit to strehle/cli that referenced this issue Jun 19, 2024
cf auth some-username some-password

Returns before UAA 76.26.0 unauthorized, after invalid_client

Reason is: cloudfoundry/uaa#2545
joaopapereira added a commit to joaopapereira/cf-cli that referenced this issue Jun 20, 2024
Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <[email protected]>
gururajsh pushed a commit to cloudfoundry/cli that referenced this issue Jun 20, 2024
* Ensure correct pool is being used for PRs

* Use integration workflow directly from unit tests

* Provide secret directly instead of using env variable

* Remove check for Server header in curl request tests

Starting on version 1.181.0, capi will no longer report the version of
the nginx server to ensure that no information is leaked.
For more information check cloudfoundry/capi-release#406

* Change in response from UAA

Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <[email protected]>
joaopapereira added a commit to joaopapereira/cf-cli that referenced this issue Jun 20, 2024
Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <[email protected]>
gururajsh pushed a commit to cloudfoundry/cli that referenced this issue Jun 20, 2024
* Ensure correct pool is being used for PRs

* Use integration workflow directly from unit tests

* Provide secret directly instead of using env variable

* Remove check for Server header in curl request tests

Starting on version 1.181.0, capi will no longer report the version of
the nginx server to ensure that no information is leaked.
For more information check cloudfoundry/capi-release#406

* Change in response from UAA

Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <[email protected]>
joaopapereira added a commit to joaopapereira/cf-cli that referenced this issue Jun 24, 2024
Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <[email protected]>
a-b pushed a commit to cloudfoundry/cli that referenced this issue Jun 28, 2024
* Ensure correct pool is being used for PRs
* Use integration workflow directly from unit tests
* Provide secret directly instead of using env variable
* Remove check for Server header in curl request tests

Starting on version 1.181.0, capi will no longer report the version of
the nginx server to ensure that no information is leaked.
For more information check cloudfoundry/capi-release#406

* Change in response from UAA

Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

* Revert min-capi tests introduction
* Incorrect merge of cherry-pick

Signed-off-by: João Pereira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Accepted the issue
Projects
3 participants