Skip to content

fix(auth): omit sensitive user fields and return public DTO in followers/following APIs - #805

Draft
gaurika-analyst wants to merge 1 commit into
AOSSIE-Org:mainfrom
gaurika-analyst:fix/sanitize-followers-following-response
Draft

gaurika-analyst wants to merge 1 commit into
AOSSIE-Org:mainfrom
gaurika-analyst:fix/sanitize-followers-following-response

Conversation

@gaurika-analyst

Copy link
Copy Markdown

Summary

Fixes #800

  • Added json:"-" tags to sensitive fields (Password, VerificationCode, VerificationCodeExpiry, VerificationCodeSentAt, ResetPasswordCode, ResetPasswordCodeExpiry) in models.User.
  • Introduced models.PublicUserDTO and (*User).ToPublicDTO() so GetFollowersHandler and GetFollowingHandler return sanitized public profiles (and an empty array [] instead of null when empty).
  • Added unit tests in backend/models/user_test.go verifying that sensitive fields and email are excluded from JSON output.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@gitcordapp

gitcordapp Bot commented Nov 16, 2026

Copy link
Copy Markdown

Link your account with Gitcord

Thanks for opening this PR, @gaurika-analyst!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link gaurika-analyst
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link gaurika-analyst)

Once linked, Gitcord can notify you about reviews, merges, and more.

— Posted by Gitcord

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Password hashes and verification/reset codes leak through followers/following APIs

1 participant