Difficulty: Intermediate
Type: bug
Background
POST /v1/access/check takes { wallet, communityId, resource } and returns an allow/deny decision — this is the core access-decision endpoint feeding the policy engine.
Problem
Without strict schema validation, malformed input (invalid wallet format, missing communityId, unexpected resource shapes) can reach the policy engine and produce ambiguous or misleading decisions instead of a clear 400 error.
Expected outcome
The route validates wallet (checksummed/lowercased EVM address format), communityId (valid UUID/ID format matching the schema), and resource against a strict schema before reaching the policy engine, returning descriptive 400 errors on failure.
Suggested implementation
- Add a Zod (or Fastify JSON-schema) validator for the request body in the access-check route.
- Normalize wallet addresses (lowercase or checksum) before querying, consistent with how they're stored via Prisma.
- Add explicit error messages per invalid field (not a generic "bad request").
- Add unit tests covering missing fields, malformed wallet, and unknown
communityId.
Acceptance criteria
Likely affected files/directories
apps/access-api/src/routes/ (access/check route)
packages/shared-types/
docs/openapi.json
Difficulty: Intermediate
Type: bug
Background
POST /v1/access/checktakes{ wallet, communityId, resource }and returns an allow/deny decision — this is the core access-decision endpoint feeding the policy engine.Problem
Without strict schema validation, malformed input (invalid wallet format, missing
communityId, unexpectedresourceshapes) can reach the policy engine and produce ambiguous or misleading decisions instead of a clear400error.Expected outcome
The route validates
wallet(checksummed/lowercased EVM address format),communityId(valid UUID/ID format matching the schema), andresourceagainst a strict schema before reaching the policy engine, returning descriptive400errors on failure.Suggested implementation
communityId.Acceptance criteria
400with a clear messagecommunityIdorresourcereturns400Likely affected files/directories
apps/access-api/src/routes/(access/check route)packages/shared-types/docs/openapi.json