bug(auth): PATCH /auth/v1/logins/<id>/ stores expiry_seconds but never extends expires_at
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- authentication, backend
Research direction
Start with the PATCH handler in campus/auth/routes/logins.py around line 142, which passes expiry_seconds to login_resource[session_id].update(). Then read update() in campus/auth/resources/login.py near line 129, and post_init to see how expires_at is first derived from created_at. Settle the open questions in the issue first: whether extensions count from now or created_at, and what cap applies to expiry_seconds. Done means a contract test reads the session back after the PATCH and sees the new expires_at.
Written by the indexing model from the issue text.
Description
What
PATCH /auth/v1/logins/<session_id>/ is documented as extending a login session. It stores expiry_seconds and leaves expires_at alone, so the session's real deadline does not move.
Established by reading the code path. Not exercised by a test.
Where
campus/auth/routes/logins.py:142passesexpiry_secondsstraight tologin_resource[session_id].update(...).campus/auth/resources/login.py:129,update(), writes the given fields as they are (# TODO: Validate update fields).expires_atis derived only in__post_init__at creation, fromcreated_atplusexpiry_seconds.- The expiry check at
routes/logins.py:249readsexpires_at.
Effect
A caller that asks for another hour gets a 200 and an unchanged deadline. Once the auth housekeeping job starts sweeping by expires_at, the session is removed at the original time however often it was "extended".
Proposed fix
In update(), when expiry_seconds is supplied, recompute and store expires_at in the same write. Two things to decide first:
- Whether an extension counts from now or from
created_at. Creation usescreated_at. - A cap on
expiry_seconds, since it is caller-supplied and currently unvalidated.
Add a contract test that reads the session back after the PATCH and checks expires_at.
- Dominant language
- Python
- Stars
- 0
- Forks
- 2
- Avg merge
- 39m
- Merged PRs (30d)
- 235
Getting set up
- No Dockerfile or Docker Compose file
- Has a 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 nyjc-computing/campus
-
enhancement for-collaborators for-contributors
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nyjc-computing/campus#451 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
nyjc-computing/campus#1320 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
nyjc-computing/campus#1309 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
nyjc-computing/campus#1300 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 5/100
nyjc-computing/campus#1295 · 4 comments ·
Maintainers usually reply within 1 day
All issues in nyjc-computing/campus
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day