feat: gate read endpoints + e2e#354
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (38.88%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## feat/auth-service #354 +/- ##
=====================================================
+ Coverage 33.52% 33.70% +0.17%
=====================================================
Files 163 163
Lines 12512 12532 +20
=====================================================
+ Hits 4195 4224 +29
+ Misses 7981 7968 -13
- Partials 336 340 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request implements read-endpoint authentication using SIWE (Sign-In with Ethereum) and JWT bearer tokens, updating the /profile and transfer read endpoints to resolve the caller's address from the authenticated context (falling back to the ?address= query parameter if authentication is disabled). Feedback focuses on ensuring that EVM addresses retrieved from the authenticated context are normalized to lowercase at the HTTP handler level in both pkg/transfer/http.go and pkg/user/service/http.go to prevent potential database query mismatches.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
9100c55 to
c8d567f
Compare
3ce440c to
2e9bbbb
Compare
|
Addressed Gemini's review in
|
Wire the auth service into the api-server and gate the read path: - server.go: buildReadAuth (optional; passthrough when no auth config), mount /auth/login + JWKS, pass the read-auth middleware to the route registrars - transfer read endpoints + /profile: resolve the caller from the bearer token when auth is enabled, else fall back to ?address= - user service: /profile gating; GetUser no longer takes msg/sig - docker-compose + Makefile: provide JWT_PRIVATE_KEY (base64 RSA PEM) - e2e: APIServerShim performs a real SIWE login and attaches the JWT to reads
Address review: the transfer read handler and /profile now normalize the EVM address taken from the token context (not just the ?address= fallback), so the service layer always receives a canonical address for lookups.
Adds the auth block (private_key: ${JWT_PRIVATE_KEY}) to docker/local-devnet/
mainnet. Pairs with the server wiring, compose/Makefile key provisioning, and the
e2e SIWE login in this PR.
c8d567f to
77ee61c
Compare
2e9bbbb to
a6dc3e7
Compare
3 of 3 — read-API authentication (closes #341). Base:
feat/auth-service.Wires the auth service into the api-server and gates the read path.
server.go—buildReadAuth(optional: passthrough when noauthconfig); mount/auth/login,/auth/nonce,/.well-known/jwks.json; pass the read-auth middleware to the route registrars/profile— resolve the caller from the bearer token when auth is on, else fall back to?address=/profilegating;GetUserno longer takes msg/sigdocker-compose+Makefile— provideJWT_PRIVATE_KEY(base64 RSA PEM)APIServerShimperforms a real SIWE login and attaches the JWT to the transfer read callsWhy no refresh token: short-lived access tokens with no refresh token are the simplest secure-revocation story — nothing long-lived to steal or to build rotation/reuse-detection around, and a leaked JWT is useless after
token_ttl. On expiry the client re-runs SIWE login (silent for custodial, one wallet prompt for non-custodial).token_ttlis the knob to widen first if needed; a refresh token can be added later without changing this design.