Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
php-versions: ['8.1']
databases: ['sqlite', 'mysql', 'pgsql']
server-versions: ['stable31']
richdocuments-versions: ['stable31']
primary-storage: ['local', 'minio']

name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}-${{ matrix.primary-storage}}
Expand Down Expand Up @@ -74,6 +75,14 @@ jobs:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Checkout app (richdocuments)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/richdocuments
repository: nextcloud/richdocuments
ref: ${{ matrix.richdocuments-versions }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
Expand All @@ -91,6 +100,14 @@ jobs:
working-directory: apps/${{ env.APP_NAME }}
run: composer i --no-dev

- name: Set up behat dependencies
working-directory: apps/${{ env.APP_NAME }}/tests/Integration
run: composer i

- name: Set up dependencies (richdocuments)
working-directory: apps/richdocuments
run: composer i --no-dev

- name: Set up Nextcloud for S3 primary storage
if: matrix.primary-storage == 'minio'
run: |
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/phpunit-mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,23 @@ jobs:
matrix:
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
mariadb-versions: ['10.6', '10.11']
mariadb-versions: ['10.6', '11.4']
richdocuments-versions: ['main']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
richdocuments-versions: ['main']
richdocuments-versions: ['stable31']


name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}

services:
mariadb:
image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest
image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest # zizmor: ignore[unpinned-images]
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
MARIADB_ROOT_PASSWORD: rootpassword
options: --health-cmd="mariadb-admin ping" --health-interval 5s --health-timeout 2s --health-retries 5

steps:
- name: Set app env
if: ${{ env.APP_NAME == '' }}
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
Expand All @@ -103,8 +105,16 @@ jobs:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Checkout app (richdocuments)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/richdocuments
repository: nextcloud/richdocuments
ref: ${{ matrix.richdocuments-versions }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
Expand Down Expand Up @@ -132,9 +142,13 @@ jobs:
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: |
composer remove nextcloud/ocp --dev
composer remove nextcloud/ocp --dev --no-scripts
composer i

- name: Set up dependencies (richdocuments)
working-directory: apps/richdocuments
run: composer i --no-dev

- name: Set up Nextcloud
env:
DB_PORT: 4444
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/phpunit-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
with:
matrix: '{"mysql-versions": ["8.4"]}'
matrix: '{"mysql-versions": ["8.4"], "richdocuments-versions": ["stable31"]}'

changes:
runs-on: ubuntu-latest-low
Expand Down Expand Up @@ -101,6 +101,14 @@ jobs:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Checkout app (richdocuments)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/richdocuments
repository: nextcloud/richdocuments
ref: ${{ matrix.richdocuments-versions }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
Expand Down Expand Up @@ -133,6 +141,10 @@ jobs:
composer remove nextcloud/ocp --dev
composer i

- name: Set up dependencies (richdocuments)
working-directory: apps/richdocuments
run: composer i --no-dev

- name: Set up Nextcloud
env:
DB_PORT: 4444
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/phpunit-oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
matrix:
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
richdocuments-versions: ['stable31']

name: OCI PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}

Expand Down Expand Up @@ -114,6 +115,14 @@ jobs:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Checkout app (richdocuments)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/richdocuments
repository: nextcloud/richdocuments
ref: ${{ matrix.richdocuments-versions }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
Expand Down Expand Up @@ -141,6 +150,10 @@ jobs:
composer remove nextcloud/ocp --dev
composer i

- name: Set up dependencies (richdocuments)
working-directory: apps/richdocuments
run: composer i --no-dev

- name: Set up Nextcloud
env:
DB_PORT: 1521
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/phpunit-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
matrix:
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
richdocuments-versions: ['stable31']

name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}

Expand Down Expand Up @@ -104,6 +105,14 @@ jobs:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Checkout app (richdocuments)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/richdocuments
repository: nextcloud/richdocuments
ref: ${{ matrix.richdocuments-versions }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
Expand Down Expand Up @@ -131,6 +140,10 @@ jobs:
composer remove nextcloud/ocp --dev
composer i

- name: Set up dependencies (richdocuments)
working-directory: apps/richdocuments
run: composer i --no-dev

- name: Set up Nextcloud
env:
DB_PORT: 4444
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/phpunit-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
matrix:
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
richdocuments-versions: ['stable31']

name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}

Expand All @@ -93,6 +94,14 @@ jobs:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Checkout app (richdocuments)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: apps/richdocuments
repository: nextcloud/richdocuments
ref: ${{ matrix.richdocuments-versions }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
Expand Down Expand Up @@ -120,6 +129,10 @@ jobs:
composer remove nextcloud/ocp --dev
composer i

- name: Set up dependencies (richdocuments)
working-directory: apps/richdocuments
run: composer i --no-dev

- name: Set up Nextcloud
env:
DB_PORT: 4444
Expand Down
4 changes: 3 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage\IStorage;
use OCP\Util;
use OCP\WorkflowEngine\Events\RegisterOperationsEvent;
Expand All @@ -40,13 +41,14 @@ public function addStorageWrapper(): void {
* @param IStorage $storage
* @return StorageWrapper|IStorage
*/
public function addStorageWrapperCallback($mountPoint, IStorage $storage) {
public function addStorageWrapperCallback($mountPoint, IStorage $storage, IMountPoint $mount) {
if (!OC::$CLI && $mountPoint !== '/') {
/** @var Operation $operation */
$operation = $this->getContainer()->get(Operation::class);
return new StorageWrapper([
'storage' => $storage,
'mountPoint' => $mountPoint,
'mount' => $mount,
'operation' => $operation,
]);
}
Expand Down
15 changes: 13 additions & 2 deletions lib/CacheWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@
namespace OCA\FilesAccessControl;

use OC\Files\Cache\Wrapper\CacheWrapper as Wrapper;
use OC\Files\Storage\Wrapper\Jail;
use OCP\Constants;
use OCP\Files\Cache\ICache;
use OCP\Files\ForbiddenException;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage\IStorage;

class CacheWrapper extends Wrapper {
protected readonly int $mask;
protected readonly ?IStorage $storage;

public function __construct(
ICache $cache,
protected readonly IStorage $storage,
protected readonly IMountPoint $mountPoint,
protected readonly Operation $operation,
) {
parent::__construct($cache);
$this->storage = $mountPoint->getStorage();
$this->mask = Constants::PERMISSION_ALL
& ~Constants::PERMISSION_READ
& ~Constants::PERMISSION_CREATE
Expand All @@ -33,7 +37,14 @@ public function __construct(
protected function formatCacheEntry($entry) {
if (isset($entry['path']) && isset($entry['permissions'])) {
try {
$this->operation->checkFileAccess($this->storage, $entry['path'], $entry['mimetype'] === 'httpd/unix-directory', $entry);
$storage = $this->storage;
$path = $entry['path'];
if ($storage?->instanceOfStorage(Jail::class)) {
/** @var Jail $storage */
$jailedPath = $storage->getJailedPath($path);
$path = $jailedPath ?? $path;
}
$this->operation->checkFileAccess($path, $this->mountPoint, $entry['mimetype'] === 'httpd/unix-directory', $entry);
} catch (ForbiddenException) {
$entry['permissions'] &= $this->mask;
}
Expand Down
Loading