feat: Split User fragment into public and private versions with server-side auth#4276
feat: Split User fragment into public and private versions with server-side auth#4276
Conversation
|
|
- Created public User fragment with only non-sensitive data - Created UserPrivate fragment for authenticated user data - Updated AppContext to use GetCurrentUser query with UserPrivate - Protected sensitive fields: email, bridgeCustomerId, privateBetaInviteCode, notificationsData, meta, preferredCurrency - Kept isAutoOfframpEnabled in public fragment (needed for transaction processing) - Updated generated.ts types and hooks Co-authored-by: arrenv <33682027+arrenv@users.noreply.github.com>
- Added clearer documentation for UserDisplay fragment indicating it's public - Added comments in AppContextProvider clarifying private user data usage Co-authored-by: arrenv <33682027+arrenv@users.noreply.github.com>
|
@copilot This seems to create the query but does not seem to account for how it is used. It also does not seem to add auth to allowing the use to see their own details. Can you review it please. |
- Created getCurrentUserProfile Lambda function that validates auth - Lambda reads x-wallet-address header set by auth proxy - Only returns user data if requester is authenticated - Updated schema with new getCurrentUserProfile query - Updated AppContext to use the new auth-protected query - Updated generated types for the new query structure Co-authored-by: arrenv <33682027+arrenv@users.noreply.github.com>
Added server-side auth enforcement in commit 22246c5. Created a new
The Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Please check over all update and ensure nothing is broken or no longer functions currently due to these updates. These should be surgical and achieve the desired objective. |
Verified all changes. Linting and type checking pass successfully. Key verification points:
The changes are surgical: existing functionality is preserved while sensitive data is now protected at both the fragment level (client-side) and via Lambda auth enforcement (server-side). Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Description
The
UserGraphQL fragment was exposing sensitive personal data publicly to all queries. This PR separates user data into public and private fragments, with server-side auth enforcement ensuring sensitive fields are only accessible for the authenticated user's own data.Protected fields (now private only):
email,bridgeCustomerId,privateBetaInviteCode,notificationsDatameta(metatransactionsEnabled, decentralizedModeEnabled, customRpc)preferredCurrencyArchitecture:
Server-side Auth Enforcement:
AppContextnow usesGetCurrentUserquery which calls thegetCurrentUserProfileLambda function. The Lambda validates authentication via thex-wallet-addressheader (set by auth proxy) before returning private user data.Testing
getCurrentUserProfilereturn nullDiffs
New stuff ✨
UserPrivatefragment - contains sensitive user dataGetCurrentUserquery - fetches authenticated user's private data via LambdaUserPrivatetype export intypes/graphql.tsgetCurrentUserProfileLambda function - validates auth before returning private datagetCurrentUserProfilequery in GraphQL schema with@functiondirectiveChanges 🏗
Userfragment - now public-only (removed sensitive fields)AppContext- usesUserPrivatetype andGetCurrentUserquerycontributors.graphql- updated to use publicUserfragmentgenerated.ts- updated types and hooks for new query structurebackend-config.json- registered new Lambda functionDeletions ⚰️
UserfragmentTODO
Resolves user data exposure security issue
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.