[backport 24.05] views: enforce token app scope on /o/actions#7682
Merged
Conversation
Backport of #7677 to release.24.05. The countly-token branch of /o/actions resolves the target app from the caller-supplied app_key, sets params.qstring.app_id from it, then calls authorize.verify_return() without passing qstring. authorizer.verify_token() only enforces a token's app restriction when options.qstring.app_id is present, so the restriction was skipped and an app-scoped token was accepted for any other app — returning that app's heatmap rows. Pass qstring into verify_return so the token's app list is checked against the app resolved from app_key. Adds regression tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Backports a security/authorization fix to the plugins/views /o/actions (heatmap) endpoint so that app-scoped countly-token tokens are validated against the resolved target app, preventing cross-app access with an app-restricted token.
Changes:
- Pass
params.qstringintoauthorize.verify_return()in the/o/actionstoken-auth branch soverify_token()can enforceres.apprestrictions viaqstring.app_id. - Add a regression test asserting an app-scoped token is accepted for its own
app_idand rejected for a differentapp_id.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
plugins/views/api/api.js |
Ensures token verification receives qstring so app-scoped token restrictions are actually enforced for /o/actions. |
test/2.api/14.authorize.token.js |
Adds regression coverage for app-scoped token enforcement behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ArtursKadikis
approved these changes
Jun 8, 2026
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.
Backport of #7677 to
release.24.05.The
/o/actionscountly-token branch resolved the app from the caller-suppliedapp_keyand calledauthorize.verify_returnwithout passingqstring;verify_tokenonly enforces a token's app restriction whenqstring.app_idis present, so an app-scoped token was accepted for any app. Fixed by passingqstring. Includes the authorizer-contract regression test (added to the existingtest/2.api/14.authorize.token.js).🤖 Generated with Claude Code