Commit Graph

28 Commits

Author SHA1 Message Date
Egor Bugaev 9e15c3b96c Add rename-user SQL template; make batch transaction handling robust against non-Postgres backends
- New 'rename-user' template (templates / template rename-user <old> <new>):
  best-effort uid rename across core tables (oc_users, oc_preferences,
  oc_group_user, oc_group_admin, oc_ldap_user_mapping, oc_share, oc_mounts,
  oc_storages). Explicitly NOT a supported Nextcloud operation - the
  generated script carries an in-line warning (as leading SQL comments)
  that app-specific tables (Talk, Calendar, Contacts, Mail, 2FA/WebAuthn...)
  are not covered and that the data directory must be renamed on disk
  manually, followed by occ files:scan --all. Documented the same caveat
  in both READMEs.
- Hardened the round-2 transaction wrapping: beginTransaction()/commit()/
  rollBack() are now wrapped in try/catch. PostgreSQL (our backend) has
  fully transactional DDL so this wasn't actually broken here, but
  Nextcloud also supports MySQL/MariaDB via the same IDBConnection, where
  DDL implicitly commits - on that backend a DDL statement in the batch
  would make a later commit()/rollBack() throw 'no active transaction'
  and previously that exception was unhandled (HTTP 500 instead of a
  clean JSON response). Now: if rollBack() itself fails after an error,
  we report rollbackFailed+warning instead of falsely claiming rolledBack,
  since earlier statements in that batch may already be permanently
  applied. If commit() fails with nothing to commit (already
  auto-committed), that's logged only, since the effects are already
  durably persisted.
2026-07-06 19:52:05 +03:00
Egor Bugaev ca0605706f Security hardening round 2: comment-aware forbidden-pattern check, UPDATE confirmation, transactional batches, quote-aware split (incl. double quotes), NULL-safe table rendering, AJAX timeout, request size limit
- removeAllComments() strips -- and /* */ comments before checking
  FORBIDDEN_PATTERNS, closing a bypass where a comment inserted between
  a function name and '(' hid it from the regex (e.g. pg_read_file/**/(...)).
- UPDATE now requires confirm=true just like DELETE (deleteCount/updateCount).
- Batches run inside a single DB transaction; a failing statement rolls back
  everything already applied in that batch instead of leaving partial writes.
- splitStatements() (PHP and JS) now tracks a single quoteChar instead of a
  bool, handling both '...' strings and "..." quoted identifiers symmetrically.
- Frontend TEMPLATES no longer rely on SET/current_setting: the escaped uid
  is inlined into every statement, so partial copy/paste still works.
- renderTable() renders NULL as [NULL] instead of an empty string, so it's
  no longer visually identical to an empty string value.
- Added MAX_SQL_BYTES (1MB) request size limit, returned as HTTP 413.
- Added a 120s client-side AJAX timeout with a distinct timeout message,
  so a hung request doesn't leave the terminal paused indefinitely.
2026-07-06 19:38:25 +03:00
Egor Bugaev 8aaab998a1 Harden SQL mode: block file/program access, audit log, row limit, quote-aware statement splitting 2026-07-06 17:54:36 +03:00
Egor Bugaev 4d87deb176 Require explicit confirmation before running DELETE statements in SQL mode 2026-07-06 17:03:51 +03:00
fanategorius c1d9494414 Update DbController.php 2026-07-06 16:29:09 +03:00
fanategorius f612931480 Create DbController.php 2026-07-06 12:47:24 +03:00
fanategorius 27cf74c5eb Update OccOutput.php 2026-07-06 12:44:41 +03:00
Zeller 44eb700713 fix: adapt breaking changes of OC\Console\Application constructor 2025-04-10 15:08:06 +02:00
Zeller 33613686ea fix: use LoggerInterface instead of deprecated ILogger in OccController 2025-04-10 15:08:06 +02:00
Rahammetoela Toekiman b1159a811a fix Declaration of OCA\OCCWeb\Controller\OccOutput::getErrorOutput() must be compatible
Declaration of OCA\OCCWeb\Controller\OccOutput::getErrorOutput() must be compatible with Symfony\Component\Console\Output\ConsoleOutputInterface::getErrorOutput(): Symfony\Component\Console\Output\OutputInterface at /var/www/html/custom_apps/occweb/lib/Controller/OccOutput.php#22
2025-01-22 15:13:23 +01:00
Rahammetoela Toekiman cc591973a4 fix Too few arguments to function OC\Console\Application::__construct(), 5 passed in /var/www/html/custom_apps/occweb/lib/Controller/OccController.php on line 33 and exactly 6 expected
fix #14 #15 #16 #17
2025-01-22 15:13:23 +01:00
Rahammetoela Toekiman 50e2b4bbab fix Call to undefined method OC\Server::getEventDispatcher() 2024-05-15 15:05:25 +02:00
Alexander Rose 4f6ef754e2 use reflection to get the list of commands for tab-completion 2023-08-22 12:22:36 +02:00
Alexander Rose 2a25ca725e send empty array on OccController->list() 2023-08-22 12:22:36 +02:00
Alexander Rose 354086c6db fix application logger 2022-03-08 19:31:00 +01:00
Adphi 4fecde9d9d returns error message on exception 2020-02-02 17:54:29 +01:00
Adphi 411e9e800f fix name cases 2020-02-02 13:15:44 +00:00
Adphi aa2848cfee fix #11 2020-01-30 22:04:23 +01:00
Adphi 222e9d5956 fix #6 2020-01-29 22:03:47 +01:00
Adphi e03bd71092 fix app compliance 2020-01-26 15:38:26 +01:00
Adphi 2447aea115 Fix core server lib import path 2019-07-20 14:02:52 +02:00
Adphi 608b0e2462 removed memory infos 2019-01-24 20:22:55 +01:00
Adphi 77b1f007cf fix #1 remove dirty hack 2019-01-24 19:56:20 +01:00
Adphi 83ed35c4c5 Fix Controllers Files names 2019-01-19 17:20:07 +01:00
Adphi 6856ac0eba fix app compliance 2019-01-19 16:32:50 +01:00
Adphi c642ad90f9 fixed navigation 2019-01-19 16:16:04 +01:00
Adphi 32837fffa6 renamed app 'OCC Web' 2019-01-19 15:54:24 +01:00
Adphi c909a11420 init: term colors, completion, execution 2019-01-19 15:40:52 +01:00