Add a contract test: public endpoints never return private fields
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 72/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- express, node.js, typescript
Direzione di ricerca
Leggi prima apps/api/src/tests/security.test.ts per copiare lo stile di mocking esistente, poi apps/api/src/tests/helpers.ts per la creazione di utenti e post, e apps/api/src/utils/serializers.ts per capire quali chiavi può emettere ogni risposta. Aggiungi il walker ricorsivo expectNoKeys e un nuovo test che copra profilo, ricerca, feed, post e commenti, scritto in modo che fallisca se una qualsiasi delle chiavi elencate compare nel corpo JSON grezzo. È completato quando la suite viene eseguita senza un database reale e npm test, npm run typecheck e npm run lint passano tutti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Difficulty: Beginner to Intermediate · Estimated size: half a day
Context
Several responses are built by serializer functions. A future change could accidentally add a private field such as an email address, a password hash or a token.
Problem or goal
Add tests that scan real API responses for fields that must never appear.
Suggested approach
- In
apps/api/src/tests, create users and a post using the existing helpers, call the profile, search, feed and post endpoints, and assert that the JSON text never contains the keyspasswordHash,password,email(for other users),refreshToken,tokenHash, orgoogleId. - Write a small helper
expectNoKeys(body, keys)that walks the JSON recursively.
Where to look
apps/api/src/tests/helpers.tsapps/api/src/tests/security.test.tsapps/api/src/utils/serializers.ts
Acceptance criteria
- The test fails if one of those keys is added to any checked response.
- It covers at least profile, search, feed, post and comments.
- It is fast and does not need a real database (follow the existing mocking style).
How to work on it
- Comment here to claim it, so two people do not do the same work.
- Fork the repo and branch from
main(feat/short-nameorfix/short-name). Setup steps are in docs/DEVELOPMENT.md. - Keep the change focused and add tests for backend logic.
- Run
npm run typecheck,npm testandnpm run lintandnpm run formatbefore opening the pull request. - Use a Conventional Commits title (for example
feat(web): add bookmarks). More in CONTRIBUTING.md.
Stuck? Ask in this issue. Questions are welcome.
Generated by Claude Code
- Lingua principale
- TypeScript
- Stelle
- 6
- Fork
- 6
- Merge medio
- 1h 59m
- PR unite (30g)
- 59
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Haseeb-MernStack/commune
-
enhancement good first issue web
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Haseeb-MernStack/commune#141 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Haseeb-MernStack/commune#138 ·
I maintainer di solito rispondono entro 1 giorno
-
ci good first issue tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Haseeb-MernStack/commune#133 ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility good first issue web
Difficoltà 2/5 Mezza giornata Idoneità per principianti 74/100
Haseeb-MernStack/commune#117 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Haseeb-MernStack/commune#115 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Haseeb-MernStack/commune
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
agent-canvas bug oh-gpt-fleet priority:medium ready-for-dev UI/UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue javascript test
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
writerslogic/scrivener-mcp#272 ·
I maintainer di solito rispondono entro 1 giorno
-
bug triaged tui ux wontfix
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno