Skip to content

Commit 372d2aa

Browse files
authored
release(v3.6.0): Gateway Shares v2 + Automation APIs, MCP core seam, and runtime hardening
- pro(api): add managed gateway + MCP service/user/job endpoints and Automation wrappers via Domain services - mcp(core): add McpOpsContext + McpCoreOpsService seam with ACL-scoped operations and fast-list paging/cache path - api(refactor): centralize Pro endpoint guards/emit helpers and move gateway/automation orchestration into src/FileRise/Domain - runtime/security: add gnupg to Docker runtime image for managed rclone signature verification support - style/docs: targeted PSR-12 cleanup in new core seam files and docs refresh for Gateway Shares + Automation
1 parent eb925c8 commit 372d2aa

98 files changed

Lines changed: 8339 additions & 1811 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,75 @@
11
# Changelog
22

3-
## Changes 02/26/2026 (v3.5.2)
3+
## Changes 03/02/2026 (v3.6.0)
44

5-
`release(v3.5.2): relax username validation + stdClass namespace fix`
5+
`release(v3.6.0): Gateway Shares v2 + Automation APIs, MCP core seam, and runtime hardening`
66

7-
**Commit message**
7+
**Commit message**
88

99
```text
10-
release(v3.5.2): relax username validation + stdClass namespace fix
10+
release(v3.6.0): Gateway Shares v2 + Automation APIs, MCP core seam, and runtime hardening
1111
12-
- users(core): allow dots/@ in usernames and block "." / ".." to prevent path-like edge cases
13-
- php(core): namespace stdClass return to \stdClass for consistency under FileRise\Domain
14-
- admin: update sponsor list (add Stefan)
12+
- pro(api): add managed gateway + MCP service/user/job endpoints and Automation wrappers via Domain services
13+
- mcp(core): add McpOpsContext + McpCoreOpsService seam with ACL-scoped operations and fast-list paging/cache path
14+
- api(refactor): centralize Pro endpoint guards/emit helpers and move gateway/automation orchestration into src/FileRise/Domain
15+
- runtime/security: add gnupg to Docker runtime image for managed rclone signature verification support
16+
- style/docs: targeted PSR-12 cleanup in new core seam files and docs refresh for Gateway Shares + Automation
1517
```
1618

17-
**Changed**
18-
19-
- **Username validation**
20-
- Updated `REGEX_USER` to allow `.` and `@` in usernames (and spaces/underscores/dashes as before).
21-
- Added a negative lookahead to reject `.` and `..` as standalone usernames.
22-
- **PHP namespace correctness**
23-
- `UserModel::getUserPermissions()` now returns `\stdClass` (global) instead of `stdClass` to avoid namespace resolution issues under `FileRise\Domain`.
24-
- **Admin sponsor page**
25-
- Added “Stefan” to the sponsors list in `public/js/adminSponsor.js`.
19+
**Added**
20+
21+
- **Gateway Shares v2 + MCP API surface (Core integration for Pro)**
22+
- Added managed runtime endpoints:
23+
- `/api/pro/gateways/managed/status.php`
24+
- `/api/pro/gateways/managed/action.php`
25+
- `/api/pro/gateways/managed/rcloneInstall.php`
26+
- `/api/pro/gateways/managed/rcloneCheck.php`
27+
- `/api/pro/gateways/managed/rcloneUpload.php`
28+
- Added MCP service/user/job endpoints:
29+
- `/api/pro/gateways/mcp/service/{status,action}.php`
30+
- `/api/pro/gateways/mcp/users/{list,save,delete}.php`
31+
- `/api/pro/gateways/jobs/{cleanup,autotag}.php`
32+
- **Automation API surface (Core integration for Pro)**
33+
- Added endpoint wrappers under:
34+
- `/api/pro/automation/webhooks/*`
35+
- `/api/pro/automation/jobs/*`
36+
- `/api/pro/automation/worker/*`
37+
- `/api/pro/automation/scans/*`
38+
- `/api/pro/automation/security/*`
39+
- `/api/pro/automation/metrics.php`
40+
- **Core service seam for Pro orchestration**
41+
- Added:
42+
- `src/FileRise/Domain/ProGatewayApiService.php`
43+
- `src/FileRise/Domain/ProAutomationApiService.php`
44+
- `src/FileRise/Domain/McpOpsContext.php`
45+
- `src/FileRise/Domain/McpCoreOpsService.php`
46+
- Added shared helpers:
47+
- `public/api/pro/_common.php`
48+
- `public/api/pro/gateways/_common.php`
49+
- `public/api/pro/automation/_common.php`
50+
51+
**Changed**
52+
53+
- **Gateway admin UX**
54+
- Gateway Shares now includes Shares/MCP tabs with managed status/actions, logs, rclone install/update/upload controls, and job queue actions.
55+
- MCP tab now includes `AI Integration Templates` with copy/download snippets for OpenAI, Claude, Gemini, and direct curl testing.
56+
- **Runtime image prerequisites**
57+
- Added `gnupg` to `Dockerfile` package install list to support managed rclone signature verification in container deployments.
58+
- **Version hint alignment**
59+
- Updated admin latest Pro bundle UI hint to `v1.9.0`.
60+
61+
**Fixed**
62+
63+
- **Core bootstrap/order and API guard regressions**
64+
- Fixed Pro API bootstrap ordering edge cases around `PROJECT_ROOT`/shared guard bootstrap usage.
65+
- **Gateway admin runtime regressions**
66+
- Fixed managed gateway admin UI helper scope issues (`setManagedStatus`/`setManagedLog`).
67+
- **Style/lint**
68+
- Applied targeted PSR-12 declaration/brace/EOF fixes in newly added Core seam files.
69+
70+
**Docs**
71+
72+
- Updated admin/wiki docs for Gateway Shares v2 + Automation coverage.
2673

