6 kyu

Implement brute force protection

Description
Loading description...
Logic
Security
Fundamentals
Singleton
  • Please sign in or sign up to leave a comment.
  • farhanaditya Avatar

    JS: Node v14 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this

  • Firefly2002 Avatar

    Inexplicably very satisfying Kata. Thanks :)

  • JohanWiltink Avatar

    I see solutions that don't reset the count when called with a successful login. Is this tested for? Should this be tested for?

  • wthit56 Avatar

    Good, simple kata. A couple of notes:

    • Typo: break-in should be break in.
    • Maybe sourceIP and successful could be simple arguments to the function. I don't think there's much reason for them to be nested in an object, and it just makes the code more verbose.
    • int3_0xcc Avatar

      Thanks for the input.

      I fixed the typo.

      I think it's important for people to solve Katas using objects, even such simple ones like this one. I think this website suffers a lot from not encouraging object use and I personally think that less parameters in a function is always better. Also, I will probably make a harder version also utilizing the request class which will have a little bit more data and some methods. For now I will leave the parameters as they are.

    • JohanWiltink Avatar

      It doesn't necessarily make the code that much more verbose.

      Take a look at my solution and at Destructuring assignment.

      Then again, the difference between passing an object and just passing multiple arguments is two curly braces and your having to conform to the naming inside the object (but you can ignore arguments you don't want, and you can reshuffle them freely!). Might as well pass multiple arguments really, freedom to name variables feels like in some instances just too much to give up.

    • int3_0xcc Avatar

      Marked as solved.

      Suggestion marked resolved by int3_0xcc 8 years ago