Skip to content
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(DB): Sanitize host parameter for postgres databases when IPv6 address is passed #44394

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Mar 21, 2024

Summary

Doctrine is using pg_connect with the host parameter, this does not allow IPv6 addresses in URI notation. So we need to extract the IP address and pass it directly

Checklist

@susnux susnux added bug 3. to review Waiting for reviews labels Mar 21, 2024
@susnux susnux added this to the Nextcloud 29 milestone Mar 21, 2024
@susnux susnux requested review from Altahrim, a team, Fenn-CS and sorbaugh and removed request for a team March 21, 2024 18:03
@susnux
Copy link
Contributor Author

susnux commented Mar 21, 2024

BTW this was introduced with Nextcloud 28 and the update to Doctrine 3.7

@susnux
Copy link
Contributor Author

susnux commented Mar 21, 2024

/backport to stable28

@solracsf

This comment was marked as resolved.

@susnux
Copy link
Contributor Author

susnux commented Mar 23, 2024

For the future I fixed it upstream: doctrine/dbal#6344

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Adding a test is too complicated/artificial I guess?

@Altahrim Altahrim mentioned this pull request Mar 25, 2024
@susnux
Copy link
Contributor Author

susnux commented Mar 25, 2024

@nickvergessen I am not sure how to test this, for unit tests I would need to mock a static function. For integration tests we would need a specific database configuration.

@nickvergessen
Copy link
Member

yeah, that's exactly what I mean.

…ddress is passed

Doctrine is using `pg_connect` with the `host` parameter, this does not allow IPv6 addresses in URI notation.
So we need to extract the IP address and pass it directly

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux merged commit 0d7bb0b into master Mar 25, 2024
167 checks passed
@susnux susnux deleted the fix/ipv6-postgres branch March 25, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot use database over IPv6
4 participants