Skip to content

Update requirements.txt - #2849

Closed
awiswasi wants to merge 3 commits into
inventree:masterfrom
awiswasi:django-update
Closed

awiswasi wants to merge 3 commits into
inventree:masterfrom
awiswasi:django-update

Conversation

@awiswasi

@awiswasi awiswasi commented Apr 20, 2022 •

Copy link
Copy Markdown
Contributor

Update Django to prevent a possible vulnerability to SQL injections, which was fixed in v4.0.4 that was released just 9 days ago. Also updating django-debug-toolbar to 3.2.1.

Update Django to 4.0.0 to prevent a certain possible vulnerability.
@SchrodingersGat

SchrodingersGat commented Apr 20, 2022 •

Copy link
Copy Markdown
Member

Please fix conflicts with latest master :)

A major change to the django version will require solid review before merging in, too.

@eeintech

Copy link
Copy Markdown
Contributor

Please fix conflicts with latest master :)

What are the conflicts? Seems like only the requirements.txt file has changed.
Is it possible to allow CI to run?

@eeintech

Copy link
Copy Markdown
Contributor

Hit an issue running inv update:

Successfully installed Django-4.0.4 asgiref-3.5.0 backports.zoneinfo-0.2.1 bleach-4.1.0 django-debug-toolbar-3.2.1 tablib-3.2.1
Installing plugin packages from '/home/francois/Desktop/github/InvenTree/InvenTree/plugins.txt'
Running InvenTree database migrations...
========================================
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/francois/Desktop/github/InvenTree/env-inventree/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/home/francois/Desktop/github/InvenTree/env-inventree/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/home/francois/Desktop/github/InvenTree/env-inventree/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/francois/Desktop/github/InvenTree/env-inventree/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/francois/Desktop/github/InvenTree/env-inventree/lib/python3.8/site-packages/django/apps/config.py", line 213, in create
    mod = import_module(mod_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/francois/Desktop/github/InvenTree/InvenTree/plugin/__init__.py", line 5, in <module>
    from .registry import registry
  File "/home/francois/Desktop/github/InvenTree/InvenTree/plugin/registry.py", line 20, in <module>
    from django.conf.urls import url, include
ImportError: cannot import name 'url' from 'django.conf.urls' (/home/francois/Desktop/github/InvenTree/env-inventree/lib/python3.8/site-packages/django/conf/urls/__init__.py)

@SchrodingersGat

Copy link
Copy Markdown
Member

@awiswasi it appears that these critical bug fixes have been backported to 3.2.13:

https://docs.djangoproject.com/en/4.0/releases/3.2.13/

So, rather than having to deal with the headache of updating to django-v4, please adjust this PR to only update django==3.2.13

@eeintech

eeintech commented Apr 20, 2022 •

Copy link
Copy Markdown
Contributor

Also the latest version of django-debug-toolbar is 3.2.4 and not 3.2.1 as pointed to in the updated requirements.txt file:
https://github.com/jazzband/django-debug-toolbar

@matmair matmair left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a major version change in the underlying framework - this needs to be checked by all core-devs before any work goes ahead!

@matmair

matmair commented Apr 20, 2022

Copy link
Copy Markdown
Member

Ah I see everybody was here already.

@awiswasi thank you for looking out for security concerns!
Django is the framework everything builds on and follows semver - therefore there are a lot of breaking changes /depreciations associated with this PR. I can understand the suggested change but would very much prefer to switch to the patched version instead of a new major release.

@SchrodingersGat SchrodingersGat added the security Relates to a security issue label Apr 20, 2022
@matmair matmair mentioned this pull request Apr 20, 2022
@awiswasi

Copy link
Copy Markdown
Contributor Author

@awiswasi it appears that these critical bug fixes have been backported to 3.2.13:

https://docs.djangoproject.com/en/4.0/releases/3.2.13/

So, rather than having to deal with the headache of updating to django-v4, please adjust this PR to only update django==3.2.13

You're right. I missed that last night and just realized there was no need for v4.0.4 so I apologize.
I'm pretty new to version control and to be fair, I have only ever made a few contributions before as I am still learning, so don't mind me if I miss something haha. I'm a C++ developer but I've been learning Python for the past 4 years and I'm just getting into security and code optimization!

With that being said, my take on this is that we are going to go with [email protected] and [email protected] correct?

@SchrodingersGat

Copy link
Copy Markdown
Member

With that being said, my take on this is that we are going to go with [email protected] and [email protected] correct?

Yep, this is correct thanks

@awiswasi awiswasi left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SchrodingersGat

Copy link
Copy Markdown
Member

There are still conflicts as the requirements file has recently been changed. Please rebase this commit from the latest master

@awiswasi

Copy link
Copy Markdown
Contributor Author

I tried to rebase but I got "Updates were rejected because the remote contains work that you do not have locally."
Wasn't requirements.txt changed correctly? Sorry if I'm missing something

@SchrodingersGat

Copy link
Copy Markdown
Member

You will need to pull down the changes from the remote master/main branch before pushing back upstream

@awiswasi awiswasi closed this Apr 20, 2022
@awiswasi
awiswasi deleted the django-update branch April 20, 2022 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Relates to a security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants