nextcloud / nextcloud/server

Make oauth2 tokens expiration time configurable

Open
#42,738 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: authentication
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Currently access tokens that are given out by Nextcloud hard coded to be vaild for 3600 seconds: https://github.com/nextcloud/server/blob/48628b90690d8204e7875d561b8115c526cc9176/apps/oauth2/lib/Controller/OauthApiController.php#L203-L223C21

RFC 6750 states that: https://datatracker.ietf.org/doc/html/rfc6750#section-5.2

 To deal with token capture and replay, the following recommendations
   are made: First, the lifetime of the token MUST be limited; one means
   of achieving this is by putting a validity time field inside the
   protected part of the token.  Note that using short-lived (one hour
   or less) tokens reduces the impact of them being leaked.

Following these guidelines, a server administrator might want to reduce the validity of a token, to a shorter interval. Conversely, there may also be situations in which a server administrator may want to extend the expiration time of a token, following careful consideration of the impact of such a decision.

I therefore propose that we make the oauth2 access token validity time configurable. I am willing to submit a PR for this, if others think that this could be useful?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/oauth2/lib/Controller/OauthApiController.php around the hard-coded 3600-second validity period, then inspect how Nextcloud exposes related server configuration. Define a configurable access-token lifetime while preserving the RFC 6750 security considerations; the work is done when administrators can control the validity interval and the OAuth2 behavior reflects that setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.