Skip to content

Fixes issue with API token auth - #3606

Open
briri wants to merge 2 commits into
mainfrom
api-patch
Open

Fixes issue with API token auth#3606
briri wants to merge 2 commits into
mainfrom
api-patch

Conversation

@briri

@briri briri commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes an issue that allows user's whose account has been deactivated or has had the use_api permission revoked to continue using an API v1 JWT. (see slack for a full report of the issue)

This PR just adds some checks to the authorization service to ensure the user is still active and has permission when trying to use a JWT.

I'm not sure why rubocop reports a CyclomaticComplexity on here, there is a rubocop:disable line already in place for that rule.

@gjacob24

gjacob24 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @briri, thanks for the PR. I've just added something now for API v0 because we still use it and it had the same issue.

@api_client = User.where(email: token[:client_id]).first
# Valid if User is active, has permission to use the API and
# the :client_secret matches the token
usr = User.where(email: token[:client_id], active: true, api_token: @client_secret).first

@gjacob24 gjacob24 Aug 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronskiba or @momo3404, could one of you check if this fix for v1 works in your local instance please?
I think it needs to be usr = User.where(email: token[:client_id], active: true).first, without the api_token: @client_secret, but I'm not sure.

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.

2 participants