Skip to content

Error when using password containing question mark #2651

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
eldering opened this issue Aug 17, 2024 · 3 comments
Open

Error when using password containing question mark #2651

eldering opened this issue Aug 17, 2024 · 3 comments
Assignees

Comments

@eldering
Copy link
Member

On current main branch (and also on 8.2 branch) when I try to use a DB password containing a ?, then during the installation process I get this error:

make[1]: Entering directory '/home/jaap/domjudge/git/domjudge/webapp'
composer auto-scripts
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!   // Clearing the cache for the dev environment with debug true                  
!!  
!!  
!!  In ConnectionFactory.php line 262:
!!                                
!!    Malformed parameter "url".  
!!                                
!!  
!!  In MalformedDsnException.php line 12:
!!                                       
!!    Malformed database connection URL  
!!                                       
!!  
!!  cache:clear [--no-warmup] [--no-optional-warmers]
!!  
!!  
make[1]: *** [Makefile:72: composer-autoclean] Error 1
make[1]: Leaving directory '/home/jaap/domjudge/git/domjudge/webapp'
make: *** [/home/jaap/domjudge/git/domjudge/Makefile.global:81: inplace-install] Error 1

and I see these errors in the symfony logs:

[2024-08-17T09:05:38.278222+00:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\MalformedDsnException: "Malformed parameter "url"." at ConnectionFactory.php line 262 {"exception":"[object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed parameter \"url\". at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/doctrine-bundle/src/ConnectionFactory.php:262)\n[previous exception] [object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed database connection URL at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/dbal/src/Exception/MalformedDsnException.php:12)\n[previous exception] [object] (PDOException(code: 1045): SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO) at /home/jaap/domjudge/git/domjudge/webapp/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php:426)"} []
[2024-08-17T09:05:38.393693+00:00] request.CRITICAL: Exception thrown when handling an exception (Doctrine\DBAL\Exception\MalformedDsnException: Malformed parameter "url". at ConnectionFactory.php line 262) {"exception":"[object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed parameter \"url\". at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/doctrine-bundle/src/ConnectionFactory.php:262)\n[previous exception] [object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed database connection URL at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/dbal/src/Exception/MalformedDsnException.php:12)"} []
[2024-08-17T09:05:38.393797+00:00] php.CRITICAL: Uncaught Exception: Malformed parameter "url". {"exception":"[object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed parameter \"url\". at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/doctrine-bundle/src/ConnectionFactory.php:262)\n[previous exception] [object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed database connection URL at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/dbal/src/Exception/MalformedDsnException.php:12)\n[previous exception] [object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed parameter \"url\". at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/doctrine-bundle/src/ConnectionFactory.php:262)\n[previous exception] [object] (Doctrine\\DBAL\\Exception\\MalformedDsnException(code: 0): Malformed database connection URL at /home/jaap/domjudge/git/domjudge/webapp/vendor/doctrine/dbal/src/Exception/MalformedDsnException.php:12)\n[previous exception] [object] (PDOException(code: 1045): SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO) at /home/jaap/domjudge/git/domjudge/webapp/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php:426)"} []

It seems that the password is stored and parsed from a URL and probably does not get URL encoded properly.

@vmcj
Copy link
Member

vmcj commented Aug 17, 2024

I wonder if this is the same as #2502.

@eldering
Copy link
Member Author

I wonder if this is the same as #2502.

Quite likely, yes.

@eldering eldering self-assigned this Aug 25, 2024
@vmcj
Copy link
Member

vmcj commented Aug 25, 2024

I suspect the problem is in: webapp/config/load_db_secrets.php

eldering added a commit that referenced this issue Aug 25, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
eldering added a commit that referenced this issue Aug 25, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
eldering added a commit that referenced this issue Nov 22, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
eldering added a commit that referenced this issue Nov 23, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
eldering added a commit that referenced this issue Nov 24, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
meisterT pushed a commit to meisterT/domjudge that referenced this issue Nov 25, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: DOMjudge#2651
Closes: DOMjudge#2502 as this is likely fixed but I couldn't reproduce it
(cherry picked from commit abeefb3)
eldering added a commit that referenced this issue Nov 25, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
eldering added a commit that referenced this issue Nov 26, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
eldering added a commit that referenced this issue Nov 27, 2024
See for reference:
- https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri
- https://symfony.com/doc/current/doctrine.html
but note that we must use `rawurlencode` instead of `urlencode` which
differ in how they encode a space (as tested).

Fixes: #2651
Closes: #2502 as this is likely fixed but I couldn't reproduce it
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants