Commit Graph

54 Commits

Author SHA1 Message Date
dillard 266b5a6985 Release 0.4.6
Bump the version, add 0.4.6 to the compatibility matrix and the switch
from occ to the SQL mode as a screenshot.
2026-09-30 17:31:37 +02:00
dillard d349aad2e6 Show the SQL mode and a command in the screenshots
Replace the empty start screen with a screenshot of the SQL mode and
one of an occ command with its output.
2026-09-30 17:00:00 +02:00
dillard d25580239e Describe the app properly in the app store listing
The summary and description only said "Run OCC Commands in a web
terminal" and did not mention the SQL mode, the confirmation and
blocking rules, the admin-only access or the limitations.
2026-09-30 16:59:01 +02:00
dillard 2b57349519 Refresh the screenshots
Replace the old screenshot with a current one of the terminal running
occ, and add the start screen as a second screenshot for the app store.
2026-09-30 16:08:22 +02:00
dillard f68b1658be Harden SQL mode checks and sanitize occ output
A security review found three issues:

- Comments were removed without a space before matching the forbidden
  patterns, so "TO/**/PROGRAM" became "TOPROGRAM" and passed the
  COPY ... PROGRAM check while PostgreSQL still ran it. Comments are
  now replaced by a space, and the COPY file check also covers E'...',
  U&'...' and dollar-quoted file names.
- Only statements starting with DELETE or UPDATE asked for
  confirmation, so a leading block comment, a data-modifying CTE
  (WITH x AS (DELETE ...)) or DROP/TRUNCATE/INSERT ran without it.
  Every statement that is not a plain read now needs confirmation,
  decided on the server.
- occ output could contain escape sequences, backspaces and URLs from
  user-controlled text (display names, file names) that rewrite or hide
  text or show a clickable link. Only color codes are kept now, and
  URLs are no longer turned into links.

The checks move to SqlGuard so they can be tested on their own. They
remain defense in depth: dynamic SQL can always get around a text
check, so the database role should not have superuser rights,
pg_execute_server_program or pg_read/write_server_files. A read that
starts with WITH now shows its rows like a SELECT.
2026-09-30 03:15:35 +02:00
dillard 3fc8601344 Keep occ output brackets escaped through the formatters
The overtyping and from_ansi formatters unescape brackets before they
parse the text, so escaping them beforehand was not enough: literal
brackets were still read as formatting. Enable
unixFormattingEscapeBrackets so both formatters escape the text again
after parsing. Verified in the browser: Symfony's "[alias]" in
`occ list` stays in place, ANSI colors still work, and formatting in
the output text (colors, links) is no longer applied.

Bump the version to 0.4.4 so browsers load the new script.
2026-09-30 02:25:13 +02:00
dillard a607426a9c Only load vendored jQuery on NC34+, verified against NC32/33/34 in testbak/
Core still provides a working jQuery on NC32/33, but via a read-only
window.$ getter - loading our own vendored copy there too made its UMD
wrapper throw trying to reassign window.$ (confirmed on real containers,
harmless in practice since this app attaches via window.jQuery, but a real
avoidable console exception). Gate the extra script() call on
ServerVersion::getMajorVersion() >= 34 instead.

Re-tested both sides of the boundary: NC32 no longer requests jquery.js and
has zero console errors; NC34 still requests it and still works.
2026-09-27 00:24:47 +02:00
dillard 35e1f5df32 Fix NC35 fatal in OccOutput, verify+narrow supported version range to 32-35
testbak/ (local, non-AIO docker compat rigs for NC32/33/34/35) found a real
fatal on NC35: OccOutput::setErrorOutput() didn't declare the ": void"
return type the Symfony Console version NC35 bundles now requires on
ConsoleOutputInterface. Fixed by declaring it - compatible with older
Symfony/NC versions too since it only narrows an untyped parent signature.

32/33 were also verified functional (the previously-suspected jQuery
getter-conflict console exception on those versions is real but harmless -
the app attaches via window.jQuery, not window.$).

