muccg / rdrf

The Rare Disease Registry Framework (RDRF) is an open source tool for the creation of web-based patient registries.
GNU Affero General Public License v3.0
15 stars 8 forks source link

CIC CRC: Stack traces when exceeding integer limits #1560

Closed APMCCG closed 3 years ago

APMCCG commented 4 years ago

In CIC CRC v1.29 (RDRF v6.2.0), logged in as clinical staff. When entering integers that exceed the integer limits of Django into various integer fields in the system, a stack trace is caused instead of a validation error when attempting to save the input. Applicable CDEs: any integer CDE without max/min validation.

Example stack trace from PrivHosMedRecNo CDE (Patient Information form, Private Hospital Records section):

Environment:

Request Method: POST
Request URL: https://rdrf.ccgapps.com.au/cicclinical/ICHOMCRC/forms/14/72/129

Django Version: 2.2.13
Python Version: 3.8.5
Installed Applications:
['django.contrib.contenttypes',
 'django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django_extensions',
 'django.contrib.admin',
 'messages_ui',
 'ajax_select',
 'explorer',
 'useraudit',
 'templatetag_handlebars',
 'iprestrict',
 'rest_framework',
 'anymail',
 'rdrf',
 'registry.groups',
 'registry.patients',
 'registry.common',
 'registry.genetic',
 'registration',
 'reversion',
 'storages',
 'django_otp',
 'django_otp.plugins.otp_static',
 'django_otp.plugins.otp_totp',
 'two_factor',
 'django_user_agents',
 'formtools',
 'session_security']
Installed Middleware:
('useraudit.middleware.RequestToThreadLocalMiddleware',
 'django.middleware.common.CommonMiddleware',
 'iprestrict.middleware.IPRestrictMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django_otp.middleware.OTPMiddleware',
 'registry.common.middleware.EnforceTwoFactorAuthMiddleware',
 'session_security.middleware.SessionSecurityMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django_user_agents.middleware.UserAgentMiddleware')

Traceback:

File "/env/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute
  84.                 return self.cursor.execute(sql, params)

The above exception (integer out of range
) was the direct cause of the following exception:

File "/env/lib/python3.8/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/env/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/env/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/env/lib/python3.8/site-packages/django/views/generic/base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)

File "/env/lib/python3.8/site-packages/django/views/generic/base.py" in dispatch
  97.         return handler(request, *args, **kwargs)

File "/env/lib/python3.8/site-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "/env/lib/python3.8/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "/env/lib/python3.8/site-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "/env/lib/python3.8/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "/env/lib/python3.8/site-packages/rdrf/views/form_view.py" in post
  663.                     create_field_values(registry,

File "/env/lib/python3.8/site-packages/explorer/utils.py" in create_field_values
  644.                             FieldValue.put(registry_model,

File "/env/lib/python3.8/site-packages/explorer/models.py" in put
  136.         model.save()

File "/env/lib/python3.8/site-packages/django/db/models/base.py" in save
  740.         self.save_base(using=using, force_insert=force_insert,

File "/env/lib/python3.8/site-packages/django/db/models/base.py" in save_base
  777.             updated = self._save_table(

File "/env/lib/python3.8/site-packages/django/db/models/base.py" in _save_table
  850.             updated = self._do_update(base_qs, using, pk_val, values, update_fields,

File "/env/lib/python3.8/site-packages/django/db/models/base.py" in _do_update
  900.         return filtered._update(values) > 0

File "/env/lib/python3.8/site-packages/django/db/models/query.py" in _update
  760.         return query.get_compiler(self.db).execute_sql(CURSOR)

File "/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py" in execute_sql
  1469.         cursor = super().execute_sql(result_type)

File "/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py" in execute_sql
  1140.             cursor.execute(sql, params)

File "/env/lib/python3.8/site-packages/django/db/backends/utils.py" in execute
  99.             return super().execute(sql, params)

File "/env/lib/python3.8/site-packages/django/db/backends/utils.py" in execute
  67.         return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "/env/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
  76.         return executor(sql, params, many, context)

File "/env/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute
  84.                 return self.cursor.execute(sql, params)

File "/env/lib/python3.8/site-packages/django/db/utils.py" in __exit__
  89.                 raise dj_exc_value.with_traceback(traceback) from exc_value

File "/env/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute
  84.                 return self.cursor.execute(sql, params)

Exception Type: DataError at /ICHOMCRC/forms/14/72/129
Exception Value: integer out of range
id2359 commented 4 years ago

medical record "number" should be a string ..

id2359 commented 3 years ago

Closing stale issue