Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict access to delete? #30

Open
mkonda opened this issue May 27, 2020 · 0 comments
Open

Restrict access to delete? #30

mkonda opened this issue May 27, 2020 · 0 comments

Comments

@mkonda
Copy link

mkonda commented May 27, 2020

It appears that any user that has authenticated can call delete on any other user.

Should this be restricted such that a user can only delete themselves or certain people?

@require_oauth()
def delete(self, id: str = None):
if id is None:
return self.response_handler.method_not_allowed_response()
try:
user = User.query.filter_by(id=id).first()
if user:
user_obj = self.user_schema.dump(user).data
db.session.delete(user)
db.session.commit()
return self.response_handler.successful_delete_response('User', id, user_obj)
else:
return self.response_handler.not_found_response(id)
except Exception:
return self.response_handler.not_found_response(id)

As an attacker, I would write a script that would iterate through potential user ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant