Repository navigation
Closed
Description
Summary
A logged-in user has no way to change their own password through the running JSS. The only password-management interface today is the jss passwd <user> CLI (#232), which requires shell access on the server. End users in a multi-user pod or anyone running JSS without local shell access (containers, managed hosts, etc.) is stuck.
Current state
- CLI:
jss passwd <user>— operator-only, shell required. - HTTP IDP:
POST /idp/credentials— login only (issues token).- No change-password / password-reset endpoint.
- Account records carry
passwordHash(bcrypt) so the data layer already supports a rotation, just no API.
Proposed shape
A single authenticated endpoint, owner-only (the caller's WebID must match the account's WebID), gated by re-supplying the current password as proof:
PUT /idp/credentials
Authorization: <existing session / DPoP>
Content-Type: application/json
{
"currentPassword": "...",
"newPassword": "..."
}
- 200 + new bcrypt hash written, all other sessions invalidated, current session re-issued.
- 401 if current password is wrong.
- 401 if not authenticated.
- 403 if the authenticated WebID doesn't match the target account.
(Path bikeshed: PUT /idp/credentials matches the existing POST /idp/credentials shape; alternatives are POST /idp/account/password or PATCH /idp/credentials. Not load-bearing — pick whatever lands cleanly with the existing IDP routes.)
Out of scope
- Password recovery / forgot-password flow (no current password). That's a separate feature that needs an email channel + token store. File as a follow-up if/when there's a recovery story.
- WebAuthn / passkey rotation (separate auth mechanism, tracked in feat: Add passkey (WebAuthn) authentication support #78).
Acceptance
- New endpoint accepts a valid
{currentPassword, newPassword}from the authenticated owner and rotates the hash. - Wrong
currentPassword→ 401, hash unchanged. - Cross-account write attempts (authenticated as A, targeting B's password) → 403.
- Any other active sessions for the rotated account are invalidated (refresh tokens revoked, etc.).
- Existing
jss passwd <user>CLI continues to work unchanged. - Tests cover happy path + the three failure modes above + session-invalidation behavior.
Metadata
Metadata
Assignees
Labels
No labels
Activity
idp: add PUT /idp/credentials for self-service password change (#355)
melvincarvalho commentedon May 3, 2026
Note on partial scope — #355 shipped the endpoint + rotation, but session invalidation is deliberately deferred, not implemented:
The implementation path is well-understood if needed: `account.passwordChangedAt` is already stamped on rotation, so `verifyToken()` can reject any token with `iat < passwordChangedAt` (~10 lines).
Re-open if a stolen-token scenario becomes a real concern, or if the server starts hosting accounts beyond the operator's circle of trust.
Related: #356 (rate-limit IP spoofing — separate server-wide concern surfaced during PR review).
idp: self-service DELETE /idp/account endpoint (#352) (#391)
feat: GET /idp/account/export — self-service pod data download (#353) (…