-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(deps): build psycopg3 instead of using pre-build binary #10491
Conversation
Hi there 👋, @DryRunSecurity here, below is a summary of our analysis and findings.
Note 🟢 Risk threshold not exceeded. Change Summary (click to expand)The following is a summary of changes in this pull request made by me, your security buddy 🤖. Note that this summary is auto-generated and not meant to be a definitive list of security issues but rather a helpful summary from a security perspective. Summary: The provided code changes cover updates to the The key changes include updating the PostgreSQL client version, adding new build dependencies, updating Node.js and Yarn versions, and implementing security-conscious practices such as user and permissions management, environment variable handling, and including additional fixtures and tests in the Docker image. From an application security perspective, these changes are generally positive as they demonstrate the maintainers' commitment to keeping the application's dependencies up-to-date and addressing potential security vulnerabilities. The updates to the PostgreSQL client and the addition of new build dependencies suggest that the application is being actively maintained and improved. Additionally, the security-conscious practices, such as user and permissions management, and the inclusion of additional fixtures and tests, indicate that the maintainers are taking steps to harden the application's deployment and ensure its overall security and reliability. Files Changed:
Powered by DryRun Security |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Note: There's a PR to move to psycopg3 that's closer to being merged as well #10348 |
with this pr we would still use the not recommended prebuild binary version of psycopg. i don't really mind about the postgres clients version, just wanted to keep it up to date as alpine informs about using a old client version when installing version 14:
|
Original tests have not been failing. Is there some way to improve tests to detect SegFault earlier? |
hi @kiblik , |
Yes, but if we're moving to psycopg3 then maybe do a PR for the non-binary version of psychopg3 instead of the non-binary version of psycopg2. At least that's what I was thinking. At one point in time we switched to the binary version of psycopg for a specific reason but that was quite some time ago so I don't have a problem with using the non-binary/source version of that module. I'd prefer not to use non-binary 2 over binary 3 of that module when non-binary 3 is a valid option.
The one place where this can cause problems is for iron installs - we've planning on deprecating that but it's not "official' yet. I just don't want to optimize for one distro and break others if we don't absolutely have to - from a quick look at building psychopg3, only libpq5. Just checked with the most "interesting" distro (RHEL 8) and pip has no issues building psychopg3 assuming you have the needed Postgres dev packages installed. So I'll make my comments as resolved as far as the PG 16 is concerned. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
alright, i've tested with the prebuild psycopg3 binary alpine image which also leads into segmentation faults. |
OK. Perfect. Feel free to change this PR to use the source/you-build-it psycopg3 or close it and open a new one if that's easier for you. I'm happy to take a PR to move to a built version of psycopg3 instead of the binary version that's currently in place after #10348 was merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized you already changed to psycopg[c] from psycopg[binary]
Approved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…ild binary Signed-off-by: gietschess <49275246+gietschess@users.noreply.github.com>
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Do we know when this will be released? We're facing the same issue with OVH managed PG databases 👀 |
@hajali-amine This went into the dev branch so will be part of the 2.37.0 (August) release. Minor version releases happen on the 1st Monday of the month or for August 5th. If you need it sooner than that, you can always change requirements.txt like the PR does and build your own docker images using the dockerfiles in this repo. |
… kiuwan-sca # By dependabot[bot] (13) and others # Via GitHub * 'kiuwan-sca' of github.com:mwager/django-DefectDojo: (39 commits) Deprecate Python-jose and migrate okta to python_social_auth (DefectDojo#10117) fix: dockerfile warnings (DefectDojo#10505) Ruff: Add and fix Q000 (DefectDojo#10095) Fix(django): Upgrade of 4.2 (DefectDojo#10553) fix(deps): build python psycopg3 dependency instead of use the pre-build binary (DefectDojo#10491) Bump coverage from 7.5.4 to 7.6.0 (DefectDojo#10560) Bump asteval from 1.0.0 to 1.0.1 (DefectDojo#10561) Bump djangorestframework from 3.14.0 to 3.15.2 (DefectDojo#10431) Bump boto3 from 1.34.142 to 1.34.143 (DefectDojo#10558) Bump django-debug-toolbar from 4.4.5 to 4.4.6 (DefectDojo#10557) Bump boto3 from 1.34.141 to 1.34.142 (DefectDojo#10551) Bump packageurl-python from 0.15.2 to 0.15.3 (DefectDojo#10541) Bump boto3 from 1.34.140 to 1.34.141 (DefectDojo#10542) Update helm lock file Update versions in application files Update versions in application files API: Convert get_filterset calls to get_queryset (DefectDojo#10543) Bump django-debug-toolbar from 4.4.4 to 4.4.5 (DefectDojo#10527) Fix ruff Ruff fix ... # Conflicts: # dojo/settings/.settings.dist.py.sha256sum
Description
Since the update of the base python docker image from alpine:3.16 to 3.20 we've had segmentation faults while connecting to aws rds postgres databases. With the debug environment variable from the psycopg2 dependency we found connection issues while connecting to our database (see logs below).
Building the psycopg3 postgresql adapter instead of using the pre-build dependency as it's described in the psycopg3 installation documentation the connection could be established again as expected.
Also see the slack thread on this issue.
Test results
I've locally build and tested both the alpine and debian django +nginx dockerimages and tested them against the bitnami and aws rds postgres database.
Extra information
Additional logs:
Debug logs with the alpine image containing the psycopg2-binary 2.9.9 dependency:
Debug logs with the alpine image containing the self-build psycopg2 2.9.9 dependency: