Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/django/python-guestbook/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Django==4.2.9
psycopg2-binary==2.9.9
psycopg2-binary==2.9.11
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

For production environments, it is strongly recommended to use psycopg2 instead of psycopg2-binary. The psycopg2-binary package is meant for development and testing, as it comes with its own pre-compiled dependencies which may not be up-to-date with security patches or compatible with the system libraries.

Using the source distribution (psycopg2) ensures that it's compiled against the system's libraries in the Docker image, which is safer and more reliable for production.

This will require adding build dependencies to your Dockerfile. For an Alpine-based image, you would need to add something like this before installing the requirements:

RUN apk add --no-cache postgresql-dev gcc musl-dev
psycopg2==2.9.11
References
  1. The psycopg2-binary package is intended for development and testing purposes, not for production use. For production, the source distribution psycopg2 should be used to ensure it is built against the system's trusted libraries, avoiding potential security vulnerabilities or incompatibilities from bundled dependencies.

python-dateutil==2.8.2
2 changes: 1 addition & 1 deletion python/django/python-hello-world/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==4.2.10
requests==2.31.0
psycopg2-binary==2.9.9
psycopg2-binary==2.9.11
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

For production environments, it is strongly recommended to use psycopg2 instead of psycopg2-binary. The psycopg2-binary package is meant for development and testing, as it comes with its own pre-compiled dependencies which may not be up-to-date with security patches or compatible with the system libraries.

Using the source distribution (psycopg2) ensures that it's compiled against the system's libraries in the Docker image, which is safer and more reliable for production.

This will require adding build dependencies to your Dockerfile. For an Alpine-based image, you would need to add something like this before installing the requirements:

RUN apk add --no-cache postgresql-dev gcc musl-dev
psycopg2==2.9.11
References
  1. The psycopg2-binary package is intended for development and testing purposes, not for production use. For production, the source distribution psycopg2 should be used to ensure it is built against the system's trusted libraries, avoiding potential security vulnerabilities or incompatibilities from bundled dependencies.

debugpy # Required for debugging