Code Monkey home page Code Monkey logo

loomies-backend's Introduction

Hi there 👋, I´m Pedro 🧑🏽‍💻

  • 🌱 I’m currently learning about Front-end and Back-end development.
  • 🔭 I’m interested in learning Data Science, Machine Learning and Competitive Programming topics.

loomies-backend's People

Contributors

andres123dbh avatar pedrochaparro avatar silviapabon avatar woynert avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

loomies-backend's Issues

Endpoint para el inicio de sesión

  1. Validate that the user account was verified.
  2. Returns the user non-sensible information.
  3. Returns a JWT (Access token) in the JSON response. The TTL shouldn't be short, 1 month should be OK.

Exploit: Steal user account by changing password

The reset password functionality implemented in #70 . Has a serious security vulnerability that allows users to steal other user's accounts.

How to reproduce

Consider we have two users:

{
	name: Foo,
	email: [email protected],
	...
}
{
	name: Bar,
	email: [email protected],
	...
}
  1. Login normally as Foo.
  2. Request a password change (as per #70 ):
POST /user/password/code
{
	"email": "[email protected]"
}
  1. Get the code in your email.
  2. Send the confirmation password change request (as per #70 ) but this time specify Bar's mail address instead:
PUT /user/password
{
	"resetPassCode":"123456",
	"email":"[email protected]",
	"password":"NewPassword1!"
}
  1. Now you should be able to login to Bar's account, effectively stealing it:
POST /session/login
{
	"email":"[email protected]",
	"password":"NewPassword1!"
}

Response:

{

	"error": false,
	"message": "Successfully logged in",
	"accessToken": ...,
	"refreshToken": ...,
	"user": ...
}

This recently opened PR PedroChaparro/loomies-mobile#53 makes it easier to see it.

image

Combat fixes tracking

I've create this issue in order to track the different fixes / improvements required for the combat system.

  • The timeout for inactivity is too short. Maybe increase it somewhere around 5 minutes.
  • Token can be obtained from far gyms: When fetching /combat/register you can specify any gym even if it is out of reach; a token will be received and this token will fail when trying to enter the actual combat.
  • There is no dedicated Message type when the combat ends, timeout.
  • The Message types for using items in combat are not documented in the Markdown file loomies-backend/api/combat/MESSAGES_TYPES.md. (Added in #98 )
  • An user can combat multiple gyms simultaneously. Fixed in #114
  • The amount of Loomies the enemy gym has left should be sent along regular updates, events such as when a Loomie is weakened. Fixed in #120
  • The user can register a combat with a gym (combat/register) even when having no Loomies on his team. (A token will be returned but it will fail when trying to enter the actual combat). Fixed in #120
  • When an attack is executed successfully also return if it was very effective or just normal. Fixed in #120.
  • When successfully using an item return the item serial as well. Fixed in #120.
  • Add a new message type for when an item cannot be applied. Specifying item serial and reason as enum. Fixed in #120. Ex.
{
  "type": "ERROR_USING_ITEM",
  "payload": {
    "item_serial": string,
    "error_reason": USER_ALREADY_HEALED, 
  }
}
  • Players can attack gyms owned by themselves.
  • When a Loomie is weakened also send the damage dealt (full damage). Fixed in #127.
  • Wait a few seconds between GYM/USER_LOOMIE_WEAKENED and UPDATE_GYM/USER_LOOMIE. And in the meantime don't receive user/gym attacks. Fixed in #127.
  • Send a boolean indicating if the user owns the gym on endpoint GET gyms/{id}

Refactor user collection

Problem

The users collection has some fields that, although they depend on the user, do not belong directly to the collection:

image

Proposed solution

Create a new collection to store the verification codes and password reset codes.

"Expired" Wild Loomies are being sended to the client

Problem

The /loomies/near endpoint doesn't distinguish "outdated" Loomies.

Proposed solution

  1. Check the expiration time in the /loomies/near model.
  2. Create an script to remove "outdated" loomies automatically.

Note: This issue was initially identified by @Woynert.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.