Add a contract test: public endpoints never return private fields
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Half a day
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- express, node.js, typescript
Research direction
Read apps/api/src/tests/security.test.ts first to copy the existing mocking style, then apps/api/src/tests/helpers.ts for user/post creation, and apps/api/src/utils/serializers.ts to learn which keys each response can emit. Add the expectNoKeys recursive walker plus a new test covering profile, search, feed, post and comments, written so it fails if any listed key appears in the raw JSON body. Done means the suite runs without a real database and npm test, npm run typecheck and npm run lint all pass.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 6
- Avg merge
- 1h 59m
- Merged PRs (30d)
- 59
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Haseeb-MernStack/commune
-
enhancement good first issue web
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Haseeb-MernStack/commune#141 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Haseeb-MernStack/commune#138 ·
Maintainers usually reply within 1 day
-
ci good first issue tests
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Haseeb-MernStack/commune#133 ·
Maintainers usually reply within 1 day
-
accessibility good first issue web
Difficulty 2/5 Half a day Newbie friendliness 74/100
Haseeb-MernStack/commune#117 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Haseeb-MernStack/commune#115 ·
Maintainers usually reply within 1 day
All issues in Haseeb-MernStack/commune
Similar issues
-
[UI] Guard webApis against undefined window in SSR environmentsPossibly taken @madhavzanwar claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
headroomlabs-ai/headroom#4992 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
paperclipai/paperclip#22575 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
lingdojo/kana-dojo#34502 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
bug frontend good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
nikhilb2/simple_invoicing#935 ·