min-version/max-version narrowed from 30/34 to 32/35: 30/31 were never
actually tested even before this session, so keeping them was an unverified
claim; 35 is now genuinely verified rather than guessed.
2026-09-27 00:17:28 +02:00
dillard a5f5c5cdb7 Fix code-review findings: ajax error handling, translated comment, docs
- js/index.js: the occ-command ajax call used the wrong jQuery .fail()
  signature ((response, code) instead of (jqXHR, textStatus,
  errorThrown)), so any failure printed the literal string
  "[object Object]" instead of a useful message.
- js/index.js: the initial bootstrap call that builds the terminal had
  no .fail() handler at all - a failure there (expired session/CSRF
  token, network error, rejected admin check) left #app-content
  permanently blank with zero diagnostic information. This is exactly
  what made today's NC34 debugging session harder than it needed to
  be; now it shows the actual HTTP status/reason in the page.
- OccController.php: translated a leftover Dutch comment (missed by
  the earlier Russian->English pass since it wasn't Russian), and
  documented why requireAdmin() is intentional defense-in-depth rather
  than a misunderstanding of the framework: verified against
  Nextcloud's own SecurityMiddleware source that any controller method
  without @NoAdminRequired already rejects non-admins by default, so
  this check (and the original "security fix" commit that added it)
  was addressing a non-issue for THIS controller specifically.
  DbController's equivalent check is still genuinely load-bearing -
  that controller originally shipped with @PublicPage, which does
  bypass the default protection - so it gets a note explaining the
  distinction instead.
- README: added compatibility matrix rows for 0.4.0 (app id rename to
  extended_occweb) and 0.4.1 (these fixes), both verified on NC 34.0.4.

Deferred to when a test instance exists (tracked, not fixed here): no
documented migration path from the old occweb id to extended_occweb
for existing installs, OccController's constructor doing expensive
work before the (redundant) admin check runs, and js/jquery.js loading
unconditionally on NC30-33 where core still provides jQuery.

Version bump to 0.4.1.
2026-09-26 16:04:14 +02:00
dillard 221ea8a249 Shorten navigation menu label to "OCC Web" (was "OCCWeb")
Full app name stays "Extended OCC Web" for the App Store/apps
management page - only the top-nav menu entry needed a shorter,
readable label.
2026-09-26 15:55:10 +02:00
dillard 138ee88486 Rename app id from occweb to extended_occweb, prep for App Store
Nextcloud's app id "occweb" is effectively unavailable for a new store
listing: the original Adphi/occweb still owns that App Store slot
(stale, v0.2.3), and el-choco/occweb_v2 has since published a
same-lineage rewrite under its own id. Rather than fight over the
"occweb" name, publish this fork under its own id, matching the
<name> this app has always had: "Extended OCC Web".

Renames every place the literal app id is used: info.xml <id> and the
auto-generated navigation <route>, script()/style() registrations in
templates/index.php, the TemplateResponse app name in
OccController::index(), the /apps/... base URL in js/index.js, and the
'app' log context tag in DbController.php. The GitHub repo name and
its <website>/<bugs>/<repository>/<screenshot> links are unaffected -
those identify the repo, not the Nextcloud app.

Docs (README, INSTALL-AIO.md, install.sh) updated to clone into and
reference an "extended_occweb" directory, since Nextcloud requires the
app folder name to match its id - a plain `git clone` of this repo no
longer produces a correctly-named install directory on its own.

Version bump to 0.4.0 given the scope (breaking change for anyone who
already deployed under the old "occweb" id - requires disable+remove
of the old app and a fresh enable under the new id, not an in-place
upgrade).
2026-09-26 12:51:21 +02:00
dillard 2872d70653 Fix NC34 compatibility: vendor jQuery, send CSRF token explicitly on ajax calls
Live-tested against nc01 after its auto-update jumped to NC 34.0.4:

- Nextcloud's global jQuery has been deprecated since NC19 and is no
  longer reliably present/first-loaded on NC34 (other apps like
  serverinfo hit the same issue). occweb's index.js and the vendored
  jquery.terminal (term.js) both assume a global jQuery, so ship our
  own copy (js/jquery.js, 3.7.1 from code.jquery.com) and load it
  before them in templates/index.php. Fixes a hard "jQuery is not
  defined" crash that left the terminal blank (black screen).

- With that fixed, every ajax call started failing with HTTP 412
  "CSRF check failed": core only auto-attaches the requesttoken
  header to requests made through ITS OWN globally-loaded jQuery, and
  with occweb now vendoring a separate jQuery instance that no longer
  happens. A global $.ajaxSetup() call turned out unreliable (another
  app's later jQuery load can replace window.jQuery afterwards), so
  each of the three ajax calls (SQL query, initial completion list,
  occ command execution) now sets the requesttoken header explicitly
  via OC.requestToken.

Bump max-version to 34 - actually verified working on NC 34.0.4 now,
not inherited/guessed (see the policy comment in this same file).
Version bump to 0.3.5.
2026-09-26 12:23:28 +02:00
dillard 827b2d10dd Revert max-version to 33: only claim what we've actually verified
35 was fanategorius's own tested value, but this is now a modified
fork (CSRF fix, admin checks, translated internals) - inheriting their
compatibility claim isn't the same as having verified it ourselves.
33 is the only version this fork has actually run on (nc01).

An untested max-version that's too high is worse than one that's
accurate: on the next core bump, Nextcloud's own compat check would
keep the app enabled on an unverified major instead of cleanly
disabling it, so a real incompatibility would surface as a runtime
error instead of a safe, expected "needs testing" disable.

Policy going forward (documented inline in info.xml): test against
the next major's beta ahead of time and bump max-version before that
major goes final, so the app is never caught by surprise - never bump
it reactively/speculatively.
2026-09-26 03:53:16 +02:00
dillard 20bdb7dcd6 Fix install/clone instructions to point at our fork, revert max-version to 35
README.md and install.sh's install instructions still told new users to
git clone the abandoned upstream (fanategorius/occweb), which lacks all
of this fork's fixes. Point those at dillardblom/occweb; leave the
Credits section's links to Adphi/fanategorius as-is since those are
deliberate attribution, not install instructions. Also repoint the
README screenshot badge, which was hotlinking Adphi's repo.

composer.json still listed only the original author; add ourselves
alongside, matching the info.xml author field.

Revert max-version 40->35: 35 was fanategorius's own tested release
value (commit 7c09dd2), not a guess. Bumping to 40 was our own
speculative headroom into an untested future major - exactly the
pattern this project's own history already reverted twice, for the
same stated reason ("hasn't been tested against newer Nextcloud
releases"). Getting auto-disabled by the compat check on an untested
major is the correct, safe failure mode; claiming compatibility we
haven't verified is not. 35 still satisfies the Codex finding (no
narrowing below a previously-validated ceiling) without guessing ahead.
2026-09-26 03:50:37 +02:00
dillard c2186ce2ea Give max-version real headroom instead of pinning to nc01's exact core version
Codex review flagged the previous 35->33 change as an unjustified
compatibility regression: nothing in this app's code is actually
incompatible with NC 34/35, so narrowing the ceiling only reflects
nc01's current version, not a real limitation. Worse, nc01's AIO now
auto-updates its core nightly (watchtower-aio), so pinning max-version
to today's exact version would very likely repeat the 2026-08-09
incident (occweb auto-disabled by the compat check) on the very next
core bump. This app only calls a handful of stable, long-lived OCP
interfaces, so a generous ceiling carries little real compatibility
risk compared to that recurring outage.
2026-09-26 03:38:48 +02:00
dillard 97ceaf7c37 Point website/bugs/repository/screenshot at our own fork
Upstream (fanategorius/occweb) is abandoned; this fork is the
maintained one now, so app metadata should point here instead.
2026-09-26 02:01:29 +02:00
dillard 292b8980cb Update app author name to maintainer's own name 2026-09-26 02:00:01 +02:00
dillard faa389c4b1 Update app author email to maintainer's own address
Upstream (fanategorius/occweb) is abandoned; this fork is maintained
independently, so the contact address in info.xml should point here.
2026-09-26 01:59:27 +02:00
dillard 2af32728f7 Correct max-version to 33 (actual nc01 core version, not 36)
occ status on nc01 reports 33.0.8.2, not 36 as assumed — match the
repo's established convention of pinning max-version to the actually
tested/installed core version rather than a guess.
2026-09-26 01:55:56 +02:00
dillard ad0ce047e5 Remove unjustified @NoCSRFRequired from DbController::query(), bump max-version to 36
query() runs arbitrary admin SQL (including DELETE/UPDATE) and was
exempted from CSRF protection — a leftover from the original upstream
code, which had this alongside @PublicPage (no auth at all) before our
admin-check hardening. The client already goes through the standard
$.ajax() flow that auto-attaches Nextcloud's CSRF token, exactly like
OccController::cmd() does without any such exemption, so removing it
has no functional cost.

Also bump nextcloud max-version to 36 to match nc01's current core
version, now that AIO auto-updates the core nightly.

Version bump to 0.3.4.
2026-09-26 00:36:16 +02:00
fanategorius 7c09dd2278 Update info.xml 2026-07-06 18:57:32 +03:00
Egor Bugaev 6217ec5405 Pin max-version back to 31 (matches actual installed Nextcloud) to keep update banner suppressed 2026-07-06 18:29:12 +03:00
Egor Bugaev c49bebc73e Set max-version to 50 so occweb doesn't block future Nextcloud update visibility 2026-07-06 18:16:11 +03:00
Egor Bugaev 60c5d2e27c Revert max-version to 31 - occweb hasn't been tested against newer Nextcloud releases 2026-07-06 18:15:01 +03:00
Egor Bugaev 6f4a7ee8ff Update app metadata: author, repo links, and Nextcloud compatibility range 2026-07-06 18:06:08 +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 d4d1fbcbfc Bump version to 0.2.5 to force asset cache-busting 2026-07-06 17:22:27 +03:00
Egor Bugaev 07df21aac9 Bump version to 0.2.4, document SQL query mode, add Russian README 2026-07-06 16:47:17 +03:00
fanategorius 26076df94b Update routes.php 2026-07-06 12:48:34 +03:00
Adphi 5b81c89610 add nextcloud 31 support
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2025-04-10 15:17:47 +02:00
Adphi f078621a47 add nextcloud 30 support
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2025-01-22 15:14:29 +01:00
Adphi b5087db81b Version compatibility for nextcloud 29
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2025-01-22 15:04:34 +01:00
Adphi a8694d1bb5 version v0.2.0: nextcloud 28 as minimum version
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2024-05-16 18:07:39 +02:00
Adphi c016c442e6 version v0.1.2
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2024-05-15 15:12:00 +02:00
Adphi 66c823195c update links to main branch and remove remaning gogs links
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2023-08-22 12:33:17 +02:00
Alexander Rose bd74348fde fix tabs in routes.php 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
Adphi e62276b8a9 move repository to github
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2022-03-08 19:34:39 +01:00
Alexander Rose a8ab035eac update appinfo 2022-03-08 19:31:00 +01:00
Adphi ad5306cf67 occweb lowercase 2020-02-01 14:54:37 +01:00
Adphi f2d7ff4c14 increment version 2020-01-30 22:05:35 +01:00
Adphi 93e4701a82 v0.0.5 2020-01-26 15:59:19 +01:00
Adphi e03bd71092 fix app compliance 2020-01-26 15:38:26 +01:00
Adphi a9019903cf added version 16 to info.xml 2019-06-04 19:43:58 +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 cee4b7a7e1 fix website url in info.xml 2019-01-21 18:24:52 +01:00
Adphi 42ccc2e7e5 improved app infos, add website 2019-01-21 18:22:46 +01:00
Adphi 1831886e20 improved app infos, fix app category 2019-01-21 18:17:23 +01:00
Adphi 83ed35c4c5 Fix Controllers Files names 2019-01-19 17:20:07 +01:00