The problem
A page and the data behind it are two different things. The page decides what to show. The data is everything the server sent, and anyone can read all of it in the browser’s developer tools.
For each comment, the page showed a username and a picture. The data behind it looked like this:
"author": {
"id": 42,
"username": "sam_travels",
"email": "sam@example.com",
"first_name": "Sam",
"last_name": "Rivera",
"profile_picture": "https://…/sam.webp"
}
So every reader of a post could collect the email address and real name of everyone who had commented on it. People were trusting the site with that information, and it was being handed out.
Why it happened
The API had one description of a user, built for your own profile page, where seeing your own email is right. Comments reused it to describe their author, because it was already there. Nothing on the page looked wrong, because the page never displayed the extra fields.
The lines that decide
Before: comments described their author with the full account record.
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username',
'email',
'first_name', 'last_name',
'profile_picture')
class CommentSerializer(serializers.ModelSerializer):
author = UserSerializer(read_only=True)
After: a separate public version, holding only what a page shows about someone else.
class PublicUserSerializer(serializers.ModelSerializer):
"""Public-safe serializer for User model."""
...
class Meta:
model = User
fields = ('id', 'username', 'display_name', 'avatar_url')
class CommentSerializer(serializers.ModelSerializer):
author = PublicUserSerializer(read_only=True)
The display name falls back to the username, never to a first or last name. The comment thread in the browser was changed to match, since it had used the first name as a fallback too.
Four days later the same swap went into likes, saved posts, comment votes and the author of every post, trip and photo. Blog posts also stopped sending their author’s first and last names.
Then I checked everything else
One leak means there could be others. In late October 2026 I audited what every part of the API sends back, and to whom. Findings about who could reach what are in the permissions story. These were about what the responses gave away:
- Admin pages showed sign-in secrets. Staff with limited admin access could read another user’s sign-in token or two-factor secret. Those values are now never displayed, to anyone.
- Reply forms listed hidden comments. The API’s built-in forms offered comments on drafts as choices, author included. And asking for a hidden comment gave a different error than asking for one that didn’t exist, which confirmed it was there. Now both get the same answer.
- Private pages could be cached. Your own trips and profile were sent without telling browsers and proxies not to keep a copy. Now anything sent to a signed-in person is marked private and not stored.
- Errors repeated internal details. A failed trip copy sent the raw error text back to the browser. Now the details go to the server log, and the person sees a plain message.
- Deleted comments were still searchable. They showed as “[deleted]”, but searching for their old words still found them. Now search skips them.
- Sign-up revealed who had an account. Registering with an email already in use said so. That needed a bigger change: new accounts now confirm their email before signing in. It shipped the same day.
Decisions and tradeoffs
- Fix it on the server, not the page
- Hiding the fields in the browser would have changed nothing, because the browser had already received them. The only fix is not sending them.
- A separate public record
- Trimming the shared user record would have broken the profile page, which needs the email. Two records, one private and one public, make the choice visible every time someone writes a new response.
- Same answer for hidden and missing
- Telling someone a thing is private confirms it exists. Answering “doesn’t exist” for both gives nothing away.
How it was tested
Each audit fix came with tests written to fail on the old code. They sign in as every kind of person, from anonymous to administrator, and check what comes back, not just whether the request worked.
| Suite | Covers | Result |
|---|---|---|
| Admin pages | Tokens, two-factor secrets and password hashes never shown | 17 new tests. Both exposure checks failed before the fix |
| API responses | Hidden comments, caching, error text, deleted comments | 18 new tests. 14 failed before, all pass after |
| Public user data, January | Posts, trips, comments and notifications | No private user fields in any of them |
The January fix got its own tests two days later. They check that posts, trips, comments and notifications carry no private user fields, and they still run with every change.
Outcome and limits
All of these are in production. I found no sign that anyone collected the data, and I can’t prove no one did. The site hasn’t had an outside security review.
What I took from it: the page is not the boundary, the response is. Whatever the server sends, assume someone is reading all of it.