Repository navigation
fix(api): return only the team fields the app reads from GET /me - #3860
Conversation
GET /me loaded the whole Team document and sent it to every member, read-only users included, so any secret later added to Team would leak. It now loads only MeTeamSchema: id, name and the ClickHouse settings. apiKey and allowedAuthMethods are dropped from /me; the app reads them from /team. Refs HDX-6228
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Additional context: grazes a critical path (3 lines in Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review✅ No issues found. |
Deep Review✅ No critical issues found. This PR does what it claims: 🟡 P2 — recommended
🔵 P3 nitpicks (1)
Reviewers (10): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, security, api-contract, kieran-typescript, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 482 passed • 1 skipped • 1067s
Tests ran across 4 shards in parallel. |
Summary
GET /meloaded the whole Team document and returned it asteamto every signed-in member, read-only users included. Today that holds nothing beyond what/teamalready shows members, but any sensitive field added to Team later would have reached all of them./menow loads only the fields inMeTeamSchema:id,nameand the team's ClickHouse settings.team.apiKeyandteam.allowedAuthMethodsare no longer in the/meresponse. The app reads both from/teamand the CLI never used them, so nothing in this repo changes behaviour. A script that read them from/meshould read/teaminstead.getTeamignores the field list there. That object holds placeholder UUIDs only.Implementation detail
MeTeamSchema, so a field added to the schema is loaded and one left out is never fetched.MeResponsetype drops theapiKeyit no longer receives./mereturns any Team key outsideMeTeamSchema. Themesuite passes, and api, app and CLI typecheck.How to reproduce
Starting point:
yarn dev, signed in.On
main:merequest.teamobject includesapiKey,hookId,collectorAuthenticationEnforcedand every other Team field.On this branch:
teamhas onlyid,nameand any ClickHouse settings set on the team.How to test on Vercel preview
N/A, non-UI change.
References
Note
Medium Risk
Narrows a high-traffic auth endpoint's payload and changes an API contract (removed
team.apiKeyfrom/me); in-repo clients are updated, but external scripts reading secrets from/mewould break.Overview
GET
/meno longer returns sensitive or unused team fields such asapiKey,hookId, andallowedAuthMethods. The responseteamobject is now limited toid,name, and team ClickHouse settings via a sharedMeTeamSchema, and the handler projects the same field list when loading from Mongo so extra Team fields are not fetched or leaked to every signed-in member (including read-only users).The app already loads
apiKeyand auth settings from/team; the CLIMeResponsetype is updated to match. An integration test asserts that no keys outsideMeTeamSchemaappear onteam.Reviewed by Cursor Bugbot for commit 621d2ac. Bugbot is set up for automated code reviews on this repo. Configure here.