Skip to content

Check API token owners and scope login tokens - #135

Merged
mpge merged 1 commit into
mainfrom
fix/staff-api-token-security
Nov 26, 2026
Merged

mpge merged 1 commit into
mainfrom
fix/staff-api-token-security

Conversation

@mpge

@mpge mpge commented Nov 26, 2026

Copy link
Copy Markdown
Member

Tightens who an API token lets in.

  • auth/login and auth/register issue a token that matches the user's Escalated role: * for Escalated admins, agent for other staff, customer for everyone else. A customer token reaches only auth/me, auth/profile, auth/refresh and auth/logout.
  • Every agent and admin route checks that the token's owner is still Escalated staff, whatever the visibility setting (403 User no longer has agent access., as escalated-laravel).
  • auth/refresh keeps the token's name, abilities and expiry.
  • A request counts once against the API rate limit (the token was re-checked in handlers and counted twice).

Tests: tests/Test_Api_Token_Owner.php (fails on main, passes here); Test_Ticket_Visibility now expects 403 instead of 401 for a token whose owner is not staff. CHANGELOG and docs/access-control.md updated.

The password login and registration issued a full-access token to every
user. They now issue * to Escalated admins, agent to other staff and
customer to everyone else; a customer token reaches only the auth routes
about its own account.

Every agent and admin route now checks that the token's owner is still
staff, whatever the visibility setting. auth/refresh keeps the token's
name, abilities and expiry, and a request counts once against the rate
limit.
@mpge
mpge merged commit e1a0736 into main Nov 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant