fix(auth): clarify token_auth_enforced semantics and add auth token revoke occ command#59569
Draft
joshtrichards wants to merge 17 commits intomasterfrom
Draft
fix(auth): clarify token_auth_enforced semantics and add auth token revoke occ command#59569joshtrichards wants to merge 17 commits intomasterfrom
joshtrichards wants to merge 17 commits intomasterfrom
Conversation
… sessions/tokens Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Particularly useful after enabling `token_auth_enforced` for existing sessions/tokens. Signed-off-by: Josh <josh.t.richards@gmail.com>
…n `token_auth_enforced` Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
…ific Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
token_auth_enforcedset #50279Summary
Clarify the documented behavior of
token_auth_enforcedand add a newocccommand to revoke existing auth tokens/sessions when admins want to enforce the policy on already-authenticated users.Changes:
config/config.sample.phpto clarify thattoken_auth_enforced:occ user:auth-tokens:revoke --sessionsocc user:auth-tokens:revokewith mode flags:--sessions: all temporary session tokens (including remembered)--remembered-sessions: remembered session tokens only--all-except-app-passwords: everything except permanent app passwords--all: everything including app passwords--all-users--dry-runand--forceMotivation:
The previous documentation suggested immediate full enforcement for all client access. In practice,
token_auth_enforcedis only checked inlogClientIn(), so already-issued sessions/tokens are not re-checked against it. ExistingTEMPORARY_TOKENentries can therefore remain valid as long as clients keep using them, since each request refresheslast_activityand prevents age-based cleanup.This change makes that behavior explicit and provides admins with a supported way to revoke existing auth state if they want full enforcement after enabling the setting.
Notes:
token_auth_enforced; this adds an explicit admin action instead of introducing implicit mass logout on config toggle.user:auth-tokens:deleteis token-id/uid/date oriented. The newrevokecommand is policy-oriented and targets token classes directly, which fits the "enabledtoken_auth_enforcedand need to clean up" admin workflow.--all-usersin non-dry-run mode, revocation uses bulk SQL deletes instead of per-tokeninvalidateTokenById(). This intentionally skips per-tokenTokenInvalidatedEventdispatch for performance. The token cache is short-lived (TOKEN_CACHE_TTL/ 10s), and similar bulk invalidation patterns already exist elsewhere in the code base (e.g.invalidateOld()anddeleteTempToken()inPublicKeyTokenMapper).TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)