Session elevation duration is unbounded, and large values silently overflow to a past timestamp
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- go
- Domain
- api, authentication, security
Research direction
Start with ElevateRequest.DurationSeconds in model/elevate.go, then inspect the elevation paths at api/client.go:128 and api/oidc.go:186. Add validation that rejects values above the chosen ceiling and verify both endpoints return 400 for excessive and overflow-prone durations instead of accepting them.
Written by the indexing model from the issue text.
Description
ElevateRequest.DurationSeconds (model/elevate.go) is only validated as non-zero, and both elevation paths multiply it straight into a time.Duration:
api/client.go:128—POST /client/:id/elevateapi/oidc.go:186— the OIDC elevation callback
Two consequences, both reproduced on v3.1.1:
1. Elevation can be made effectively permanent. One call turns the hour-long elevation from login into a century:
$ curl -s -o /dev/null -w '%{http_code}\n' -X POST localhost:8791/client/1/elevate \
-H "X-Gotify-Key: $TOK" -H 'Content-Type: application/json' -d '{"durationSeconds":3153600000}'
204
$ curl -s localhost:8791/current/user -H "X-Gotify-Key: $TOK"
{"id":1,...,"elevatedUntil":"2126-08-23T23:11:49.409030064-04:00"}
The caller must already be elevated, so this is not a privilege jump on its own — but it means a single moment of elevation (or a token stolen inside the hour after login) yields a session that never needs basic auth again, which is the opposite of what elevation is for. The UI has no way to show or revoke "elevated until 2126" other than deleting the client.
2. Large values silently overflow instead of erroring. time.Duration(DurationSeconds) * time.Second wraps for anything past ~292 years:
$ curl -s -o /dev/null -w '%{http_code}\n' -X POST localhost:8791/client/1/elevate \
-H "X-Gotify-Key: $TOK" -H 'Content-Type: application/json' -d '{"durationSeconds":9223372036854775807}'
204
$ curl -s localhost:8791/current/user -H "X-Gotify-Key: $TOK"
{"id":1,...} # elevatedUntil now in the past — 204, but elevation silently dropped
Suggestion: clamp durationSeconds with a binding:"min=1,max=…" tag (model.DefaultElevationDuration, or some multiple of it, seems like the natural ceiling) so both the century case and the overflow case become a 400.
- Dominant language
- Go
- Stars
- 16k
- Forks
- 891
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gotify/server
-
a:bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
gotify/server#1068 · 1 reaction ·
Maintainers usually reply within 2 days
-
a:bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
gotify/server#1047 · 6 comments ·
Maintainers usually reply within 2 days
-
a:feature
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
a:feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
a:feature
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
product/backlog
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
TencentBlueKing/bk-nodemgr#3645 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modelcontextprotocol/go-sdk#1387 ·
Maintainers usually reply within 1 day