Description
- Gitea version (or commit ref): bd1bf2a (current master as of this post)
- Git version: 2.7.4
- Operating system: Ubuntu Server
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist: N/A
Description
At this line of code:
if audience != p.ClientKey {
It is performing a string comparison between audience
and p.ClientKey
, however, according to the OpenID Connect spec that that very source file links to just 3 lines higher states (emphasis mine):
The Client MUST validate that the
aud
(audience) Claim contains itsclient_id
value registered at the Issuer identified by theiss
(issuer) Claim as an audience. Theaud
(audience) Claim MAY contain an array with more than one element. The ID Token MUST be rejected if the ID Token does not list the Client as a valid audience, or if it contains additional audiences not trusted by the Client.
And in fact an array is being passed in by some OpenID Connect servers, which is causing this to fail and be unusable.
The fix is fairly trivial conceptually, just need to perform a string comparison if aud
is a string, else need to test if p.ClientKey
is a member of the array of strings that is then in aud
.