Skip to content

[backport 24.05] views: enforce token app scope on /o/actions#7682

Merged
ar2rsawseen merged 1 commit into
release.24.05from
backport/24.05/actions-token-app-scope
Jun 8, 2026
Merged

[backport 24.05] views: enforce token app scope on /o/actions#7682
ar2rsawseen merged 1 commit into
release.24.05from
backport/24.05/actions-token-app-scope

Conversation

@ar2rsawseen

Copy link
Copy Markdown
Member

Backport of #7677 to release.24.05.

The /o/actions countly-token branch resolved the app from the caller-supplied app_key and called authorize.verify_return without passing qstring; verify_token only enforces a token's app restriction when qstring.app_id is present, so an app-scoped token was accepted for any app. Fixed by passing qstring. Includes the authorizer-contract regression test (added to the existing test/2.api/14.authorize.token.js).

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings June 8, 2026 16:20

Copilot AI left a comment

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.

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.qstring into authorize.verify_return() in the /o/actions token-auth branch so verify_token() can enforce res.app restrictions via qstring.app_id.
  • Add a regression test asserting an app-scoped token is accepted for its own app_id and rejected for a different app_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.

@ar2rsawseen ar2rsawseen merged commit d6e461f into release.24.05 Jun 8, 2026
6 of 8 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.

3 participants