The Endpoint That Forgot Private Meant Private

Medium

· Backend

Incident

SEV-2

BUG-PELOTON

Priority: High (privacy) · reported by security

Time to fix: 20 min

Failing checks on the shipped build

  • a stranger sees only public fields of a private profile

    a private profile must not leak age or weight: expected {"id":"u1","displayName":"Kai"} but got {"id":"u1","displayName":"Kai","isPrivate":true,"age":31,"weight":70}

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Inspired by

Peloton · 2021

Modelled on the Peloton API exposure (2021): an endpoint returned full profile data — age, weight, workout history — for any user id, ignoring the account's "private profile" setting entirely. It was reachable without authentication.

profiles.js returns everything it has.

Fix getProfile so private accounts expose only their public fields to strangers.

Code map

// Returns a user's profile as visible to the viewer.
exports.getProfile = function (store, userId, viewerId) {
  var user = store[userId];
  if (!user) return null;
  return user;
};

Sign in to edit the file, run the tests and submit a fix

A free account — no card, no trial clock. You come straight back here.

The Endpoint That Forgot Private Meant Private — Bug Hunt

Modelled on the Peloton API exposure (2021): an endpoint returned full profile data — age, weight, workout history — for any user id, ignoring the account's…

  • Language: JavaScript
  • Layer: Backend
  • Difficulty: Medium
  • Concepts: Security, Privacy
  • Modelled on: Peloton · 2021
  • Visible tests: the owner sees everything; a stranger sees only public fields of a private profile; a public profile is fully visible
  • Reward: 50 XP for a complete fix

Incident

  • Severity: SEV-2 (priority: High (privacy))
  • Ticket: BUG-PELOTON
  • Reported by: security
  • Time to fix: 20 minutes, the target for a medium incident

Failing checks on the shipped build

  • a stranger sees only public fields of a private profile — a private profile must not leak age or weight: expected {"id":"u1","displayName":"Kai"} but got {"id":"u1","displayName":"Kai","isPrivate":true,"age":31,"weight":70}

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Briefing

Modelled on the Peloton API exposure (2021): an endpoint returned full profile data — age, weight, workout history — for any user id, ignoring the account's "private profile" setting entirely. It was reachable without authentication.

profiles.js returns everything it has.

Fix getProfile so private accounts expose only their public fields to strangers.

Bug report

BUG-PELOTON · Priority: High (privacy) · Reported by: security

getProfile(store, userId, viewerId) must return the profile fields the viewer is entitled to:

  • the owner (viewerId equals userId) always sees every field
  • a stranger viewing a PUBLIC profile sees every field
  • a stranger viewing a PRIVATE profile sees only { id, displayName }
  • a missing user returns null

Observed: private profiles return their full record to any caller.

Logs

[api] GET /profile/8812 viewer=anonymous private=true -> full record
[api] age, weight and workout history returned for private accounts

The code as shipped

src/social/profiles.js (editable)

// Returns a user's profile as visible to the viewer.
exports.getProfile = function (store, userId, viewerId) {
  var user = store[userId];
  if (!user) return null;
  return user;
};

Read-only context: src/social/MODEL.js.

Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More JavaScript bug hunts.