fix: add server-side authorization to admin audit-log route#163
Merged
Sendi0011 merged 1 commit intoJun 29, 2026
Merged
Conversation
The GET /api/admin/audit-log endpoint now verifies the caller's wallet address matches the pool's creator_address before returning data. Previously, the creator-only restriction was only enforced in the React component, leaving the API route accessible to anyone with a valid poolId. Changes: - Accept callerAddress query param in the route - Compare it (case-insensitive) against pool.creator_address from DB - Return 403 Forbidden on mismatch - Update AdminAuditLog component to pass callerAddress - Add unit tests covering auth and consistency logic
Sendi0011
reviewed
Jun 29, 2026
Sendi0011
left a comment
Contributor
There was a problem hiding this comment.
Great implementation 👍
4 tasks
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.
Description
PR #154 added an admin audit log feature, but the creator-only restriction was only enforced on the client side. This meant anyone who knew or guessed a valid pool ID could call
GET /api/admin/audit-log?poolId=<id>directly and receive the full audit log.This fix adds server-side authorization to the API route by verifying the caller's wallet address against the pool's
creator_addressstored in the database before returning any data.Changes
Server-side auth check (
frontend/app/api/admin/audit-log/route.ts)callerAddressquery parametercreator_addressalongside existing fieldscallerAddress(case-insensitive) againstpool.creator_addresscallerAddressis missingreadLimiter) continues to work unchangedClient component update (
frontend/components/group/admin-audit-log.tsx)addressascallerAddressin the API requestaddressto theuseEffectdependency arrayTests (
frontend/app/api/admin/audit-log/route.test.ts)poolId→ 400callerAddress→ 400Acceptance Criteria
closes #160