This issue has been created
There is 1 comment.
 
 
OpenId Connect / cid:jira-generated-image-avatar-636d0ae1-ad40-480c-8389-692077fda14a OIDC-331 Open

OAuth2 tokens longer than 768 characters cannot be stored

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-eae30f3d-e088-4050-8017-cfa0f3d33fbc Rares-Emil Bancescu created this issue on 04/Nov/26 15:06
 
Summary: OAuth2 tokens longer than 768 characters cannot be stored
Issue Type: cid:jira-generated-image-avatar-636d0ae1-ad40-480c-8389-692077fda14a Improvement
Affects Versions: 2.29.1
Assignee: Unassigned
Created: 04/Nov/26 15:06
Priority: cid:jira-generated-image-static-major-63020ed5-3dfa-46f5-b5f0-889b4a25abb6 Major
Reporter: Rares-Emil Bancescu
Description:

The accessToken and refreshToken properties of XWiki.OAuth2.TokenClass are Password properties, which are stored as short strings, limited to 768 characters by the database schema. Some providers issue longer tokens: Jira Cloud's OAuth 2.0 access tokens, for example, are JWTs over that limit. Saving such a token fails, so the authorization cannot complete.

Steps to reproduce

  1. Configure an OAuth2 client for a provider that issues tokens longer than 768 characters (e.g. Jira Cloud)
  2. Authorize XWiki against that provider

Result

The token document cannot be saved. With HSQLDB:

Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation ; size limit: 768 table: XWIKISTRINGS column: XWS_VALUE

The other databases have the same limit and fail the same way.

Expected

The token is stored, whatever its length. The OAuth 2.0 specification does not limit the token size, so the properties should be stored as large strings and still be hidden like passwords. The values already stored should be migrated to the new property type.

 
 

1 comment

 
cid:jira-generated-image-avatar-97574fc5-7ec6-4bc3-b31a-aa54387c7dae Michael Hamann on 04/Nov/26 15:09
 

Note that this shouldn't affect versions of XWiki where XWIKI-23827 has been fixed, so 18.1.0RC1+ and 17.10.14+. I'm not sure it is worth fixing this separately in the OIDC extension.