top | item 43965416

(no title)

blantonl | 9 months ago

Returning the OTP in the request API response is wild. Like why?

discuss

order

MBCook|9 months ago

So the UI can check if what they enter is correct.

It’s very sensible and an obvious solution if you don’t think about the security of it.

A dating app is one of the most dangerous kinds of app to make due to all the necessary PII. this is horrible.

ryanisnan|9 months ago

> if you don’t think about the security of it.

This is big brain energy. Why bother needing to make yet another round trip request when you can just defer that nonsense to the client!

benmmurphy|9 months ago

I’ve seen banks where the OTP code is generated on the client and then sent to the server.

pydry|9 months ago

Smacks of vibe coding

hectormalot|9 months ago

One reason I could think of is that they may return the database (or cache, or something else) response after generating and storing the OTP. Quick POCs/MVPs often use their storage models for API responses to save time, and then it is an easy oversight...

oulu2006|9 months ago

that's my first thought at as well - like a basic CRUD operation that returns the row that was created as a response.

matja|9 months ago

Eliminate your database costs with this one easy trick!

ceejayoz|9 months ago

Save a HTTP request, and faster UX! What's not to love?

When Pinterest's new API was released, they were spewing out everything about a user to any app using their OAuth integration, including their 2FA secrets. We reported and got a bounty, but this sort of shit winds up in big companies' APIs, who really should know better.

gwbas1c|9 months ago

It appears that the OTP is sent from "the response from triggering the one-time password".

I suspect it's a framework thing; they're probably directly serializing an object that's put in the database (ORM or other storage system) to what's returned via HTTP.

mooreds|9 months ago

I too am bewildered.

Maybe to make it easier to build the form accepting the OTP? Oversight?

I can't think of any other reasons.

Vuska|9 months ago

Oversight. Frameworks tend to make it easy to make an API endpoint by casting your model to JSON or something, but it's easy to forget you need to make specific fields hidden.

Alex-Programs|9 months ago

I assume that whoever wrote it just has absolutely no mental model of security, has never been on the attacking side or realised that clients can't be trusted, and only implemented the OTP authentication because they were "going through the motions" that they'd seen other people implement.

ksala_|9 months ago

My best guess would be some form of testing before they added sending the "sending a message" part to the API. Build the OTP logic, the scaffolding... and add a way to make sure it returns what you expect. But yes absolutely wild.