2774
---
2875

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ RUN if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then \
5353
apt-get install -y --no-install-recommends \
5454
apache2 \
5555
php php-json php-curl php-zip php-mbstring php-gd php-xml \
56-
ca-certificates curl openssl \
56+
ca-certificates curl openssl gnupg \
5757
${extra_pkgs} \
5858
&& apt-get clean && rm -rf /var/lib/apt/lists/*
5959

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,25 @@ Built for homelabs, teams, and client portals that need fast browsing, strict AC
6666
- If the proxy strips the prefix, set `FR_BASE_PATH` or send `X-Forwarded-Prefix`
6767
- Explicit “Published URL” setting for proxy / firewall environments
6868
- Works with `X-Forwarded-*` headers and Kubernetes ingress setups
69-
- 👥 **Pro: user groups, client portals, global search, storage explorer & audit logs**
69+
- 👥 **Pro: user groups, client portals, global search, storage explorer & audit logs**
7070
Group-based ACLs, brandable client upload portals, **ACL-aware global search across files, folders, users, and permissions**, an ncdu-style storage explorer for identifying large folders/files and reclaiming disk space directly from the UI, and **Pro Audit Logs** (configurable activity logging with filters + CSV export for tracking key actions across web, WebDAV, shares, and portals).
71-
- 🌐 **Sources (Core + Pro adapters)**
71+
- ⚙️ **Pro: Automation (Webhooks + Jobs)**
72+
Send FileRise events to other apps/services using managed webhook endpoints with async delivery, retries, queue visibility, and job history from Admin.
73+
- 🌐 **Sources (Core + Pro adapters)**
7274
Turn FileRise into a storage hub by connecting multiple backends and switching between them in the UI:
7375
- **Core:** Multiple local roots (additional local paths)
7476
- **Core:** **WebDAV** sources (Nextcloud / ownCloud / FileRise)
7577
- **Pro:** **S3-compatible** (AWS S3 / MinIO / Wasabi / Backblaze B2 S3 / etc.)
7678
- **Pro:** **SMB/CIFS**, **SFTP**, **FTP**
7779
- **Pro:** **Google Drive**, **OneDrive**, **Dropbox**
7880
- Works with **dual-pane** so you can copy/move via drag & drop or toolbar actions **between sources**, with **per-source Trash**
79-
- 🔌 **Pro: Gateway Shares (SFTP / S3 / MCP)**
81+
- 🔌 **Pro: Gateway Shares v2 (SFTP / S3 / MCP)**
8082
Expose selected source roots through managed gateways for external clients and workflows:
83+
- Managed **start/stop/restart/status/log** controls from Admin
8184
- **SFTP gateway** for tools like FileZilla, WinSCP, and rclone
8285
- **S3 gateway** for S3-compatible clients and automation
83-
- **MCP gateway** for emerging AI/tool integrations
86+
- **Scoped MCP users/tokens** mapped to FileRise user + source/root scope
87+
- AI/tool integrations stay **ACL-scoped and auditable**
8488

8589
Full list of features: [Full Feature Wiki](https://github.com/error311/FileRise/wiki/Features)
8690

@@ -107,6 +111,7 @@ Full list of features: [Full Feature Wiki](https://github.com/error311/FileRise/
107111
- [Common env vars](https://github.com/error311/FileRise/wiki/Common-Env-Variables)
108112
- [Env vars (full reference)](https://github.com/error311/FileRise/wiki/Environment-Variables-Full-Reference)
109113
- [Admin Panel](https://github.com/error311/FileRise/wiki/Admin-Panel)
114+
- [Pro MCP AI quickstart](https://github.com/error311/FileRise/wiki/Pro-MCP-AI-Quickstart)
110115
- [ACL & permissions](https://github.com/error311/FileRise/wiki/ACL-and-Permissions)
111116
- [ACL recipes](https://github.com/error311/FileRise/wiki/ACL-Recipes)
112117
- [WebDAV (mount)](https://github.com/error311/FileRise/wiki/WebDAV)

config/config.php

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ function decryptData($encryptedData, $encryptionKey)
199199
} else {
200200
$encryptionKey = $envKey;
201201
}
202+
// Ensure encryption key is always available via $GLOBALS, even when this file
203+
// is required from function scope (e.g. API helper bootstrap wrappers).
204+
$GLOBALS['encryptionKey'] = $encryptionKey;
202205

203206
// Optional: ignore regex for indexing/listing (env wins; admin config as fallback)
204207
if (!defined('FR_IGNORE_REGEX')) {
@@ -528,7 +531,9 @@ function fr_read_admin_config_raw(): array
528531
if (!is_file($configFile)) return [];
529532
$encryptedContent = @file_get_contents($configFile);
530533
if (!is_string($encryptedContent) || $encryptedContent === '') return [];
531-
$dec = decryptData($encryptedContent, $GLOBALS['encryptionKey']);
534+
$key = isset($GLOBALS['encryptionKey']) ? (string)$GLOBALS['encryptionKey'] : '';
535+
if ($key === '') return [];
536+
$dec = decryptData($encryptedContent, $key);
532537
if ($dec === false) return [];
533538
$cfg = json_decode($dec, true);
534539
return is_array($cfg) ? $cfg : [];
@@ -593,6 +598,55 @@ function fr_read_admin_config_raw(): array
593598
define('FR_PRO_BUNDLE_DIR', $proDir);
594599
}
595600

601+
// Optional core event-bus seam for guarded Pro registration.
602+
if (!function_exists('fr_eventbus_register')) {
603+
function fr_eventbus_register(callable $listener): void
604+
{
605+
if (!class_exists(\FileRise\Support\EventBus::class)) {
606+
return;
607+
}
608+
\FileRise\Support\EventBus::register($listener);
609+
}
610+
}
611+
612+
// Guarded Core MCP ops seam for Pro runtimes.
613+
if (!function_exists('fr_mcp_core_ops_dispatch')) {
614+
function fr_mcp_core_ops_dispatch(string $operation, array $payload = [], array $authContext = []): array
615+
{
616+
if (!class_exists(\FileRise\Domain\McpCoreOpsService::class)) {
617+
return [
618+
'ok' => false,
619+
'error' => 'Core MCP ops service unavailable.',
620+
'status' => 500,
621+
];
622+
}
623+
return \FileRise\Domain\McpCoreOpsService::dispatch($operation, $payload, $authContext);
624+
}
625+
}
626+
627+
// ------------------------------------------------------------
628+
// Early Pro/Core API-level guards for bootstrap-time calls
629+
// ------------------------------------------------------------
630+
if (!defined('FR_PRO_API_REQUIRE_DISK_USAGE')) {
631+
define('FR_PRO_API_REQUIRE_DISK_USAGE', 2);
632+
}
633+
if (!defined('FR_PRO_API_REQUIRE_SEARCH')) {
634+
define('FR_PRO_API_REQUIRE_SEARCH', 3);
635+
}
636+
if (!defined('FR_PRO_API_REQUIRE_AUDIT')) {
637+
define('FR_PRO_API_REQUIRE_AUDIT', 4);
638+
}
639+
if (!defined('FR_PRO_API_REQUIRE_SOURCES')) {
640+
define('FR_PRO_API_REQUIRE_SOURCES', 5);
641+
}
642+
if (!function_exists('fr_pro_api_level_at_least')) {
643+
function fr_pro_api_level_at_least(int $required): bool
644+
{
645+
$current = defined('FR_PRO_API_LEVEL') ? (int)FR_PRO_API_LEVEL : 0;
646+
return $current >= $required;
647+
}
648+
}
649+
596650
// Try to load Pro bootstrap if enabled + present
597651
$proBootstrap = FR_PRO_BUNDLE_DIR . '/bootstrap_pro.php';
598652
if (@is_file($proBootstrap)) {

docs/wiki/Admin-Panel.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,23 @@ The Admin Panel is where you manage users, folder access, authentication, integr
7676
- Enable Sources, add/edit/test connections, set source read-only, and optionally bypass trash (permanent delete).
7777
- See [Pro Sources](https://github.com/error311/FileRise/wiki/Pro-Sources) for details.
7878

79-
### Pro Features
79+
### Gateway Shares
8080

81-
- **Search Everywhere**: enable/disable and default limit (env-locked when set).
82-
- **Audit logs**: enable, level, and size caps.
81+
- Build and manage SFTP/S3/MCP gateway records.
82+
- Managed runtime controls are available in-panel (start/stop/restart, logs, autostart, rclone install/update checks).
83+
- Includes MCP service/user/job tooling and AI starter template generation in the MCP tab.
84+
- See [Pro gateway shares](https://github.com/error311/FileRise/wiki/Pro-Gateway-Shares) for full setup and runtime details.
85+
86+
### Automation
87+
88+
- **Webhooks tab**: endpoint CRUD, event filters, test sends, recent delivery history, and webhook security controls (global enable, allowlist, hard public-target mode).
89+
- **Jobs tab**: queue ClamAV scans, start worker, set recurring scan interval override, filter/inspect/retry/cancel jobs, and cleanup history/worker heartbeats.
90+
- See [Pro automation](https://github.com/error311/FileRise/wiki/Pro-Automation) for flow details and operator guidance.
91+
92+
### Search Everywhere & Audit Logging
93+
94+
- **Search Everywhere**: enable/disable and default result limit (env-locked when set).
95+
- **Audit logging**: enable/disable, level, and rotation caps; includes activity history view + CSV export.
8396

8497
### FileRise Pro
8598

docs/wiki/Pro-Automation.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Pro Automation
2+
3+
Automation in FileRise Pro provides two connected capabilities:
4+
5+
- **Webhooks** for outbound event delivery.
6+
- **Async jobs** for background processing and retries.
7+
8+
You manage both from **Admin Panel -> Automation**.
9+
10+
## Webhooks tab
11+
12+
The Webhooks tab lets you:
13+
14+
- Create and edit webhook endpoints (name, URL, secret, timeout, retry attempts, enabled flag).
15+
- Choose event filters (for example `file.uploaded`, `file.deleted`, `share.created`, `job.failed`).
16+
- Queue a test delivery for an endpoint.
17+
- Review recent deliveries (status code, duration, error snippet).
18+
19+
Security controls are also in this tab:
20+
21+
- Global webhook enable/disable.
22+
- Host allowlist enforcement (exact host and `*.example.com` wildcard support).
23+
- Force-public-target mode to block private/local targets globally.
24+
25+
## Jobs tab
26+
27+
The Jobs tab lets you:
28+
29+
- Queue a ClamAV scan job by source/folder.
30+
- Start the automation worker.
31+
- Set or unset recurring scan interval override.
32+
- Filter jobs by status (`queued`, `running`, `succeeded`, `dead`, `canceled`).
33+
- View job details and retry/cancel jobs.
34+
- Cleanup old finished jobs, logs, delivery records, and stale worker heartbeat entries.
35+
36+
## How it works
37+
38+
- Webhook events are queued as jobs and delivered asynchronously.
39+
- Failed deliveries are retried based on endpoint max-attempt settings.
40+
- Worker heartbeat and queue metrics are surfaced in the Admin panel so you can monitor backlog and health.
41+
42+
## Operational notes
43+
44+
- Keep webhook allowlist enabled unless you explicitly need broad outbound targets.
45+
- Use endpoint secrets so receivers can verify signatures.
46+
- For large environments, monitor queued/running counts and cleanup history regularly.
47+
48+
## Related
49+
50+
- /docs/?page=admin-panel
51+
- /docs/?page=pro-gateway-shares

0 commit comments

Comments
 (0)