Commit Graph

58 Commits

Author SHA1 Message Date
Josh
f9f27cec20 fix(setup/pgsql): use injected ISecureRandom
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
1cc43bfad5 chore(setup/pgsql): php-cs fixup
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
1cdd0af24c refactor(setup/pgsql): log chosen db username
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
b8641561ea refactor(setup/pgsql): split out schema mgmt logic + enhance its logging
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
d110f259dc refactor(setup/pgsql): Split up creation code path from non-creation
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
f8e1dc0da2 refactor(setup/pgsql): use a single connection object and better handle admin credentials
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
00074b72c1 refactor(setup/pgsql): make connect object names less ambiguous
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
f4e7a7ff5d refactor(setup/pgsql): avoid mutating properties until necessary
And consolidate credential generation logic in a single place

Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
4787dff6dd refactor(setup/pgsql): move db verification logic to helper
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Josh
3b38cb3d50 refactor(setup/pgsql): move role creation priv check to helper
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-02-18 10:25:39 -05:00
Carl Schwan
c96ece0bcb refactor: Add more typing
- repairs job
- database
- redis

And remove Helpertest which was unused outside of some tests.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2026-02-06 13:55:39 +01:00
Carl Schwan
7b6078875b refactor: Run rector on lib/private
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2026-02-06 13:50:18 +01:00
Carl Schwan
c21b8169ff refactor(querybuilder): Port away from qb::execute() in lib/
Replace by either executeStatement or executeQuery

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
2025-09-02 11:55:56 +02:00
provokateurin
9a121269f3 refactor(Setup): When creating a DB user don't use the admin username
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-06-10 11:16:28 +02:00
Git'Fellow
a1681b0756 chore(db): Apply query prepared statements
Fix: psalm

fix: bad file

fix: bug

chore: add batch

chore: add batch

chore: add batch

fix: psalm
2024-10-17 20:30:47 +02:00
Daniel Kesselberg
af6de04e9e style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +02:00
Hailong Wang
67c52d202c fix: use $this->tryCreateDbUser condition 2024-08-16 10:59:15 +02:00
Hailong Wang
f490a4e8c0 fix: postgresql GRANT user's permission after createDatabase, ensure database exist when GRANT 2024-08-16 10:57:11 +02:00
John Molakvoæ
258bb03cf5 Merge branch 'master' into refactor/OC-Server-getSecureRandom
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
2024-05-30 14:24:22 +02:00
Andy Scherzinger
dae7c159f7 chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +02:00
John Molakvoæ
524ed97d62 fix: replace Account name by Login
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2024-02-13 21:08:10 +01:00
Vincent Petry
839ddaa354 feat: rename users to account or person
Replace translated text in most locations

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2024-02-13 21:06:30 +01:00
Andrew Summers
1395a53602 Refactor OC\Server::getSecureRandom
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
2023-08-29 21:32:40 -05:00
Simon L
40edac18f5 postgresql - add quotes around user names
fix https://github.com/nextcloud/server/issues/37114

Signed-off-by: Simon L <szaimen@e.mail.de>
2023-03-08 01:03:27 +01:00
Robin Appelman
b923310580 add option to disable db user creation trough environment variable
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-21 15:13:47 +01:00
Vitor Mattos
eb7b682dc0 Bugfix to support postgres15
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Simon L <szaimen@e.mail.de>
Co-Authored-By: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
2022-11-11 22:36:08 +01:00
J0WI
3b656446af Introduce ISecureRandom::CHAR_ALPHANUMERIC
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2021-07-08 15:11:31 +02:00
John Molakvoæ (skjnldsv)
215aef3cbd Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Joas Schilling
167efa19d7 Fix psalm errors
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-27 14:34:32 +02:00
Christoph Wurst
8b64e92b92 Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-01-08 11:45:19 +01:00
Morris Jobke
d0ac76a77c Add more previous exceptions to database setup code
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-01-07 21:04:11 +01:00
Morris Jobke
99c9423766 Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +02:00
Christoph Wurst
5bf3d1bb38 Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma
68748d4f85 Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Vitor Mattos
35465ca90c solve code review
Signed-off-by: Vitor Mattos <vitor@php.rio>
2019-04-22 19:57:11 -03:00
Vitor Mattos
4d187ce1d7 Check if database exists and grand permission
Signed-off-by: Vitor Mattos <vitor@php.rio>
2019-04-21 16:54:40 -03:00
Vitor Mattos
824cc0af1e Bugfix: user is not allowed
The created user don't has permission to connect to database. I changed the code to give permission

Signed-off-by: Vitor Mattos <vitor@php.rio>
2019-04-21 15:00:39 -03:00
Morris Jobke
3f9cdeeb5f Cleanup some PHPDoc leftovers and unused variables
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-03-06 15:43:56 +01:00
Morris Jobke
a661f043e1 Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 23:46:40 +01:00
Morris Jobke
0eebff152a Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Joas Schilling
5e04254d40 Install from migrations
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-07-25 12:47:37 +02:00
Lukas Reschke
3d2600b039 Add Phan plugin to check for SQL injections
This adds a phan plugin which checks for SQL injections on code using our QueryBuilder, while it isn't perfect it should already catch most potential issues.

As always, static analysis will sometimes have false positives and this is also here the case. So in some cases the analyzer just doesn't know if something is potential user input or not, thus I had to add some `@suppress SqlInjectionChecker` in front of those potential injections.

The Phan plugin hasn't the most awesome code but it works and I also added a file with test cases.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-07-20 22:48:13 +02:00
Joas Schilling
1c0bffe87f Fix translations
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-18 16:40:53 -05:00
Morris Jobke
edd55b0ea9 Use SystemConfig instead of AllConfig for DB stuff
* preparation for followup PRs to clean up the DB bootstrapping

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-19 15:53:49 -06:00
Joas Schilling
7293a4e5ec Allow to reuse the same name when installing a new instance
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-12-12 17:28:57 +01:00
Joas Schilling
a5a35cda7c Lower the role name before using it
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-12-09 16:41:01 +01:00
Joas Schilling
0d6134f512 Revert "Quote database and role in queries"
This reverts commit 9ebd5d5bb2.
2016-12-09 15:36:14 +01:00
Lari Tikkanen
9ebd5d5bb2 Quote database and role in queries
Fixes #1793
Signed-off-by: Lari Tikkanen <lartza@outlook.com>
2016-12-07 22:12:25 +02:00
Robin Appelman
5365c1a32f handle postgres setup when we cant connect as admin 2016-12-05 16:00:05 +01:00
Roeland Jago Douma
7fb88ec506 Use proper ALTER ROLE syntax
Fixes #1260

See https://www.postgresql.org/docs/9.0/static/sql-alterrole.html
2016-09-05 10:45:11 +02:00