yellowco / yellowcoin

Yellowcoin
0 stars 0 forks source link

security issue: limit bank verify to n tries #52

Closed kevmo314 closed 10 years ago

kevmo314 commented 10 years ago

add tries_remaining or something, notify us when it hits zero.

minkezhang commented 10 years ago

implemented in api/user/view, line 185

kevmo314 commented 10 years ago

added test, changed status code to 403 instead of 400.

kevmo314 commented 10 years ago

Fails test:

(yellowcoin)root@kevmo314:/var/www/yellowcoin/yellowcoin/yellowcoin# ../manage.py test --failfast
Creating test database for alias 'default'...
...E
======================================================================
ERROR: test_verify_bank_account (yellowcoin.api.users.tests.test_accounts.TestAccounts)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/www/yellowcoin/yellowcoin/yellowcoin/api/users/tests/test_accounts.py", line 56, in test_verify_bank_acco
unt
    id = self.create_bank_account().data['id']
  File "/var/www/yellowcoin/yellowcoin/yellowcoin/api/users/tests/test_accounts.py", line 18, in create_bank_account
    'type':'CHECKING'
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/rest_framework/test.py", line 76, in post
    return self.generic('POST', path, data, content_type, **extra)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/rest_framework/compat.py", line 487, in generic
    return self.request(**r)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/rest_framework/test.py", line 143, in request
    return super(APIClient, self).request(**kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/rest_framework/test.py", line 95, in request
    request = super(APIRequestFactory, self).request(**kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/test/client.py", line 444, in request
    six.reraise(*exc_info)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_vi
ew
    return view_func(*args, **kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/rest_framework/views.py", line 399, in dispatch
    response = self.handle_exception(exc)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/rest_framework/views.py", line 396, in dispatch
    response = handler(request, *args, **kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/db/transaction.py", line 339, in inner
    return func(*args, **kwargs)
  File "/var/www/yellowcoin/yellowcoin/yellowcoin/api/users/views.py", line 420, in post
    validation_object = Validation.objects.get_by_account_id(forte_account_id)
  File "/var/www/yellowcoin/yellowcoin/yellowcoin/users/models.py", line 601, in get_by_account_id
    return self.get(forte_account_hash=self.hash_forte_account_id(forte_account_id))
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
    return self.get_queryset().get(*args, **kwargs)
  File "/var/www/yellowcoin/local/lib/python2.7/site-packages/django/db/models/query.py", line 307, in get
    self.model._meta.object_name)
TypeError: 'BankValidationError' object is not callable

----------------------------------------------------------------------
Ran 4 tests in 30.916s

FAILED (errors=1)
Destroying test database for alias 'default'...
kevmo314 commented 10 years ago

fixed