Skip to content

fix: add auth checks to transaction server actions#1860

Open
Gr1dlock wants to merge 2 commits intomainfrom
Gr1dlock/fix-auth-server-actions
Open

fix: add auth checks to transaction server actions#1860
Gr1dlock wants to merge 2 commits intomainfrom
Gr1dlock/fix-auth-server-actions

Conversation

@Gr1dlock
Copy link
Copy Markdown
Contributor

@Gr1dlock Gr1dlock commented Apr 9, 2026

PR Type

  • Regular Task
  • Bug Fix
  • QA Tests

Description

Adds authentication and team membership authorization checks to getAccumulativePaymentsData and getAccumulativeTransactionsData server actions. These functions were directly invocable via HTTP POST (Next-Action header) with an arbitrary appId, bypassing the layout-level team membership guard and exposing transaction records (wallet addresses, amounts, tx hashes) for any mini-app. The fix follows the same auth pattern used by the sibling getTransactionData function in the same directory.

Checklist

  • I have self-reviewed this PR.
  • I have left comments in the code for clarity.
  • I have added necessary unit tests.
  • I have updated the documentation as needed.

getAccumulativePaymentsData and getAccumulativeTransactionsData were
missing authentication and authorization checks, allowing any caller
to query internal payment data for arbitrary app IDs via direct server
action invocation. Added getSession() + team membership verification
matching the pattern used by the sibling getTransactionData function.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 533ce774da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +102 to +104
const isTeamMember = user?.hasura?.memberships?.some(
(membership) => membership.team?.id === teamId,
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Verify app ownership before authorizing access

This authorization only validates membership for the route-derived teamId, but the data fetch is keyed only by appId. That means a user who is a member of Team A can invoke this server action from a Team A route while supplying an appId that belongs to Team B, and isTeamMember still passes before returning Team B’s payment/transaction data. Please enforce that the requested appId belongs to the authorized team (or query by both team and app) before calling the internal endpoint; the same issue is duplicated in getAccumulativeTransactionsData.

Useful? React with 👍 / 👎.

…heck

The previous auth check only verified team membership from the URL path,
allowing a user on Team A to supply an appId belonging to Team B. Replaced
with getIsUserAllowedToReadApp which queries the database to confirm the
authenticated user is a member of the app's owning team.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Gr1dlock Gr1dlock deployed to development April 14, 2026 10:03 — with GitHub Actions Active
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