Menu

Login endpoints with no attempt limit: what coding agents skip and how to catch it
📰

Login endpoints with no attempt limit: what coding agents skip and how to catch it

DEV Community: node·Bayarkhuu Tsoggerel·33 minutes ago
#bsFdpSKL
#devtonodejs#devto#dev#limit#agent
Reading 0:00
15s threshold

Unlimited password guessing in agent-written backends usually comes down to a login route that does exactly what the prompt asked. It looks up the email, compares the hash, returns a token, and passes every test you thought to write. Nothing in it stops someone from guessing passwords against one account as fast as the server answers.

The handler that looks finished

Here's a typical login handler (Express, trimmed). As far as it goes, it's correct:

app . post ( "/login" , async ( req , res ) => { const { email , password } = req . body ; const user = await db . users . findByEmail ( email ) ; if ( ! user || ! ( await bcrypt . compare ( password , user . passwordHash ) ) ) { return res . status ( 401 ) . json ( { error : "Invalid credentials" } ) ; } res . json ( { token : signToken ( user . id ) } ) ; } ) ;

Enter fullscreen mode

Exit fullscreen mode

The happy path works, the wrong-password path returns a 401, and a reviewer skimming the diff sees clean code.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.