fosite icon indicating copy to clipboard operation
fosite copied to clipboard

WriteRevocationResponse returns no error when there is an internal error

Open mitar opened this issue 4 years ago • 4 comments

Preflight checklist

Describe the bug

WriteRevocationResponse returns 200 HTTP status code on any error except ErrInvalidRequest and ErrInvalidClient. This is problematic because I just had some bad code (internal error) but the error response was 200. So nothing was being revoked in my implementation, but nobody really detected this for some time.

Reproducing the bug

Pass some regular error to WriteRevocationResponse.

Relevant log output

No response

Relevant configuration

No response

Version

0.42.0

On which operating system are you observing this issue?

No response

In which environment are you deploying?

No response

Additional Context

No response

mitar avatar Jan 18 '22 18:01 mitar

So the error was ErrTemporarilyUnavailable returned from storeErrorsToRevocationError.

mitar avatar Jan 18 '22 18:01 mitar

What would be the solution? The spec here requires us to send 200 except for 400 & 401

aeneasr avatar Apr 05 '22 19:04 aeneasr

The spec is slightly confusing:

Here it references Section 5.2 of [RFC6749] but also later on says "If the server responds with HTTP status code 503" so at least 503 is allowed as well?

Other implementations seems to define 500 as return code as well: https://connect2id.com/products/server/docs/api/token-revocation

But yea, RFC6749 does not list server error (and 500 code) as possible response. But I think it would really be strange not to return 500 when there is some internal error?

mitar avatar Apr 05 '22 21:04 mitar

I see - in the light of usuability issues I think it would be acceptable to return 500 which implies that the error needs to be retried - for example when the database is down.

aeneasr avatar Apr 16 '22 23:04 aeneasr