From ceb94fb5a677563dc3257fa74518e4b3cf8efe01 Mon Sep 17 00:00:00 2001 From: Antoon Prins Date: Tue, 18 Jun 2024 16:18:04 +0200 Subject: [PATCH] Add integration tests. --- .github/workflows/integration-tests.yml | 24 + appinfo/info.xml | 2 +- appinfo/routes.php | 5 +- lib/AppInfo/Application.php | 2 + lib/Controller/InvitationController.php | 41 +- lib/Federation/InvitationMapper.php | 17 +- lib/Service/InvitationService.php | 16 +- .../MeshRegistry/MeshRegistryService.php | 503 +++++++++++++ tests/docker/.env | 3 + tests/docker/docker-compose-github.yaml | 92 +++ tests/docker/docker-compose-local.yaml | 92 +++ tests/docker/integration-tests/Dockerfile | 25 + .../integration-tests/OcsController.php | 34 + .../Version20240209130007.php | 124 +++ .../integration-tests/src/composer.json | 29 + .../docker/integration-tests/src/phpunit.xml | 7 + .../integration-tests/src/tests/bootstrap.php | 7 + .../InvitationServiceProviderTest.xxx | 77 ++ .../src/tests/integration/InvitationTest.php | 88 +++ .../src/tests/util/AppError.php | 102 +++ .../src/tests/util/HttpClient.php | 129 ++++ .../integration-tests/src/tests/util/Util.php | 45 ++ .../src/tests/util/fail-formatted.txt | 701 +++++++++++++++++ .../integration-tests/src/tests/util/fail.txt | 1 + .../src/tests/util/success-formatted.txt | 703 ++++++++++++++++++ .../src/tests/util/success.txt | 1 + tests/docker/integration-tests/tests.sh | 16 + tests/docker/nc-1/Dockerfile-github | 30 + tests/docker/nc-1/Dockerfile-local | 27 + tests/docker/nc-1/before-starting.sh | 23 + tests/docker/nc-1/nc-1.nl/certs/cert.pem | 19 + tests/docker/nc-1/nc-1.nl/certs/key.pem | 27 + .../docker/nc-1/nc-1.nl/nc-1-nginx-proxy.conf | 53 ++ tests/docker/nginx-proxy/Dockerfile | 4 + 34 files changed, 3031 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/integration-tests.yml create mode 100644 lib/Service/MeshRegistry/MeshRegistryService.php create mode 100644 tests/docker/.env create mode 100644 tests/docker/docker-compose-github.yaml create mode 100644 tests/docker/docker-compose-local.yaml create mode 100644 tests/docker/integration-tests/Dockerfile create mode 100644 tests/docker/integration-tests/OcsController.php create mode 100644 tests/docker/integration-tests/Version20240209130007.php create mode 100644 tests/docker/integration-tests/src/composer.json create mode 100644 tests/docker/integration-tests/src/phpunit.xml create mode 100644 tests/docker/integration-tests/src/tests/bootstrap.php create mode 100644 tests/docker/integration-tests/src/tests/integration/InvitationServiceProviderTest.xxx create mode 100644 tests/docker/integration-tests/src/tests/integration/InvitationTest.php create mode 100644 tests/docker/integration-tests/src/tests/util/AppError.php create mode 100644 tests/docker/integration-tests/src/tests/util/HttpClient.php create mode 100644 tests/docker/integration-tests/src/tests/util/Util.php create mode 100644 tests/docker/integration-tests/src/tests/util/fail-formatted.txt create mode 100644 tests/docker/integration-tests/src/tests/util/fail.txt create mode 100644 tests/docker/integration-tests/src/tests/util/success-formatted.txt create mode 100644 tests/docker/integration-tests/src/tests/util/success.txt create mode 100644 tests/docker/integration-tests/tests.sh create mode 100644 tests/docker/nc-1/Dockerfile-github create mode 100644 tests/docker/nc-1/Dockerfile-local create mode 100644 tests/docker/nc-1/before-starting.sh create mode 100644 tests/docker/nc-1/nc-1.nl/certs/cert.pem create mode 100644 tests/docker/nc-1/nc-1.nl/certs/key.pem create mode 100644 tests/docker/nc-1/nc-1.nl/nc-1-nginx-proxy.conf create mode 100644 tests/docker/nginx-proxy/Dockerfile diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 0000000..2122c1a --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,24 @@ +name: PHPUnit + +on: [push] + +jobs: + integration-tests: + runs-on: + ubuntu-latest + env: + # the current branch + BRANCH: ${{ github.ref_name }} + + steps: + - name: Checkout + # not compatible with actions/checkout@v4 + uses: actions/checkout@v3 + + # the docker compose setup + - name: docker-compose-setup + uses: cloudposse/github-action-docker-compose-test-run@main + with: + file: tests/docker/docker-compose-github.yaml + service: integration-tests + command: /tmp/tests/tests.sh diff --git a/appinfo/info.xml b/appinfo/info.xml index 70cdf16..e97a69c 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -16,7 +16,7 @@ integration https://github.com/sara-nl/nc-invitation/issues - + diff --git a/appinfo/routes.php b/appinfo/routes.php index 64d05f7..02cb425 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -28,9 +28,12 @@ 'note' => ['url' => '/notes'], 'note_api' => ['url' => '/api/0.1/notes'] ], + 'ocs' => [ + ['root' => '/invitation', 'name' => 'ocs#find_by_token', 'url' => '/invitations/{token}', 'verb' => 'GET'], + ], 'routes' => [ // bespoke API - invitation - ['name' => 'invitation#index', 'url' => '/index', 'verb' => 'GET'], + // ['name' => 'invitation#index', 'url' => '/index', 'verb' => 'GET'], ['name' => 'invitation#find_by_token', 'url' => '/invitations/{token}', 'verb' => 'GET'], ['name' => 'invitation#find', 'url' => '/invitations', 'verb' => 'GET'], diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index f712e52..19bed00 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -16,6 +16,8 @@ class Application extends App implements IBootstrap { public const APP_ID = 'invitation'; + public const CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY = 'allow_sharing_with_invited_users_only'; + public function __construct() { parent::__construct(self::APP_ID); diff --git a/lib/Controller/InvitationController.php b/lib/Controller/InvitationController.php index 0d98ba6..b0bb0b1 100644 --- a/lib/Controller/InvitationController.php +++ b/lib/Controller/InvitationController.php @@ -8,8 +8,8 @@ namespace OCA\Invitation\Controller; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; use OCA\Invitation\AppInfo\AppError; +use OCA\Invitation\AppInfo\Application; use OCA\Invitation\Db\Schema; use OCA\Invitation\Federation\Invitation; use OCA\Invitation\Service\InvitationService; @@ -18,7 +18,6 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; -use OCP\AppFramework\Http\TemplateResponse; use OCP\ILogger; use OCP\IRequest; use Psr\Log\LoggerInterface; @@ -33,21 +32,21 @@ public function __construct( InvitationService $service, LoggerInterface $logger ) { - parent::__construct(InvitationApp::APP_NAME, $request); + parent::__construct(Application::APP_ID, $request); $this->service = $service; $this->logger = $logger; } - /** - * - * @NoAdminRequired - * @NoCSRFRequired - * @return TemplateResponse - */ - public function index(): TemplateResponse - { - return new TemplateResponse($this->appName, 'invitation.index'); - } + // /** + // * + // * @NoAdminRequired + // * @NoCSRFRequired + // * @return TemplateResponse + // */ + // public function index(): TemplateResponse + // { + // return new TemplateResponse($this->appName, 'invitation.main'); + // } /** * Removes the notification that is associated with the invitation with specified token. @@ -62,12 +61,12 @@ private function removeInvitationNotification(string $token): void $manager = \OC::$server->getNotificationManager(); $notification = $manager->createNotification(); $notification - ->setApp(InvitationApp::APP_NAME) + ->setApp(Application::APP_ID) ->setUser(\OC::$server->getUserSession()->getUser()->getUID()) ->setObject(MeshRegistryService::PARAM_NAME_TOKEN, $token); $manager->markProcessed($notification); } catch (Exception $e) { - $this->logger->error('Remove notification failed: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Remove notification failed: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw $e; } } @@ -98,6 +97,7 @@ private function verifiedInviteAcceptedResponse(array $response): bool /** * example url: https://rd-1.nl/apps/invitation/invitations?status=open,accepted * + * @PublicPage * @NoAdminRequired * @NoCSRFRequired */ @@ -111,7 +111,7 @@ public function find(string $status = null): DataResponse } if (empty($fieldsAndValues)) { - $this->logger->error("findAll() - missing query parameter.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("findAll() - missing query parameter.", ['app' => Application::APP_ID]); return new DataResponse( [ 'success' => false, @@ -130,7 +130,7 @@ public function find(string $status = null): DataResponse Http::STATUS_OK ); } catch (Exception $e) { - $this->logger->error('invitations not found for fields: ' . print_r($status, true) . 'Error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('invitations not found for fields: ' . print_r($status, true) . 'Error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); return new DataResponse( [ 'success' => false, @@ -143,12 +143,13 @@ public function find(string $status = null): DataResponse /** * + * @NoAdminRequired * @NoCSRFRequired */ public function findByToken(string $token = null): DataResponse { if (!isset($token)) { - $this->logger->error("findByToken() - missing parameter 'token'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("findByToken() - missing parameter 'token'.", ['app' => Application::APP_ID]); return new DataResponse( [ 'success' => false, @@ -167,7 +168,7 @@ public function findByToken(string $token = null): DataResponse Http::STATUS_OK, ); } catch (NotFoundException $e) { - $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); return new DataResponse( [ 'success' => false, @@ -176,7 +177,7 @@ public function findByToken(string $token = null): DataResponse Http::STATUS_NOT_FOUND, ); } catch (Exception $e) { - $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); return new DataResponse( [ 'success' => false, diff --git a/lib/Federation/InvitationMapper.php b/lib/Federation/InvitationMapper.php index 4ab1739..46e137c 100644 --- a/lib/Federation/InvitationMapper.php +++ b/lib/Federation/InvitationMapper.php @@ -3,7 +3,7 @@ namespace OCA\Invitation\Federation; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; +use OCA\Invitation\AppInfo\Application; use OCA\Invitation\Db\Schema; use OCA\Invitation\Federation\Invitation; use OCA\Invitation\Federation\VInvitation; @@ -55,15 +55,16 @@ public function findByToken(string $token) try { $qb = $this->db->getQueryBuilder(); $qb->automaticTablePrefix(false); - $result = $qb->select('*') + $qb->select('*') ->from(Schema::VIEW_INVITATIONS, 'i') - ->where($qb->expr()->eq('i.token', $qb->createNamedParameter($token))) - ->executeQuery()->fetch(); + ->where($qb->expr()->eq('i.token', $qb->createNamedParameter($token))); + $this->logger->debug($qb->getSQL(), ['app' => Application::APP_ID]); + $result = $qb->executeQuery()->fetch(); if (is_array($result) && count($result) > 0) { return $this->getVInvitation($result); } } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw new NotFoundException($e->getMessage()); } throw new NotFoundException("Invitation not found for token $token"); @@ -141,7 +142,7 @@ public function updateInvitation(array $fieldsAndValues, string $userCloudID = ' } } } catch (Exception $e) { - $this->logger->error('updateInvitation failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('updateInvitation failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); } return false; } @@ -162,7 +163,7 @@ public function deleteForStatus(array $statuses): void $qb->setParameter(Schema::INVITATION_STATUS, $statuses, IQueryBuilder::PARAM_STR_ARRAY); $qb->executeQuery(); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw new Exception('An error occurred trying to delete invitations.'); } } @@ -198,7 +199,7 @@ private function getVInvitation(array $associativeArray): VInvitation $invitation->setRemoteUserProviderName($associativeArray[Schema::VINVITATION_REMOTE_USER_PROVIDER_NAME]); return $invitation; } - $this->logger->error('Unable to create a new Invitation from associative array: ' . print_r($associativeArray, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Unable to create a new Invitation from associative array: ' . print_r($associativeArray, true), ['app' => Application::APP_ID]); return null; } diff --git a/lib/Service/InvitationService.php b/lib/Service/InvitationService.php index b331506..ffd8408 100644 --- a/lib/Service/InvitationService.php +++ b/lib/Service/InvitationService.php @@ -3,7 +3,7 @@ namespace OCA\Invitation\Service; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; +use OCA\Invitation\AppInfo\Application; use OCA\Invitation\Db\Schema; use OCA\Invitation\Federation\Invitation; use OCA\Invitation\Federation\InvitationMapper; @@ -42,13 +42,13 @@ public function find(int $id): VInvitation if ($this->userSession->getUser()->getCloudId() === $invitation->getUserCloudID()) { return $invitation; } - $this->logger->debug("User with cloud id '" . $this->userSession->getUser()->getCloudId() . "' is not authorized to access invitation with id '$id'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->debug("User with cloud id '" . $this->userSession->getUser()->getCloudId() . "' is not authorized to access invitation with id '$id'.", ['app' => Application::APP_ID]); throw new NotFoundException("Invitation with id=$id not found."); } catch (NotFoundException $e) { - $this->logger->debug($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->debug($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw new NotFoundException("Invitation with id=$id not found."); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw new NotFoundException("Invitation with id=$id not found."); } } @@ -68,7 +68,7 @@ public function findByToken(string $token, bool $loginRequired = true): VInvitat try { $invitation = $this->mapper->findByToken($token); } catch (NotFoundException $e) { - $this->logger->error("Invitation not found for token '$token'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Invitation not found for token '$token'.", ['app' => Application::APP_ID]); throw new NotFoundException("An exception occurred trying to retrieve the invitation with token '$token'."); } if ($loginRequired == true && $this->userSession->getUser() == null) { @@ -95,7 +95,7 @@ public function findAll(array $criteria): array try { return $this->mapper->findAll($criteria); } catch (Exception $e) { - $this->logger->error('findAll failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('findAll failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw new ServiceException('Failed to find all invitations for the specified criteria.'); } } @@ -112,7 +112,7 @@ public function insert(Invitation $invitation): Invitation try { return $this->mapper->insert($invitation); } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); throw new ServiceException('Error inserting the invitation.'); } } @@ -128,7 +128,7 @@ public function update(array $fieldsAndValues, bool $loginRequired = true): bool { if ($loginRequired === true) { if ($this->userSession->getUser() == null) { - $this->logger->debug('Unable to update invitation, unauthenticated.', ['app' => InvitationApp::APP_NAME]); + $this->logger->debug('Unable to update invitation, unauthenticated.', ['app' => Application::APP_ID]); return false; } return $this->mapper->updateInvitation($fieldsAndValues, $this->userSession->getUser()->getCloudId()); diff --git a/lib/Service/MeshRegistry/MeshRegistryService.php b/lib/Service/MeshRegistry/MeshRegistryService.php new file mode 100644 index 0000000..a891ad1 --- /dev/null +++ b/lib/Service/MeshRegistry/MeshRegistryService.php @@ -0,0 +1,503 @@ +appName = $appName; + $this->config = $config; + $this->invitationServiceProviderMapper = $invitationServiceProviderMapper; + $this->logger = \OC::$server->getLogger(); + } + + /** + * Returns the full 'https://{invitation_service_provider}/forward-invite' endpoint of this EFSS instance + * + * @return string + * @throws ServiceException + */ + public function getFullForwardInviteEndpoint() + { + try { + $invitationServiceEndpoint = $this->getEndpoint(); + $forwardInviteEndpoint = trim(self::ENDPOINT_FORWARD_INVITE, "/"); + return "$invitationServiceEndpoint/$forwardInviteEndpoint"; + } catch (ServiceException $e) { + $this->logger->error("getFullForwardInviteEndpoint failed with error: " . $e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException("Could not retrieve full '/forward-invite' endpoint."); + } + } + + /** + * + * @return string + */ + public function getWayfPageRoute(): string + { + $appName = $this->appName; + $wayfPageEndpoint = self::ROUTE_PAGE_WAYF; + return "$appName.$wayfPageEndpoint"; + } + + /** + * Returns the full 'https://{invitation_service_provider}/accept-invite' endpoint URL of this EFSS instance. + * + * @return string the full /accept-invite endpoint URL + */ + public function getFullAcceptInviteEndpointURL(): string + { + try { + $invitationServiceEndpoint = $this->getEndpoint(); + $acceptInviteEndpoint = trim(self::ENDPOINT_ACCEPT_INVITE, "/"); + return "$invitationServiceEndpoint/$acceptInviteEndpoint"; + } catch (ServiceException $e) { + $this->logger->error("getFullAcceptInviteEndpointURL failed with error: " . $e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException("Could not retrieve full '/accept-invite' endpoint."); + } + } + + /** + * Returns the full 'https://{invitation_service_provider}/invite-accepted' endpoint URL of this EFSS instance. + * + * @param string $senderHost the host of the sender of the invitation + * @return string the full /invite-accepted endpoint URL + */ + public function getFullInviteAcceptedEndpointURL(string $senderInvitationServiceProviderEndpoint = ""): string + { + if ($senderInvitationServiceProviderEndpoint == "") { + return ['error' => "unable to build full '/invite-accepted' endpoint URL, sender invitation service provider endpoint not specified"]; + } + $endpoint = trim(trim($senderInvitationServiceProviderEndpoint), '/'); + $inviteAcceptedEndpoint = trim(trim(self::ENDPOINT_INVITE_ACCEPTED), "/"); + return "$endpoint/$inviteAcceptedEndpoint"; + } + + /** + * Returns the full invitation service provider url based on the specified host endpoint. + * + * @param string $endpoint + * @return string + */ + public function getFullInvitationServiceProviderEndpointUrl(string $endpoint): string + { + $ep = trim(trim($endpoint), '/'); + $ispEndpoint = trim(trim(self::ENDPOINT_INVITATION_SERVICE_PROVIDER), '/'); + return "$ep/$ispEndpoint"; + } + + /** + * Returns the invite link with the specified parameters. + * + * @param array the parameters to include in the link + * @return string the invite link + */ + public function inviteLink(array $params): string + { + // the forward invite endpoint + $forwardInviteEndpoint = $this->getFullForwardInviteEndpoint(); + + $parameters = ''; + foreach ($params as $key => $value) { + $parameters .= "&$key=$value"; + } + $parameters = trim($parameters, "&"); + + $inviteLink = "$forwardInviteEndpoint?$parameters"; + return $inviteLink; + } + + /** + * Returns the endpoint of the local (this instance's) invitation service provider. + * + * @return string the endpoint + * @throws ApplicationConfigurationException if the endpoint has not been set + */ + public function getEndpoint(): string + { + $endpoint = $this->getAppValue('endpoint'); + if (!isset($endpoint) || trim($endpoint) == "") { + throw new ApplicationConfigurationException('Endpoint is not set.'); + } + return $endpoint; + } + + /** + * Sets the endpoint of the local (this instance's) invitation service provider and returns the endpoint. + * + * @param string $endpoint + * @return string + * @throws ServiceException + */ + public function setEndpoint(string $endpoint): string + { + if (!$this->isEndpointValid($endpoint)) { + throw new ServiceException("Invalid endpoint '$endpoint'"); + } + + try { + $invitationServiceProvider = $this->getInvitationServiceProvider(); + $invitationServiceProvider->setEndpoint($endpoint); + $invitationServiceProvider = $this->invitationServiceProviderMapper->update($invitationServiceProvider); + } catch (NotFoundException $e) { + $this->logger->info("A local invitation service provider does not exist (yet). Setting the endpoint to '$endpoint'", ['app' => Application::APP_ID]); + } catch (Exception $e) { + $this->logger->error($e->getMessage() . ' Stack: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException("Unable to set the endpoint to '$endpoint'."); + } + $this->setAppValue('endpoint', $endpoint); + return $endpoint; + } + + /** + * Returns the invitation service provider of this instance. + * + * @return InvitationServiceProvider + * @throws ApplicationConfigurationException + * @throws NotFoundException + */ + public function getInvitationServiceProvider(): InvitationServiceProvider + { + try { + return $this->invitationServiceProviderMapper->getInvitationServiceProvider($this->getEndpoint()); + } catch (ApplicationConfigurationException $e) { + throw $e; + } catch (ServiceException $e) { + throw new NotFoundException($e->getMessage()); + } + } + + /** + * Find and returns the invitation service provider with the specified endpoint, + * or throws a NotFoundException if it could not be found. + * + * @param $endpoint + * @throws NotFoundException + */ + public function findInvitationServiceProvider(string $endpoint): InvitationServiceProvider + { + return $this->invitationServiceProviderMapper->getInvitationServiceProvider($endpoint); + } + + /** + * Adds the specified invitation service provider and returns it, also if it exists already. + * + * @param InvitationServiceProvider $provider + * @return InvitationServiceProvider + * @throws ServiceException in case of error + */ + public function addInvitationServiceProvider(InvitationServiceProvider $provider): InvitationServiceProvider + { + $invitationServiceProvider = null; + try { + $invitationServiceProvider = $this->findInvitationServiceProvider($provider->getEndpoint()); + } catch (NotFoundException $e) { + $this->logger->info("Creating invitation service provider with endpoint " . $provider->getEndpoint(), ['app' => Application::APP_ID]); + } + if (isset($invitationServiceProvider)) { + return $invitationServiceProvider; + } + try { + return $this->invitationServiceProviderMapper->insert($provider); + } catch (Exception $e) { + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException('Error inserting the invitation service provider.'); + } + } + + /** + * Updates the fields of invitation service provider with the specified endpoint or + * registers the provider if it is not registered yet. + * + * @param string endpoint the currently configured provider endpoint + * @param array $fields updates on current provider fields + * @return InvitationServiceProvider the updated provider + * @throws ServiceException + */ + public function updateInvitationServiceProvider($endpoint, $fields): InvitationServiceProvider + { + try { + $this->logger->debug(" updating: $endpoint with fields: " . print_r($fields, true)); + $invitationServiceProvider = null; + $newEndpoint = ""; + $newName = ""; + try { + $invitationServiceProvider = $this->invitationServiceProviderMapper->getInvitationServiceProvider($endpoint); + } catch (NotFoundException $e) { + // create it first, unless $endpoint is empty in which case we expect it to be in the fields + if (!empty($endpoint)) { + if (!$this->isEndpointValid($endpoint)) { + throw new ServiceException("Error updating invitation service provider. Endpoint invalid: $endpoint"); + } + $invitationServiceProvider = new InvitationServiceProvider(); + $invitationServiceProvider->setEndpoint($endpoint); + $invitationServiceProvider = $this->invitationServiceProviderMapper->insert($invitationServiceProvider); + $newEndpoint = $endpoint; + } else { + $this->logger->info("Registering this Invitation Service Provider to the registry."); + } + } + foreach ($fields as $field => $value) { + switch ($field) { + case Schema::INVITATION_SERVICE_PROVIDER_ENDPOINT: + if (is_string($value) == true) { + if (!$this->isEndpointValid($value)) { + throw new ServiceException("Error updating invitation service provider. Endpoint invalid: $value"); + } + $newEndpoint = $value; + } else { + $this->logger->debug("Value '$value' is of wrong type for property endpoint"); + } + break; + case Schema::INVITATION_SERVICE_PROVIDER_NAME: + if (is_string($value) == true) { + $newName = $value; + } else { + $this->logger->debug("Value '$value' is of wrong type for property name"); + } + break; + default: + $this->logger->debug("Field '$field' is not a property of entity InvitationServiceProvider"); + } + } + $domain = parse_url($newEndpoint)['host']; + if ($invitationServiceProvider == null) { + $invitationServiceProvider = new InvitationServiceProvider(); + $invitationServiceProvider->setEndpoint($newEndpoint); + $invitationServiceProvider->setName($newName); + $invitationServiceProvider->setDomain($domain); + $invitationServiceProvider = $this->invitationServiceProviderMapper->insert($invitationServiceProvider); + } else { + $invitationServiceProvider->setEndpoint($newEndpoint); + $invitationServiceProvider->setName($newName); + $invitationServiceProvider->setDomain($domain); + $invitationServiceProvider = $this->invitationServiceProviderMapper->update($invitationServiceProvider); + } + $this->setAppValue('endpoint', $newEndpoint); + return $invitationServiceProvider; + } catch (Exception $e) { + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException("Error updating invitation service provider with endpoint '$endpoint'"); + } + } + + /** + * Deletes the invitation service provider with the specified endpoint. + * + * @param $endpoint + * @return InvitationServiceProvider the deleted entity + * @throws ServiceException in case of error + */ + public function deleteInvitationServiceProvider(string $endpoint): InvitationServiceProvider + { + try { + $invitationServiceProvider = $this->invitationServiceProviderMapper->getInvitationServiceProvider($endpoint); + $deletedEntity = $this->invitationServiceProviderMapper->delete($invitationServiceProvider); + if ($endpoint === $this->getEndpoint()) { + $this->deleteAppValue('endpoint'); + } + return $deletedEntity; + } catch (NotFoundException $e) { + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException('Error deleting the invitation service provider: Not found.'); + } catch (Exception $e) { + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException('Error deleting the invitation service provider.'); + } + } + /** + * Very basic validation of the specified endpoint. + * Checks: + * - endpoint should be with https scheme + * - endpoint should not end with '/' + * + * @param string $endpoint + * @return bool true if the endpoint validates, false otherwise + */ + private function isEndpointValid(string $endpoint): bool + { + if (!isset($endpoint) || trim($endpoint) === "") { + return false; + } + $url = parse_url($endpoint); + if ( + $url === false + || !isset($url['scheme']) + || $url['scheme'] != 'https' + ) { + return false; + } + // check for some accidental characters left at beginning and end + if (strlen($endpoint) != strlen(trim($endpoint, ":/"))) { + return false; + } + return true; + } + + /** + * Returns all invitation service providers of the mesh. + * + * @return array[InvitationServiceProvider] all invitation service providers + * @throws ServiceException + */ + public function allInvitationServiceProviders(): array + { + try { + return $this->invitationServiceProviderMapper->allInvitationServiceProviders(); + } catch (NotFoundException $e) { + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException('Error retrieving all invitation service providers.'); + } + } + + /** + * Returns true if the specified endpoint is of a known invitation service provider + * + * @return bool + */ + public function isKnowInvitationServiceProvider(string $endpoint): bool + { + foreach ($this->allInvitationServiceProviders() as $invitationServiceProvider) { + if ($invitationServiceProvider->getEndpoint() === $endpoint) { + return true; + } + } + return false; + } + + /** + * Set the name associated with this invitation service provider instance. + * + * @param string $name + * @return string the new name + * @throws ServiceException + */ + public function setName(string $name): string + { + try { + $invitationServiceProvider = $this->getInvitationServiceProvider(); + $invitationServiceProvider->setName($name); + $invitationServiceProvider = $this->invitationServiceProviderMapper->update($invitationServiceProvider); + return $invitationServiceProvider->getName(); + } catch (NotFoundException $e) { + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException("Error updating invitation service provider: Not found"); + } catch (Exception $e) { + $this->logger->error($e->getMessage() . ' Stack: ' . $e->getTraceAsString(), ['app' => Application::APP_ID]); + throw new ServiceException("Could not set name to '$name'."); + } + } + + /** + * Get the name associated with this invitation service provider instance. + * + * @return string the name + * @throws ServiceException + */ + public function getName(): string + { + $invitationServiceProvider = $this->getInvitationServiceProvider(); + return $invitationServiceProvider->getName(); + } + + /** + * Set whether it is allowed to share with invited users only. + * + * @param bool $allowSharingWithInvitedUsersOnly + * @return bool the new value + */ + public function setAllowSharingWithInvitedUsersOnly(bool $allow): bool + { + $this->setAppValue(Application::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY, $allow ? 'yes' : 'no'); + return $this->getAppValue(Application::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY) === 'yes'; + } + + /** + * Returns whether it is allowed to share with invited users only. + * + * @return bool + */ + public function getAllowSharingWithInvitedUsersOnly(): bool + { + return strtolower($this->getAppValue(Application::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY)) === 'yes'; + } + + /** + * Returns the value of the specified application key. + * + * @param string $key + * @return mixed + */ + private function getAppValue($key) + { + return $this->config->getAppValue($this->appName, $key); + } + + /** + * Deletes the app config set for the specified key. + * + * @param string $key + * @return mixed + */ + private function deleteAppValue($key) + { + return $this->config->deleteAppValue($this->appName, $key); + } + + /** + * Sets the value of the specified application key. + + * @param string $key + * @param string $value + * @return void + */ + private function setAppValue($key, $value): void + { + $this->config->setAppValue($this->appName, $key, $value); + } +} diff --git a/tests/docker/.env b/tests/docker/.env new file mode 100644 index 0000000..56dddc1 --- /dev/null +++ b/tests/docker/.env @@ -0,0 +1,3 @@ +TEST_UUID_1=c33056f9-2abf-4a1c-98d3-b579b1db8e31 +TEST_UUID_2=5f23338a-b767-41e3-9233-1c1249444663 +ADMIN_PASS=passw \ No newline at end of file diff --git a/tests/docker/docker-compose-github.yaml b/tests/docker/docker-compose-github.yaml new file mode 100644 index 0000000..f4ffe9a --- /dev/null +++ b/tests/docker/docker-compose-github.yaml @@ -0,0 +1,92 @@ +version: '3.7' + +services: + integration-tests: + build: + context: . + dockerfile: integration-tests/Dockerfile + container_name: integration-tests + depends_on: + - nginx-proxy + environment: + - TEST_UUID_1=${TEST_UUID_1} + - TEST_UUID_2=${TEST_UUID_2} + - ADMIN_PASS=${ADMIN_PASS} + extra_hosts: + - 'nc-1.nl:10.1.0.160' # this will add this mapping to /etc/hosts + networks: + static-network: + ipv4_address: 10.1.0.190 + + # nexcloud nc-1 + nc-1: + build: + context: . + dockerfile: nc-1/Dockerfile-github + args: + - BRANCH=${BRANCH} + container_name: nc-1 + restart: unless-stopped + depends_on: + - mariadb-nc-1 + environment: + - TEST_UUID_1=${TEST_UUID_1} + - TEST_UUID_2=${TEST_UUID_2} + - ADMIN_PASS=${ADMIN_PASS} + extra_hosts: + - 'nc-1.nl:10.1.0.160' # this will add this mapping to /etc/hosts + volumes: + - files-nc-1:/mnt/data + networks: + static-network: + ipv4_address: 10.1.0.100 + + mariadb-nc-1: + image: mariadb:10.9 # minimum required ownCloud version is 10.9 + container_name: mariadb-nc-1 + restart: always + environment: + - MYSQL_ROOT_PASSWORD=nextcloud + - MYSQL_USER=nextcloud + - MYSQL_PASSWORD=nextcloud + - MYSQL_DATABASE=nextcloud + command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"] + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=nextcloud"] + interval: 10s + timeout: 5s + retries: 5 + volumes: + - mysql-nc-1:/var/lib/mysql + networks: + static-network: + ipv4_address: 10.1.0.110 + + # The reverse mesh proxy with TLS + nginx-proxy: + build: + context: . + dockerfile: nginx-proxy/Dockerfile + container_name: nginx-proxy + depends_on: + - nc-1 + ports: + - 80:80 + - 443:443 + networks: + static-network: + ipv4_address: 10.1.0.160 + +volumes: + files-nc-1: + driver: local + mysql-nc-1: + driver: local + +networks: + static-network: + driver: bridge + ipam: + driver: default + config: + - subnet: 10.1.0.0/24 \ No newline at end of file diff --git a/tests/docker/docker-compose-local.yaml b/tests/docker/docker-compose-local.yaml new file mode 100644 index 0000000..242bf30 --- /dev/null +++ b/tests/docker/docker-compose-local.yaml @@ -0,0 +1,92 @@ +version: '3.7' + +services: + integration-tests: + build: + context: . + dockerfile: integration-tests/Dockerfile + container_name: integration-tests + depends_on: + - nginx-proxy + environment: + - TEST_UUID_1=${TEST_UUID_1} + - TEST_UUID_2=${TEST_UUID_2} + - ADMIN_PASS=${ADMIN_PASS} + extra_hosts: + - 'nc-1.nl:10.1.0.160' # this will add this mapping to /etc/hosts + networks: + static-network: + ipv4_address: 10.1.0.190 + + # nexcloud nc-1 + nc-1: + build: + context: ../../ + dockerfile: tests/docker/nc-1/Dockerfile-local + container_name: nc-1 + restart: unless-stopped + depends_on: + - mariadb-nc-1 + environment: + - TEST_UUID_1=${TEST_UUID_1} + - TEST_UUID_2=${TEST_UUID_2} + - ADMIN_PASS=${ADMIN_PASS} + extra_hosts: + - 'nc-1.nl:10.1.0.160' # this will add this mapping to /etc/hosts + volumes: + - files-nc-1:/mnt/data + networks: + static-network: + ipv4_address: 10.1.0.100 + + mariadb-nc-1: + image: mariadb:10.9 # minimum required ownCloud version is 10.9 + container_name: mariadb-nc-1 + restart: always + environment: + - MYSQL_ROOT_PASSWORD=nextcloud + - MYSQL_USER=nextcloud + - MYSQL_PASSWORD=nextcloud + - MYSQL_DATABASE=nextcloud + command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"] + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=nextcloud"] + interval: 10s + timeout: 5s + retries: 5 + volumes: + - mysql-nc-1:/var/lib/mysql + networks: + static-network: + ipv4_address: 10.1.0.110 + + # The reverse mesh proxy with TLS + nginx-proxy: + build: + context: . + dockerfile: nginx-proxy/Dockerfile + container_name: nginx-proxy + volumes: + - ~/projects/nc-invitation/tests/docker/nc-1/nc-1.nl/certs:/etc/nginx/certs/nc-1 + depends_on: + - nc-1 + ports: + - 80:80 + - 443:443 + networks: + static-network: + ipv4_address: 10.1.0.160 + +volumes: + files-nc-1: + driver: local + mysql-nc-1: + driver: local + +networks: + static-network: + driver: bridge + ipam: + driver: default + config: + - subnet: 10.1.0.0/24 \ No newline at end of file diff --git a/tests/docker/integration-tests/Dockerfile b/tests/docker/integration-tests/Dockerfile new file mode 100644 index 0000000..e037e69 --- /dev/null +++ b/tests/docker/integration-tests/Dockerfile @@ -0,0 +1,25 @@ +FROM php:8.2-cli + +RUN apt update \ + && apt install -y curl + +COPY nc-1/nc-1.nl/certs/cert.pem /usr/share/ca-certificates/rd-mesh/nc-1.pem +RUN echo 'rd-mesh/nc-1.pem' >> /etc/ca-certificates.conf \ + && update-ca-certificates \ + && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt + +RUN mkdir -p /tmp/tests +COPY integration-tests/ /tmp/tests/ +RUN chmod u+r+x /tmp/tests/tests.sh + +RUN apt-get update && apt-get install -y \ + git \ + curl \ + zip \ + unzip + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +RUN cd /tmp/tests/src && composer install + +WORKDIR / diff --git a/tests/docker/integration-tests/OcsController.php b/tests/docker/integration-tests/OcsController.php new file mode 100644 index 0000000..ae7d9b8 --- /dev/null +++ b/tests/docker/integration-tests/OcsController.php @@ -0,0 +1,34 @@ +invitationController = $invitationController; + $this->logger = $logger; + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function findByToken(string $token = null): DataResponse + { + return $this->invitationController->findByToken($token); + } +} diff --git a/tests/docker/integration-tests/Version20240209130007.php b/tests/docker/integration-tests/Version20240209130007.php new file mode 100644 index 0000000..cafb175 --- /dev/null +++ b/tests/docker/integration-tests/Version20240209130007.php @@ -0,0 +1,124 @@ +dbc = $dbc; + $this->logger = $logger; + $this->accountManager = $accountManager; + $this->userManager = $userManager; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) + { + $prefix = $options['tablePrefix']; + + /** + * @var ISchemaWrapper $schema + */ + $schema = $schemaClosure(); + + print_r("Adding test data\n"); + + // update the email of the admin account; email is part of the data json property + $admin = $this->userManager->get("admin"); + $adminAccount = $this->accountManager->getAccount($admin); + $adminAccount->setProperty(AccountManager::PROPERTY_EMAIL, "admin@nc-1.nl", "v2-federated", "0"); + $this->accountManager->updateAccount($adminAccount); + + $qb = $this->dbc->getQueryBuilder(); + + // add this provider's endpoint + $qb->insert("appconfig")->values([ + 'appid' => $qb->createNamedParameter('invitation'), + 'configkey' => $qb->createNamedParameter('endpoint'), + 'configvalue' => $qb->createNamedParameter('https://nc-1.nl/apps/invitation'), + ]); + $qb->executeStatement(); + + // add invitation provider services + $qb->insert(Schema::TABLE_INVITATION_SERVICE_PROVIDERS)->values([ + Schema::INVITATION_SERVICE_PROVIDER_DOMAIN => $qb->createNamedParameter('nc-1.nl'), + Schema::INVITATION_SERVICE_PROVIDER_ENDPOINT => $qb->createNamedParameter('https://nc-1.nl/apps/invitation'), + Schema::INVITATION_SERVICE_PROVIDER_NAME => $qb->createNamedParameter('NC 1 University'), + ]); + $qb->executeStatement(); + $qb->insert(Schema::TABLE_INVITATION_SERVICE_PROVIDERS)->values([ + Schema::INVITATION_SERVICE_PROVIDER_DOMAIN => $qb->createNamedParameter('nc-2.nl'), + Schema::INVITATION_SERVICE_PROVIDER_ENDPOINT => $qb->createNamedParameter('https://nc-2.nl/apps/invitation'), + Schema::INVITATION_SERVICE_PROVIDER_NAME => $qb->createNamedParameter('NC 2 University'), + ]); + $qb->executeStatement(); + + // add some invitations + $qb->insert(Schema::TABLE_INVITATIONS)->values([ + Schema::INVITATION_USER_CLOUD_ID => $qb->createNamedParameter('admin@nc-1.nl'), + Schema::INVITATION_TOKEN => $qb->createNamedParameter(getenv('TEST_UUID_1')), + Schema::INVITATION_PROVIDER_ENDPOINT => $qb->createNamedParameter('https://nc-1.nl/apps/invitation'), + Schema::INVITATION_RECIPIENT_ENDPOINT => $qb->createNamedParameter('https://nc-2.nl/apps/invitation'), + Schema::INVITATION_SENDER_CLOUD_ID => $qb->createNamedParameter('admin@nc-1.nl'), + Schema::INVITATION_SENDER_EMAIL => $qb->createNamedParameter('jimmie.baker@mail.nc-1-university.nl'), + Schema::INVITATION_SENDER_NAME => $qb->createNamedParameter('Jimmie Baker'), + Schema::INVITATION_RECIPIENT_CLOUD_ID => $qb->createNamedParameter('lex@nc-2.nl'), + Schema::INVITATION_RECIPIENT_EMAIL => $qb->createNamedParameter('lex@mail.nc-2-academy.nl'), + Schema::INVITATION_RECIPIENT_NAME => $qb->createNamedParameter('Lex Lexington'), + Schema::INVITATION_TIMESTAMP => $qb->createNamedParameter(1713528254, IQueryBuilder::PARAM_INT), + Schema::INVITATION_STATUS => $qb->createNamedParameter('withdrawn'), + ]); + $qb->executeStatement(); + $qb->insert(Schema::TABLE_INVITATIONS)->values([ + Schema::INVITATION_USER_CLOUD_ID => $qb->createNamedParameter('admin@nc-1.nl'), + Schema::INVITATION_TOKEN => $qb->createNamedParameter(getenv('TEST_UUID_2')), + Schema::INVITATION_PROVIDER_ENDPOINT => $qb->createNamedParameter('https://nc-2.nl/apps/invitation'), + Schema::INVITATION_RECIPIENT_ENDPOINT => $qb->createNamedParameter('https://nc-1.nl/apps/invitation'), + Schema::INVITATION_SENDER_CLOUD_ID => $qb->createNamedParameter('admin@nc-2.nl'), + Schema::INVITATION_SENDER_EMAIL => $qb->createNamedParameter('admin@mail.nc-2-university.nl'), + Schema::INVITATION_SENDER_NAME => $qb->createNamedParameter('A. Dmin'), + Schema::INVITATION_RECIPIENT_CLOUD_ID => $qb->createNamedParameter('admin@nc-1.nl'), + Schema::INVITATION_RECIPIENT_EMAIL => $qb->createNamedParameter('admin@nc-1.nl'), + Schema::INVITATION_RECIPIENT_NAME => $qb->createNamedParameter('Admin'), + Schema::INVITATION_TIMESTAMP => $qb->createNamedParameter(1713528678, IQueryBuilder::PARAM_INT), + Schema::INVITATION_STATUS => $qb->createNamedParameter('accepted'), + ]); + $qb->executeStatement(); + return $schema; + } +} diff --git a/tests/docker/integration-tests/src/composer.json b/tests/docker/integration-tests/src/composer.json new file mode 100644 index 0000000..5ee9e93 --- /dev/null +++ b/tests/docker/integration-tests/src/composer.json @@ -0,0 +1,29 @@ +{ + "name": "surf/nc-invitation", + "description": "Test Enhanced federated sharing between Nextcloud instances.", + "type": "project", + "license": "AGPL-3.0-or-later", + "authors": [ + { + "name": "Antoon Prins" + } + ], + "require": { + "ext-mbstring": "*", + "laminas/laminas-diactoros": "^2.4", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ramsey/uuid": "4.2.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "sabre/dav": "^4.1", + "sabre/xml": "^2.2", + "symfony/event-dispatcher": "^5.3.11", + "nextcloud/ocp": "dev-stable28", + "psalm/phar": "^5.17.0", + "nextcloud/coding-standard": "^v1.1.1", + "overtrue/phplint": "^2.0", + "squizlabs/php_codesniffer": "3.*" + } +} diff --git a/tests/docker/integration-tests/src/phpunit.xml b/tests/docker/integration-tests/src/phpunit.xml new file mode 100644 index 0000000..f2d7578 --- /dev/null +++ b/tests/docker/integration-tests/src/phpunit.xml @@ -0,0 +1,7 @@ + + + + ./tests/integration + + + diff --git a/tests/docker/integration-tests/src/tests/bootstrap.php b/tests/docker/integration-tests/src/tests/bootstrap.php new file mode 100644 index 0000000..c006457 --- /dev/null +++ b/tests/docker/integration-tests/src/tests/bootstrap.php @@ -0,0 +1,7 @@ +curlGet($endpoint, true); + + $this->assertTrue(Util::isTrue($response['success']), "GET $endpoint failed"); + $this->assertEquals('oc-1.nl', $response['data']['domain'], "Domain is not what is expected."); + print_r("\nproperties: " . print_r($response, true) . "\n"); + + $endpoint = self::OC_2_UNPROTECTED_ENDPOINT . "/registry/invitation-service-provider"; + print_r("\ntesting unprotected endpoint $endpoint\n"); + $httpClient = new HttpClient(); + $response = $httpClient->curlGet($endpoint, true); + + $this->assertTrue(Util::isTrue($response['success']), "GET $endpoint failed"); + $this->assertEquals('oc-2.nl', $response['data']['domain'], "Domain is not what is expected."); + print_r("\nproperties: " . print_r($response, true) . "\n"); + } catch (Exception $e) { + $this->fail($e->getMessage()); + } + } + + public function testInvitationServiceProviderName() + { + // defined by the test data from Version20231130125301.php + try { + $invitationServiceProviderName = "OC 1 University"; + $endpoint = self::OC_1_UNPROTECTED_ENDPOINT . "/registry/name"; + print_r("\ntesting unprotected endpoint $endpoint\n"); + $httpClient = new HttpClient(); + $response = $httpClient->curlGet($endpoint, true); + + print_r("\n" . print_r($response, true)); + $this->assertTrue(Util::isTrue($response['success']), "GET $endpoint failed"); + $this->assertEquals($invitationServiceProviderName, $response['data'], "GET $endpoint failed"); + + $invitationServiceProviderName = "OC 2 University"; + $endpoint = self::OC_2_UNPROTECTED_ENDPOINT . "/registry/name"; + print_r("\ntesting unprotected endpoint $endpoint\n"); + $httpClient = new HttpClient(); + $response = $httpClient->curlGet($endpoint, true); + print_r("\n" . print_r($response, true)); + $this->assertTrue(Util::isTrue($response['success']), "GET $endpoint failed"); + $this->assertEquals($invitationServiceProviderName, $response['data'], "GET $endpoint failed"); + } catch (Exception $e) { + $this->fail($e->getMessage()); + } + } + + public function tearDown(): void + { + parent::tearDown(); + } +} diff --git a/tests/docker/integration-tests/src/tests/integration/InvitationTest.php b/tests/docker/integration-tests/src/tests/integration/InvitationTest.php new file mode 100644 index 0000000..db8d06f --- /dev/null +++ b/tests/docker/integration-tests/src/tests/integration/InvitationTest.php @@ -0,0 +1,88 @@ +authToken = $this->getAuthToken('admin', getenv('ADMIN_PASS')); + } + + private function getAuthToken(string $user, string $pass): string + { + + // curl -u admin:passw -H 'OCS-APIRequest: true' http://nc-1.nl/ocs/v2.php/core/getapppassword + $url = self::NC_1_HOST . "/ocs/v2.php/core/getapppassword"; + $httpClient = new HttpClient(); + // OCS spec: token should be base64 encoded [user]:[passwd] string + $basicAuthToken = base64_encode("{$user}:{$pass}"); + $headers = ["OCS-APIRequest: true"]; + $response = $httpClient->curlGet($url, $basicAuthToken, "", $headers); + print_r("\nReceived app authentication token: " . print_r($response, true) . "\n"); + return $response['apppassword']; + + } + + public function testRouteFindInvitations() + { + try { + $endpoint = self::NC_1_HOST . "/apps/invitation/invitations?status=accepted|withdrawn"; + print_r("\nTesting unprotected endpoint: {$endpoint}"); + $httpClient = new HttpClient(); + $response = $httpClient->curlGet($endpoint); + print_r($response); + $this->assertTrue(Util::isTrue($response['success']), "GET {$endpoint} failed"); + print_r("\nFound invitations: " . print_r($response['data'], true) . "\n"); + return $response['data']; + } catch (Exception $e) { + $this->fail($e->getTraceAsString()); + } + } + + /** + * Test + * - route GET /invitations/{token} + * - method InvitationController findByToken(token) + * + * @return string token + */ + public function testRouteGetInvitations(): string + { + try { + $testToken = getenv("TEST_UUID_1"); + $endpoint = "/invitations/{$testToken}"; + $url = self::NC_1_OCS_ROOT . "{$endpoint}"; + print_r("\nTesting protected endpoint: {$endpoint}\n"); + $httpClient = new HttpClient(); + $basicAuthToken = base64_encode("admin:{$this->authToken}"); + $response = $httpClient->curlGet($url, $basicAuthToken, "", ["OCS-APIRequest: true"]); + $this->assertTrue(Util::isTrue($response['success']), "GET {$url} failed"); + $this->assertEquals($testToken, $response['data']['token'], "GET {$endpoint} failed\n"); + return $response['data']['token']; + } catch (Exception $e) { + $this->fail($e->getTraceAsString()); + } + } + + public function tearDown(): void + { + print_r("\ntearDown test\n"); + parent::tearDown(); + } +} diff --git a/tests/docker/integration-tests/src/tests/util/AppError.php b/tests/docker/integration-tests/src/tests/util/AppError.php new file mode 100644 index 0000000..bf0ce12 --- /dev/null +++ b/tests/docker/integration-tests/src/tests/util/AppError.php @@ -0,0 +1,102 @@ + true | false, + * + * 'data' => if success is true + * or + * 'error_message' => if success is false + * ] + * @throws HttpException + */ + public function curlPost(string $url, array $params = [], bool $unprotected = false) + { + try { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); + $output = curl_exec($ch); + $info = curl_getinfo($ch); + curl_close($ch); + if (!isset($output) || $output == false) { + throw new Exception('curl_exec error > curl_getinfo: ' . print_r($info, true)); + } + if ($unprotected) { + return json_decode($output, true); + } + $ocs = new SimpleXMLElement($output); + if ($ocs->meta->status == 'ok') { + return Util::simplexmlToArray($ocs->data); + } else { + throw new Exception($ocs->meta->statuscode . '. ' . $ocs->meta->message); + } + } catch (Exception $e) { + throw new Exception($e->getTraceAsString()); + } + } + + /** + * Executes a GET request. + * + * @param string $url + * @param string $userName the user name to create a session user from + * @return mixed returns an array in the standardized format: + * [ + * 'success' => true | false, + * + * 'data' => if success is true + * or + * 'error_message' => if success is false + * ] + * @throws HttpException + */ + public function curlGet( + string $url, + string $basicAuthToken = "", + string $simpleUserPass = "", + array $headers = [], + bool $returnHttpCode = false + ) { + try { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + $httpHeaders = []; + if ($basicAuthToken != "") { + array_push($httpHeaders, "Authorization: Basic {$basicAuthToken}"); + } + if ($simpleUserPass != "") { + curl_setopt($ch, CURLOPT_USERPWD, $simpleUserPass); + } + if (!empty($headers)) { + foreach ($headers as $header) { + array_push($httpHeaders, $header); + } + } + if (!empty($httpHeaders)) { + curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders); + } + $output = curl_exec($ch); + $info = null; + if ($returnHttpCode) { + return curl_getinfo($ch, CURLINFO_RESPONSE_CODE); + } + $info = curl_getinfo($ch); + curl_close($ch); + if (!isset($output) || $output == false) { + print_r("\ncurl_getinfo: " . print_r($info, true)); + throw new Exception('curl_exec output error, curl_getinfo: ' . print_r($info, true)); + } + // unprotected route + if ($basicAuthToken == "" && $simpleUserPass == "") { + return json_decode($output, true); + } + $ocs = new SimpleXMLElement($output); + if ($ocs->meta->status == 'ok') { + return Util::simplexmlToArray($ocs->data); + } else { + throw new Exception($ocs->meta->statuscode . '. ' . $ocs->meta->message); + } + } catch (Exception $e) { + throw new Exception($e->getTraceAsString()); + } + } +} diff --git a/tests/docker/integration-tests/src/tests/util/Util.php b/tests/docker/integration-tests/src/tests/util/Util.php new file mode 100644 index 0000000..28970ac --- /dev/null +++ b/tests/docker/integration-tests/src/tests/util/Util.php @@ -0,0 +1,45 @@ +children() as $k => $v) { + $child = self::simplexmlToArray($v); + if (count($child) == 0) { + $child = (string) $v; + } + foreach ($v->attributes() as $ak => $av) { + if (!is_array($child)) { + $child = array("value" => $child); + } + $child[$ak] = (string) $av; + } + if (!array_key_exists($k, $ar)) { + $ar[$k] = $child; + } else { + if (!is_string($ar[$k]) && isset($ar[$k][0])) { + $ar[$k][] = $child; + } else { + $ar[$k] = array($ar[$k]); + $ar[$k][] = $child; + } + } + } + return $ar; + } +} diff --git a/tests/docker/integration-tests/src/tests/util/fail-formatted.txt b/tests/docker/integration-tests/src/tests/util/fail-formatted.txt new file mode 100644 index 0000000..3734067 --- /dev/null +++ b/tests/docker/integration-tests/src/tests/util/fail-formatted.txt @@ -0,0 +1,701 @@ +"OC\\AppFramework\\Http\\Request Object +( + [inputStream:protected] => php://input + [content:protected] => + [items:protected] => Array + ( + [params] => Array + ( + ) + + [get] => Array + ( + ) + + [post] => Array + ( + ) + + [files] => Array + ( + ) + + [server] => Array + ( + [HTTP_AUTHORIZATION] => Basic YWRtaW46cGFzc3c= + [modHeadersAvailable] => true + [htaccessWorking] => true + [front_controller_active] => true + [HTTP_HOST] => nc-1 + [HTTP_X_FORWARDED_FOR] => 10.1.0.190 + [HTTP_X_FORWARDED_PROTO] => https + [HTTP_X_FORWARDED_HOST] => nc-1.nl + [HTTP_CONNECTION] => close + [HTTP_ACCEPT] => */* + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [SERVER_SIGNATURE] =>
Apache/2.4.59 (Debian) Server at nc-1 Port 80
+ + [SERVER_SOFTWARE] => Apache/2.4.59 (Debian) + [SERVER_NAME] => nc-1 + [SERVER_ADDR] => 10.1.0.100 + [SERVER_PORT] => 80 + [REMOTE_ADDR] => 10.1.0.190 + [DOCUMENT_ROOT] => /var/www/html + [REQUEST_SCHEME] => http + [CONTEXT_PREFIX] => + [CONTEXT_DOCUMENT_ROOT] => /var/www/html + [SERVER_ADMIN] => webmaster@localhost + [SCRIPT_FILENAME] => /var/www/html/ocs/v2.php + [REMOTE_PORT] => 41302 + [GATEWAY_INTERFACE] => CGI/1.1 + [SERVER_PROTOCOL] => HTTP/1.0 + [REQUEST_METHOD] => GET + [QUERY_STRING] => + [REQUEST_URI] => /ocs/v2.php/core/getapppassword + [SCRIPT_NAME] => /ocs/v2.php + [PATH_INFO] => /core/getapppassword + [PATH_TRANSLATED] => redirect:/index.php + [PHP_SELF] => /ocs/v2.php/core/getapppassword + [PHP_AUTH_USER] => admin + [PHP_AUTH_PW] => passw + [REQUEST_TIME_FLOAT] => 1718637416.7316 + [REQUEST_TIME] => 1718637416 + [argv] => Array + ( + ) + + [argc] => 0 + ) + + [env] => Array + ( + [HOSTNAME] => da5fe9de4559 + [PHP_VERSION] => 8.2.20 + [APACHE_CONFDIR] => /etc/apache2 + [NEXTCLOUD_VERSION] => 29.0.1 + [PHP_INI_DIR] => /usr/local/etc/php + [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC + [PHP_LDFLAGS] => -Wl,-O1 -pie + [ADMIN_PASS] => passw + [PWD] => /var/www/html + [APACHE_LOG_DIR] => /var/log/apache2 + [PHP_MEMORY_LIMIT] => 512M + [LANG] => C + [APACHE_BODY_LIMIT] => 1073741824 + [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + [APACHE_PID_FILE] => /var/run/apache2/apache2.pid + [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c + [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31 + [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663 + [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz + [APACHE_RUN_GROUP] => www-data + [PHP_UPLOAD_LIMIT] => 512M + [APACHE_LOCK_DIR] => /var/lock/apache2 + [SHLVL] => 0 + [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + [APACHE_RUN_DIR] => /var/run/apache2 + [APACHE_ENVVARS] => /etc/apache2/envvars + [APACHE_RUN_USER] => www-data + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [DEBUG] => true + [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc + [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + ) + + [cookies] => Array + ( + ) + + [urlParams] => Array + ( + ) + + [parameters] => Array + ( + ) + + [method] => GET + [requesttoken] => Array + ( + ) + + ) + + [allowedKeys:protected] => Array + ( + [0] => get + [1] => post + [2] => files + [3] => server + [4] => env + [5] => cookies + [6] => urlParams + [7] => parameters + [8] => method + [9] => requesttoken + ) + + [requestId:protected] => OC\\AppFramework\\Http\\RequestId Object + ( + [secureRandom:protected] => OC\\Security\\SecureRandom Object + ( + ) + + [requestId:protected] => + ) + + [config:protected] => OC\\AllConfig Object + ( + [connection:OC\\AllConfig:private] => + [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object + ( + [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512 + [cache:OCP\\Cache\\CappedMemoryCache:private] => Array + ( + ) + + ) + + [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object + ( + [sensitiveValues:protected] => Array + ( + [instanceid] => 1 + [datadirectory] => 1 + [dbname] => 1 + [dbhost] => 1 + [dbpassword] => 1 + [dbuser] => 1 + [activity_dbname] => 1 + [activity_dbhost] => 1 + [activity_dbpassword] => 1 + [activity_dbuser] => 1 + [mail_from_address] => 1 + [mail_domain] => 1 + [mail_smtphost] => 1 + [mail_smtpname] => 1 + [mail_smtppassword] => 1 + [passwordsalt] => 1 + [secret] => 1 + [updater.secret] => 1 + [updater.server.url] => 1 + [trusted_proxies] => 1 + [preview_imaginary_url] => 1 + [proxyuserpwd] => 1 + [sentry.dsn] => 1 + [sentry.public-dsn] => 1 + [zammad.download.secret] => 1 + [zammad.portal.secret] => 1 + [zammad.secret] => 1 + [github.client_id] => 1 + [github.client_secret] => 1 + [log.condition] => Array + ( + [shared_secret] => 1 + ) + + [license-key] => 1 + [redis] => Array + ( + [host] => 1 + [password] => 1 + ) + + [redis.cluster] => Array + ( + [seeds] => 1 + [password] => 1 + ) + + [objectstore] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [objectstore_multibucket] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [onlyoffice] => Array + ( + [jwt_secret] => 1 + ) + + ) + + [config:OC\\SystemConfig:private] => OC\\Config Object + ( + [cache:protected] => Array + ( + [htaccess.RewriteBase] => / + [memcache.local] => \\OC\\Memcache\\APCu + [apps_paths] => Array + ( + [0] => Array + ( + [path] => /var/www/html/apps + [url] => /apps + [writable] => + ) + + [1] => Array + ( + [path] => /var/www/html/custom_apps + [url] => /custom_apps + [writable] => 1 + ) + + ) + + [upgrade.disable-web] => 1 + [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k + [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9 + [trusted_domains] => Array + ( + [0] => localhost + ) + + [datadirectory] => /var/www/html/data + [dbtype] => mysql + [version] => 29.0.1.1 + [overwrite.cli.url] => http://localhost + [dbname] => nextcloud + [dbhost] => mariadb-nc-1 + [dbport] => + [dbtableprefix] => oc_ + [loglevel] => 0 + [trusted_proxies] => Array + ( + [0] => 10.1.0.180 + ) + + [overwritehost] => nc-1.nl + [overwriteprotocol] => https + [mysql.utf8mb4] => 1 + [dbuser] => nextcloud + [dbpassword] => nextcloud + [installed] => 1 + [instanceid] => oc0cys0f28e0 + ) + + [envCache:protected] => Array + ( + [HOSTNAME] => da5fe9de4559 + [PHP_VERSION] => 8.2.20 + [APACHE_CONFDIR] => /etc/apache2 + [NEXTCLOUD_VERSION] => 29.0.1 + [PHP_INI_DIR] => /usr/local/etc/php + [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC + [PHP_LDFLAGS] => -Wl,-O1 -pie + [ADMIN_PASS] => passw + [PWD] => /var/www/html + [APACHE_LOG_DIR] => /var/log/apache2 + [PHP_MEMORY_LIMIT] => 512M + [LANG] => C + [APACHE_BODY_LIMIT] => 1073741824 + [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + [APACHE_PID_FILE] => /var/run/apache2/apache2.pid + [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c + [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31 + [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663 + [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz + [APACHE_RUN_GROUP] => www-data + [PHP_UPLOAD_LIMIT] => 512M + [APACHE_LOCK_DIR] => /var/lock/apache2 + [SHLVL] => 0 + [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + [APACHE_RUN_DIR] => /var/run/apache2 + [APACHE_ENVVARS] => /etc/apache2/envvars + [APACHE_RUN_USER] => www-data + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [DEBUG] => true + [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc + [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + ) + + [configDir:protected] => /var/www/html/config/ + [configFilePath:protected] => /var/www/html/config/config.php + [configFileName:protected] => config.php + [isReadOnly:protected] => + ) + + ) + + ) + + [csrfTokenManager:protected] => OC\\Security\\CSRF\\CsrfTokenManager Object + ( + [sessionStorage:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\TokenStorage\\SessionStorage Object + ( + [session:OC\\Security\\CSRF\\TokenStorage\\SessionStorage:private] => OC\\Session\\CryptoSessionData Object + ( + [session:protected] => OC\\Session\\Internal Object + ( + [sessionClosed:protected] => 1 + ) + + [crypto:protected] => OC\\Security\\Crypto Object + ( + [cipher:OC\\Security\\Crypto:private] => phpseclib\\Crypt\\AES Object + ( + [mode] => 2 + [block_size] => 16 + [key] => ??9?\u000f?\u0013??\u00180?\u0007\u001a\u001c + [iv] => ?H(?)\u001e??tD!h4R\u05c1 + [encryptIV] => ?H(?)\u001e??tD!h4R\u05c1 + [decryptIV] => ?H(?)\u001e??tD!h4R\u05c1 + [continuousBuffer] => + [enbuffer] => Array + ( + [ciphertext] => + [xor] => + [pos] => 0 + [enmcrypt_init] => 1 + ) + + [debuffer] => Array + ( + [ciphertext] => + [xor] => + [pos] => 0 + [enmcrypt_init] => 1 + ) + + [enmcrypt] => + [demcrypt] => + [enchanged] => 1 + [dechanged] => 1 + [ecb] => + [cfb_init_len] => 600 + [changed] => + [padding] => 1 + [paddable] => 1 + [engine] => 3 + [preferredEngine] => + [cipher_name_mcrypt] => rijndael-128 + [cipher_name_openssl] => aes-128-cbc + [cipher_name_openssl_ecb] => aes-128-ecb + [password_default_salt] => phpseclib + [inline_crypt] => + [use_inline_crypt] => 1 + [openssl_emulate_ctr] => + [openssl_options] => 3 + [explicit_key_length] => + [skip_key_adjustment] => + [w] => + [dw] => + [Nb] => 4 + [key_length] => 16 + [Nk] => 4 + [Nr] => + [c] => + [kl] => + ) + + [ivLength:OC\\Security\\Crypto:private] => 16 + [config:OC\\Security\\Crypto:private] => OC\\AllConfig Object + ( + [connection:OC\\AllConfig:private] => + [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object + ( + [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512 + [cache:OCP\\Cache\\CappedMemoryCache:private] => Array + ( + ) + + ) + + [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object + ( + [sensitiveValues:protected] => Array + ( + [instanceid] => 1 + [datadirectory] => 1 + [dbname] => 1 + [dbhost] => 1 + [dbpassword] => 1 + [dbuser] => 1 + [activity_dbname] => 1 + [activity_dbhost] => 1 + [activity_dbpassword] => 1 + [activity_dbuser] => 1 + [mail_from_address] => 1 + [mail_domain] => 1 + [mail_smtphost] => 1 + [mail_smtpname] => 1 + [mail_smtppassword] => 1 + [passwordsalt] => 1 + [secret] => 1 + [updater.secret] => 1 + [updater.server.url] => 1 + [trusted_proxies] => 1 + [preview_imaginary_url] => 1 + [proxyuserpwd] => 1 + [sentry.dsn] => 1 + [sentry.public-dsn] => 1 + [zammad.download.secret] => 1 + [zammad.portal.secret] => 1 + [zammad.secret] => 1 + [github.client_id] => 1 + [github.client_secret] => 1 + [log.condition] => Array + ( + [shared_secret] => 1 + ) + + [license-key] => 1 + [redis] => Array + ( + [host] => 1 + [password] => 1 + ) + + [redis.cluster] => Array + ( + [seeds] => 1 + [password] => 1 + ) + + [objectstore] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [objectstore_multibucket] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [onlyoffice] => Array + ( + [jwt_secret] => 1 + ) + + ) + + [config:OC\\SystemConfig:private] => OC\\Config Object + ( + [cache:protected] => Array + ( + [htaccess.RewriteBase] => / + [memcache.local] => \\OC\\Memcache\\APCu + [apps_paths] => Array + ( + [0] => Array + ( + [path] => /var/www/html/apps + [url] => /apps + [writable] => + ) + + [1] => Array + ( + [path] => /var/www/html/custom_apps + [url] => /custom_apps + [writable] => 1 + ) + + ) + + [upgrade.disable-web] => 1 + [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k + [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9 + [trusted_domains] => Array + ( + [0] => localhost + ) + + [datadirectory] => /var/www/html/data + [dbtype] => mysql + [version] => 29.0.1.1 + [overwrite.cli.url] => http://localhost + [dbname] => nextcloud + [dbhost] => mariadb-nc-1 + [dbport] => + [dbtableprefix] => oc_ + [loglevel] => 0 + [trusted_proxies] => Array + ( + [0] => 10.1.0.180 + ) + + [overwritehost] => nc-1.nl + [overwriteprotocol] => https + [mysql.utf8mb4] => 1 + [dbuser] => nextcloud + [dbpassword] => nextcloud + [installed] => 1 + [instanceid] => oc0cys0f28e0 + ) + + [envCache:protected] => Array + ( + [HOSTNAME] => da5fe9de4559 + [PHP_VERSION] => 8.2.20 + [APACHE_CONFDIR] => /etc/apache2 + [NEXTCLOUD_VERSION] => 29.0.1 + [PHP_INI_DIR] => /usr/local/etc/php + [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC + [PHP_LDFLAGS] => -Wl,-O1 -pie + [ADMIN_PASS] => passw + [PWD] => /var/www/html + [APACHE_LOG_DIR] => /var/log/apache2 + [PHP_MEMORY_LIMIT] => 512M + [LANG] => C + [APACHE_BODY_LIMIT] => 1073741824 + [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + [APACHE_PID_FILE] => /var/run/apache2/apache2.pid + [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c + [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31 + [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663 + [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz + [APACHE_RUN_GROUP] => www-data + [PHP_UPLOAD_LIMIT] => 512M + [APACHE_LOCK_DIR] => /var/lock/apache2 + [SHLVL] => 0 + [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + [APACHE_RUN_DIR] => /var/run/apache2 + [APACHE_ENVVARS] => /etc/apache2/envvars + [APACHE_RUN_USER] => www-data + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [DEBUG] => true + [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc + [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + ) + + [configDir:protected] => /var/www/html/config/ + [configFilePath:protected] => /var/www/html/config/config.php + [configFileName:protected] => config.php + [isReadOnly:protected] => + ) + + ) + + ) + + ) + + [passphrase:protected] => 971mOLK9z0nOfvBDof57cP0l6chS6ztvkeRDWxegxnuHhJauVctLggu3fthV5IgTdCnhVcuZ64itJTrlLR/iavkJrg/7cwws7lRpSk996Ny5u0zwAjgrXiP2f544zBAp + [sessionValues:protected] => Array + ( + [LAST_ACTIVITY] => 1718637416 + [requesttoken] => AOl4Y8Rlvho3bQUEv6UOYHc/UvUY5Css + [checkServer_succeeded] => 1 + ) + + [isModified:protected] => + ) + + ) + + [csrfToken:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfToken Object + ( + [encryptedValue:OC\\Security\\CSRF\\CsrfToken:private] => AP815NkCW5u/akQBkjXBwFAFxrsVhYeiLUo11+b8gpc=:QbBZ0IA6CffJAisy8GSUhSYzk/RMzeSNeDxgjtO/8eQ= + [value:OC\\Security\\CSRF\\CsrfToken:private] => AOl4Y8Rlvho3bQUEv6UOYHc/UvUY5Css + ) + + [tokenGenerator:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfTokenGenerator Object + ( + [random:OC\\Security\\CSRF\\CsrfTokenGenerator:private] => OC\\Security\\SecureRandom Object + ( + ) + + ) + + ) + + [contentDecoded:protected] => +) \ No newline at end of file diff --git a/tests/docker/integration-tests/src/tests/util/fail.txt b/tests/docker/integration-tests/src/tests/util/fail.txt new file mode 100644 index 0000000..496989a --- /dev/null +++ b/tests/docker/integration-tests/src/tests/util/fail.txt @@ -0,0 +1 @@ +"OC\\AppFramework\\Http\\Request Object\n(\n [inputStream:protected] => php://input\n [content:protected] => \n [items:protected] => Array\n (\n [params] => Array\n (\n )\n\n [get] => Array\n (\n )\n\n [post] => Array\n (\n )\n\n [files] => Array\n (\n )\n\n [server] => Array\n (\n [HTTP_AUTHORIZATION] => Basic YWRtaW46cGFzc3c=\n [modHeadersAvailable] => true\n [htaccessWorking] => true\n [front_controller_active] => true\n [HTTP_HOST] => nc-1\n [HTTP_X_FORWARDED_FOR] => 10.1.0.190\n [HTTP_X_FORWARDED_PROTO] => https\n [HTTP_X_FORWARDED_HOST] => nc-1.nl\n [HTTP_CONNECTION] => close\n [HTTP_ACCEPT] => */*\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [SERVER_SIGNATURE] =>
Apache/2.4.59 (Debian) Server at nc-1 Port 80
\n\n [SERVER_SOFTWARE] => Apache/2.4.59 (Debian)\n [SERVER_NAME] => nc-1\n [SERVER_ADDR] => 10.1.0.100\n [SERVER_PORT] => 80\n [REMOTE_ADDR] => 10.1.0.190\n [DOCUMENT_ROOT] => /var/www/html\n [REQUEST_SCHEME] => http\n [CONTEXT_PREFIX] => \n [CONTEXT_DOCUMENT_ROOT] => /var/www/html\n [SERVER_ADMIN] => webmaster@localhost\n [SCRIPT_FILENAME] => /var/www/html/ocs/v2.php\n [REMOTE_PORT] => 41302\n [GATEWAY_INTERFACE] => CGI/1.1\n [SERVER_PROTOCOL] => HTTP/1.0\n [REQUEST_METHOD] => GET\n [QUERY_STRING] => \n [REQUEST_URI] => /ocs/v2.php/core/getapppassword\n [SCRIPT_NAME] => /ocs/v2.php\n [PATH_INFO] => /core/getapppassword\n [PATH_TRANSLATED] => redirect:/index.php\n [PHP_SELF] => /ocs/v2.php/core/getapppassword\n [PHP_AUTH_USER] => admin\n [PHP_AUTH_PW] => passw\n [REQUEST_TIME_FLOAT] => 1718637416.7316\n [REQUEST_TIME] => 1718637416\n [argv] => Array\n (\n )\n\n [argc] => 0\n )\n\n [env] => Array\n (\n [HOSTNAME] => da5fe9de4559\n [PHP_VERSION] => 8.2.20\n [APACHE_CONFDIR] => /etc/apache2\n [NEXTCLOUD_VERSION] => 29.0.1\n [PHP_INI_DIR] => /usr/local/etc/php\n [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\n [PHP_LDFLAGS] => -Wl,-O1 -pie\n [ADMIN_PASS] => passw\n [PWD] => /var/www/html\n [APACHE_LOG_DIR] => /var/log/apache2\n [PHP_MEMORY_LIMIT] => 512M\n [LANG] => C\n [APACHE_BODY_LIMIT] => 1073741824\n [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50\n [APACHE_PID_FILE] => /var/run/apache2/apache2.pid\n [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\n [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31\n [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663\n [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz\n [APACHE_RUN_GROUP] => www-data\n [PHP_UPLOAD_LIMIT] => 512M\n [APACHE_LOCK_DIR] => /var/lock/apache2\n [SHLVL] => 0\n [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n [APACHE_RUN_DIR] => /var/run/apache2\n [APACHE_ENVVARS] => /etc/apache2/envvars\n [APACHE_RUN_USER] => www-data\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [DEBUG] => true\n [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc\n [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n )\n\n [cookies] => Array\n (\n )\n\n [urlParams] => Array\n (\n )\n\n [parameters] => Array\n (\n )\n\n [method] => GET\n [requesttoken] => Array\n (\n )\n\n )\n\n [allowedKeys:protected] => Array\n (\n [0] => get\n [1] => post\n [2] => files\n [3] => server\n [4] => env\n [5] => cookies\n [6] => urlParams\n [7] => parameters\n [8] => method\n [9] => requesttoken\n )\n\n [requestId:protected] => OC\\AppFramework\\Http\\RequestId Object\n (\n [secureRandom:protected] => OC\\Security\\SecureRandom Object\n (\n )\n\n [requestId:protected] => \n )\n\n [config:protected] => OC\\AllConfig Object\n (\n [connection:OC\\AllConfig:private] => \n [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object\n (\n [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512\n [cache:OCP\\Cache\\CappedMemoryCache:private] => Array\n (\n )\n\n )\n\n [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object\n (\n [sensitiveValues:protected] => Array\n (\n [instanceid] => 1\n [datadirectory] => 1\n [dbname] => 1\n [dbhost] => 1\n [dbpassword] => 1\n [dbuser] => 1\n [activity_dbname] => 1\n [activity_dbhost] => 1\n [activity_dbpassword] => 1\n [activity_dbuser] => 1\n [mail_from_address] => 1\n [mail_domain] => 1\n [mail_smtphost] => 1\n [mail_smtpname] => 1\n [mail_smtppassword] => 1\n [passwordsalt] => 1\n [secret] => 1\n [updater.secret] => 1\n [updater.server.url] => 1\n [trusted_proxies] => 1\n [preview_imaginary_url] => 1\n [proxyuserpwd] => 1\n [sentry.dsn] => 1\n [sentry.public-dsn] => 1\n [zammad.download.secret] => 1\n [zammad.portal.secret] => 1\n [zammad.secret] => 1\n [github.client_id] => 1\n [github.client_secret] => 1\n [log.condition] => Array\n (\n [shared_secret] => 1\n )\n\n [license-key] => 1\n [redis] => Array\n (\n [host] => 1\n [password] => 1\n )\n\n [redis.cluster] => Array\n (\n [seeds] => 1\n [password] => 1\n )\n\n [objectstore] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [objectstore_multibucket] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [onlyoffice] => Array\n (\n [jwt_secret] => 1\n )\n\n )\n\n [config:OC\\SystemConfig:private] => OC\\Config Object\n (\n [cache:protected] => Array\n (\n [htaccess.RewriteBase] => /\n [memcache.local] => \\OC\\Memcache\\APCu\n [apps_paths] => Array\n (\n [0] => Array\n (\n [path] => /var/www/html/apps\n [url] => /apps\n [writable] => \n )\n\n [1] => Array\n (\n [path] => /var/www/html/custom_apps\n [url] => /custom_apps\n [writable] => 1\n )\n\n )\n\n [upgrade.disable-web] => 1\n [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k\n [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9\n [trusted_domains] => Array\n (\n [0] => localhost\n )\n\n [datadirectory] => /var/www/html/data\n [dbtype] => mysql\n [version] => 29.0.1.1\n [overwrite.cli.url] => http://localhost\n [dbname] => nextcloud\n [dbhost] => mariadb-nc-1\n [dbport] => \n [dbtableprefix] => oc_\n [loglevel] => 0\n [trusted_proxies] => Array\n (\n [0] => 10.1.0.180\n )\n\n [overwritehost] => nc-1.nl\n [overwriteprotocol] => https\n [mysql.utf8mb4] => 1\n [dbuser] => nextcloud\n [dbpassword] => nextcloud\n [installed] => 1\n [instanceid] => oc0cys0f28e0\n )\n\n [envCache:protected] => Array\n (\n [HOSTNAME] => da5fe9de4559\n [PHP_VERSION] => 8.2.20\n [APACHE_CONFDIR] => /etc/apache2\n [NEXTCLOUD_VERSION] => 29.0.1\n [PHP_INI_DIR] => /usr/local/etc/php\n [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\n [PHP_LDFLAGS] => -Wl,-O1 -pie\n [ADMIN_PASS] => passw\n [PWD] => /var/www/html\n [APACHE_LOG_DIR] => /var/log/apache2\n [PHP_MEMORY_LIMIT] => 512M\n [LANG] => C\n [APACHE_BODY_LIMIT] => 1073741824\n [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50\n [APACHE_PID_FILE] => /var/run/apache2/apache2.pid\n [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\n [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31\n [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663\n [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz\n [APACHE_RUN_GROUP] => www-data\n [PHP_UPLOAD_LIMIT] => 512M\n [APACHE_LOCK_DIR] => /var/lock/apache2\n [SHLVL] => 0\n [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n [APACHE_RUN_DIR] => /var/run/apache2\n [APACHE_ENVVARS] => /etc/apache2/envvars\n [APACHE_RUN_USER] => www-data\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [DEBUG] => true\n [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc\n [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n )\n\n [configDir:protected] => /var/www/html/config/\n [configFilePath:protected] => /var/www/html/config/config.php\n [configFileName:protected] => config.php\n [isReadOnly:protected] => \n )\n\n )\n\n )\n\n [csrfTokenManager:protected] => OC\\Security\\CSRF\\CsrfTokenManager Object\n (\n [sessionStorage:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\TokenStorage\\SessionStorage Object\n (\n [session:OC\\Security\\CSRF\\TokenStorage\\SessionStorage:private] => OC\\Session\\CryptoSessionData Object\n (\n [session:protected] => OC\\Session\\Internal Object\n (\n [sessionClosed:protected] => 1\n )\n\n [crypto:protected] => OC\\Security\\Crypto Object\n (\n [cipher:OC\\Security\\Crypto:private] => phpseclib\\Crypt\\AES Object\n (\n [mode] => 2\n [block_size] => 16\n [key] => ??9?\u000f?\u0013??\u00180?\u0007\u001a\u001c\n [iv] => ?H(?)\u001e??tD!h4R\u05c1\n [encryptIV] => ?H(?)\u001e??tD!h4R\u05c1\n [decryptIV] => ?H(?)\u001e??tD!h4R\u05c1\n [continuousBuffer] => \n [enbuffer] => Array\n (\n [ciphertext] => \n [xor] => \n [pos] => 0\n [enmcrypt_init] => 1\n )\n\n [debuffer] => Array\n (\n [ciphertext] => \n [xor] => \n [pos] => 0\n [enmcrypt_init] => 1\n )\n\n [enmcrypt] => \n [demcrypt] => \n [enchanged] => 1\n [dechanged] => 1\n [ecb] => \n [cfb_init_len] => 600\n [changed] => \n [padding] => 1\n [paddable] => 1\n [engine] => 3\n [preferredEngine] => \n [cipher_name_mcrypt] => rijndael-128\n [cipher_name_openssl] => aes-128-cbc\n [cipher_name_openssl_ecb] => aes-128-ecb\n [password_default_salt] => phpseclib\n [inline_crypt] => \n [use_inline_crypt] => 1\n [openssl_emulate_ctr] => \n [openssl_options] => 3\n [explicit_key_length] => \n [skip_key_adjustment] => \n [w] => \n [dw] => \n [Nb] => 4\n [key_length] => 16\n [Nk] => 4\n [Nr] => \n [c] => \n [kl] => \n )\n\n [ivLength:OC\\Security\\Crypto:private] => 16\n [config:OC\\Security\\Crypto:private] => OC\\AllConfig Object\n (\n [connection:OC\\AllConfig:private] => \n [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object\n (\n [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512\n [cache:OCP\\Cache\\CappedMemoryCache:private] => Array\n (\n )\n\n )\n\n [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object\n (\n [sensitiveValues:protected] => Array\n (\n [instanceid] => 1\n [datadirectory] => 1\n [dbname] => 1\n [dbhost] => 1\n [dbpassword] => 1\n [dbuser] => 1\n [activity_dbname] => 1\n [activity_dbhost] => 1\n [activity_dbpassword] => 1\n [activity_dbuser] => 1\n [mail_from_address] => 1\n [mail_domain] => 1\n [mail_smtphost] => 1\n [mail_smtpname] => 1\n [mail_smtppassword] => 1\n [passwordsalt] => 1\n [secret] => 1\n [updater.secret] => 1\n [updater.server.url] => 1\n [trusted_proxies] => 1\n [preview_imaginary_url] => 1\n [proxyuserpwd] => 1\n [sentry.dsn] => 1\n [sentry.public-dsn] => 1\n [zammad.download.secret] => 1\n [zammad.portal.secret] => 1\n [zammad.secret] => 1\n [github.client_id] => 1\n [github.client_secret] => 1\n [log.condition] => Array\n (\n [shared_secret] => 1\n )\n\n [license-key] => 1\n [redis] => Array\n (\n [host] => 1\n [password] => 1\n )\n\n [redis.cluster] => Array\n (\n [seeds] => 1\n [password] => 1\n )\n\n [objectstore] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [objectstore_multibucket] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [onlyoffice] => Array\n (\n [jwt_secret] => 1\n )\n\n )\n\n [config:OC\\SystemConfig:private] => OC\\Config Object\n (\n [cache:protected] => Array\n (\n [htaccess.RewriteBase] => /\n [memcache.local] => \\OC\\Memcache\\APCu\n [apps_paths] => Array\n (\n [0] => Array\n (\n [path] => /var/www/html/apps\n [url] => /apps\n [writable] => \n )\n\n [1] => Array\n (\n [path] => /var/www/html/custom_apps\n [url] => /custom_apps\n [writable] => 1\n )\n\n )\n\n [upgrade.disable-web] => 1\n [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k\n [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9\n [trusted_domains] => Array\n (\n [0] => localhost\n )\n\n [datadirectory] => /var/www/html/data\n [dbtype] => mysql\n [version] => 29.0.1.1\n [overwrite.cli.url] => http://localhost\n [dbname] => nextcloud\n [dbhost] => mariadb-nc-1\n [dbport] => \n [dbtableprefix] => oc_\n [loglevel] => 0\n [trusted_proxies] => Array\n (\n [0] => 10.1.0.180\n )\n\n [overwritehost] => nc-1.nl\n [overwriteprotocol] => https\n [mysql.utf8mb4] => 1\n [dbuser] => nextcloud\n [dbpassword] => nextcloud\n [installed] => 1\n [instanceid] => oc0cys0f28e0\n )\n\n [envCache:protected] => Array\n (\n [HOSTNAME] => da5fe9de4559\n [PHP_VERSION] => 8.2.20\n [APACHE_CONFDIR] => /etc/apache2\n [NEXTCLOUD_VERSION] => 29.0.1\n [PHP_INI_DIR] => /usr/local/etc/php\n [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\n [PHP_LDFLAGS] => -Wl,-O1 -pie\n [ADMIN_PASS] => passw\n [PWD] => /var/www/html\n [APACHE_LOG_DIR] => /var/log/apache2\n [PHP_MEMORY_LIMIT] => 512M\n [LANG] => C\n [APACHE_BODY_LIMIT] => 1073741824\n [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50\n [APACHE_PID_FILE] => /var/run/apache2/apache2.pid\n [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\n [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31\n [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663\n [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz\n [APACHE_RUN_GROUP] => www-data\n [PHP_UPLOAD_LIMIT] => 512M\n [APACHE_LOCK_DIR] => /var/lock/apache2\n [SHLVL] => 0\n [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n [APACHE_RUN_DIR] => /var/run/apache2\n [APACHE_ENVVARS] => /etc/apache2/envvars\n [APACHE_RUN_USER] => www-data\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [DEBUG] => true\n [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc\n [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n )\n\n [configDir:protected] => /var/www/html/config/\n [configFilePath:protected] => /var/www/html/config/config.php\n [configFileName:protected] => config.php\n [isReadOnly:protected] => \n )\n\n )\n\n )\n\n )\n\n [passphrase:protected] => 971mOLK9z0nOfvBDof57cP0l6chS6ztvkeRDWxegxnuHhJauVctLggu3fthV5IgTdCnhVcuZ64itJTrlLR/iavkJrg/7cwws7lRpSk996Ny5u0zwAjgrXiP2f544zBAp\n [sessionValues:protected] => Array\n (\n [LAST_ACTIVITY] => 1718637416\n [requesttoken] => AOl4Y8Rlvho3bQUEv6UOYHc/UvUY5Css\n [checkServer_succeeded] => 1\n )\n\n [isModified:protected] => \n )\n\n )\n\n [csrfToken:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfToken Object\n (\n [encryptedValue:OC\\Security\\CSRF\\CsrfToken:private] => AP815NkCW5u/akQBkjXBwFAFxrsVhYeiLUo11+b8gpc=:QbBZ0IA6CffJAisy8GSUhSYzk/RMzeSNeDxgjtO/8eQ=\n [value:OC\\Security\\CSRF\\CsrfToken:private] => AOl4Y8Rlvho3bQUEv6UOYHc/UvUY5Css\n )\n\n [tokenGenerator:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfTokenGenerator Object\n (\n [random:OC\\Security\\CSRF\\CsrfTokenGenerator:private] => OC\\Security\\SecureRandom Object\n (\n )\n\n )\n\n )\n\n [contentDecoded:protected] => \n)\n \ No newline at end of file diff --git a/tests/docker/integration-tests/src/tests/util/success-formatted.txt b/tests/docker/integration-tests/src/tests/util/success-formatted.txt new file mode 100644 index 0000000..07bb5c5 --- /dev/null +++ b/tests/docker/integration-tests/src/tests/util/success-formatted.txt @@ -0,0 +1,703 @@ +"OC\\AppFramework\\Http\\Request Object +( + [inputStream:protected] => php://input + [content:protected] => + [items:protected] => Array + ( + [params] => Array + ( + ) + + [get] => Array + ( + ) + + [post] => Array + ( + ) + + [files] => Array + ( + ) + + [server] => Array + ( + [HTTP_AUTHORIZATION] => Basic YWRtaW46cGFzc3c= + [modHeadersAvailable] => true + [htaccessWorking] => true + [front_controller_active] => true + [HTTP_HOST] => nc-1 + [HTTP_X_FORWARDED_FOR] => 10.1.0.1 + [HTTP_X_FORWARDED_PROTO] => http + [HTTP_X_FORWARDED_HOST] => nc-1.nl + [HTTP_CONNECTION] => close + [HTTP_USER_AGENT] => curl/7.81.0 + [HTTP_ACCEPT] => */* + [HTTP_OCS_APIREQUEST] => true + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [SERVER_SIGNATURE] =>
Apache/2.4.59 (Debian) Server at nc-1 Port 80
+ + [SERVER_SOFTWARE] => Apache/2.4.59 (Debian) + [SERVER_NAME] => nc-1 + [SERVER_ADDR] => 10.1.0.100 + [SERVER_PORT] => 80 + [REMOTE_ADDR] => 10.1.0.1 + [DOCUMENT_ROOT] => /var/www/html + [REQUEST_SCHEME] => http + [CONTEXT_PREFIX] => + [CONTEXT_DOCUMENT_ROOT] => /var/www/html + [SERVER_ADMIN] => webmaster@localhost + [SCRIPT_FILENAME] => /var/www/html/ocs/v2.php + [REMOTE_PORT] => 38516 + [GATEWAY_INTERFACE] => CGI/1.1 + [SERVER_PROTOCOL] => HTTP/1.0 + [REQUEST_METHOD] => GET + [QUERY_STRING] => + [REQUEST_URI] => /ocs/v2.php/core/getapppassword + [SCRIPT_NAME] => /ocs/v2.php + [PATH_INFO] => /core/getapppassword + [PATH_TRANSLATED] => redirect:/index.php + [PHP_SELF] => /ocs/v2.php/core/getapppassword + [PHP_AUTH_USER] => admin + [PHP_AUTH_PW] => passw + [REQUEST_TIME_FLOAT] => 1718637660.2152 + [REQUEST_TIME] => 1718637660 + [argv] => Array + ( + ) + + [argc] => 0 + ) + + [env] => Array + ( + [HOSTNAME] => da5fe9de4559 + [PHP_VERSION] => 8.2.20 + [APACHE_CONFDIR] => /etc/apache2 + [NEXTCLOUD_VERSION] => 29.0.1 + [PHP_INI_DIR] => /usr/local/etc/php + [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC + [PHP_LDFLAGS] => -Wl,-O1 -pie + [ADMIN_PASS] => passw + [PWD] => /var/www/html + [APACHE_LOG_DIR] => /var/log/apache2 + [PHP_MEMORY_LIMIT] => 512M + [LANG] => C + [APACHE_BODY_LIMIT] => 1073741824 + [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + [APACHE_PID_FILE] => /var/run/apache2/apache2.pid + [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c + [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31 + [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663 + [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz + [APACHE_RUN_GROUP] => www-data + [PHP_UPLOAD_LIMIT] => 512M + [APACHE_LOCK_DIR] => /var/lock/apache2 + [SHLVL] => 0 + [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + [APACHE_RUN_DIR] => /var/run/apache2 + [APACHE_ENVVARS] => /etc/apache2/envvars + [APACHE_RUN_USER] => www-data + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [DEBUG] => true + [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc + [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + ) + + [cookies] => Array + ( + ) + + [urlParams] => Array + ( + ) + + [parameters] => Array + ( + ) + + [method] => GET + [requesttoken] => Array + ( + ) + + ) + + [allowedKeys:protected] => Array + ( + [0] => get + [1] => post + [2] => files + [3] => server + [4] => env + [5] => cookies + [6] => urlParams + [7] => parameters + [8] => method + [9] => requesttoken + ) + + [requestId:protected] => OC\\AppFramework\\Http\\RequestId Object + ( + [secureRandom:protected] => OC\\Security\\SecureRandom Object + ( + ) + + [requestId:protected] => + ) + + [config:protected] => OC\\AllConfig Object + ( + [connection:OC\\AllConfig:private] => + [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object + ( + [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512 + [cache:OCP\\Cache\\CappedMemoryCache:private] => Array + ( + ) + + ) + + [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object + ( + [sensitiveValues:protected] => Array + ( + [instanceid] => 1 + [datadirectory] => 1 + [dbname] => 1 + [dbhost] => 1 + [dbpassword] => 1 + [dbuser] => 1 + [activity_dbname] => 1 + [activity_dbhost] => 1 + [activity_dbpassword] => 1 + [activity_dbuser] => 1 + [mail_from_address] => 1 + [mail_domain] => 1 + [mail_smtphost] => 1 + [mail_smtpname] => 1 + [mail_smtppassword] => 1 + [passwordsalt] => 1 + [secret] => 1 + [updater.secret] => 1 + [updater.server.url] => 1 + [trusted_proxies] => 1 + [preview_imaginary_url] => 1 + [proxyuserpwd] => 1 + [sentry.dsn] => 1 + [sentry.public-dsn] => 1 + [zammad.download.secret] => 1 + [zammad.portal.secret] => 1 + [zammad.secret] => 1 + [github.client_id] => 1 + [github.client_secret] => 1 + [log.condition] => Array + ( + [shared_secret] => 1 + ) + + [license-key] => 1 + [redis] => Array + ( + [host] => 1 + [password] => 1 + ) + + [redis.cluster] => Array + ( + [seeds] => 1 + [password] => 1 + ) + + [objectstore] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [objectstore_multibucket] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [onlyoffice] => Array + ( + [jwt_secret] => 1 + ) + + ) + + [config:OC\\SystemConfig:private] => OC\\Config Object + ( + [cache:protected] => Array + ( + [htaccess.RewriteBase] => / + [memcache.local] => \\OC\\Memcache\\APCu + [apps_paths] => Array + ( + [0] => Array + ( + [path] => /var/www/html/apps + [url] => /apps + [writable] => + ) + + [1] => Array + ( + [path] => /var/www/html/custom_apps + [url] => /custom_apps + [writable] => 1 + ) + + ) + + [upgrade.disable-web] => 1 + [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k + [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9 + [trusted_domains] => Array + ( + [0] => localhost + ) + + [datadirectory] => /var/www/html/data + [dbtype] => mysql + [version] => 29.0.1.1 + [overwrite.cli.url] => http://localhost + [dbname] => nextcloud + [dbhost] => mariadb-nc-1 + [dbport] => + [dbtableprefix] => oc_ + [loglevel] => 0 + [trusted_proxies] => Array + ( + [0] => 10.1.0.180 + ) + + [overwritehost] => nc-1.nl + [overwriteprotocol] => https + [mysql.utf8mb4] => 1 + [dbuser] => nextcloud + [dbpassword] => nextcloud + [installed] => 1 + [instanceid] => oc0cys0f28e0 + ) + + [envCache:protected] => Array + ( + [HOSTNAME] => da5fe9de4559 + [PHP_VERSION] => 8.2.20 + [APACHE_CONFDIR] => /etc/apache2 + [NEXTCLOUD_VERSION] => 29.0.1 + [PHP_INI_DIR] => /usr/local/etc/php + [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC + [PHP_LDFLAGS] => -Wl,-O1 -pie + [ADMIN_PASS] => passw + [PWD] => /var/www/html + [APACHE_LOG_DIR] => /var/log/apache2 + [PHP_MEMORY_LIMIT] => 512M + [LANG] => C + [APACHE_BODY_LIMIT] => 1073741824 + [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + [APACHE_PID_FILE] => /var/run/apache2/apache2.pid + [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c + [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31 + [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663 + [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz + [APACHE_RUN_GROUP] => www-data + [PHP_UPLOAD_LIMIT] => 512M + [APACHE_LOCK_DIR] => /var/lock/apache2 + [SHLVL] => 0 + [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + [APACHE_RUN_DIR] => /var/run/apache2 + [APACHE_ENVVARS] => /etc/apache2/envvars + [APACHE_RUN_USER] => www-data + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [DEBUG] => true + [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc + [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + ) + + [configDir:protected] => /var/www/html/config/ + [configFilePath:protected] => /var/www/html/config/config.php + [configFileName:protected] => config.php + [isReadOnly:protected] => + ) + + ) + + ) + + [csrfTokenManager:protected] => OC\\Security\\CSRF\\CsrfTokenManager Object + ( + [sessionStorage:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\TokenStorage\\SessionStorage Object + ( + [session:OC\\Security\\CSRF\\TokenStorage\\SessionStorage:private] => OC\\Session\\CryptoSessionData Object + ( + [session:protected] => OC\\Session\\Internal Object + ( + [sessionClosed:protected] => 1 + ) + + [crypto:protected] => OC\\Security\\Crypto Object + ( + [cipher:OC\\Security\\Crypto:private] => phpseclib\\Crypt\\AES Object + ( + [mode] => 2 + [block_size] => 16 + [key] => ??\u0010?t\tL?\u001c?2.???\u001c + [iv] => \u0013\u000f???[3}?\u001e????r + [encryptIV] => \u0013\u000f???[3}?\u001e????r + [decryptIV] => \u0013\u000f???[3}?\u001e????r + [continuousBuffer] => + [enbuffer] => Array + ( + [ciphertext] => + [xor] => + [pos] => 0 + [enmcrypt_init] => 1 + ) + + [debuffer] => Array + ( + [ciphertext] => + [xor] => + [pos] => 0 + [enmcrypt_init] => 1 + ) + + [enmcrypt] => + [demcrypt] => + [enchanged] => 1 + [dechanged] => 1 + [ecb] => + [cfb_init_len] => 600 + [changed] => + [padding] => 1 + [paddable] => 1 + [engine] => 3 + [preferredEngine] => + [cipher_name_mcrypt] => rijndael-128 + [cipher_name_openssl] => aes-128-cbc + [cipher_name_openssl_ecb] => aes-128-ecb + [password_default_salt] => phpseclib + [inline_crypt] => + [use_inline_crypt] => 1 + [openssl_emulate_ctr] => + [openssl_options] => 3 + [explicit_key_length] => + [skip_key_adjustment] => + [w] => + [dw] => + [Nb] => 4 + [key_length] => 16 + [Nk] => 4 + [Nr] => + [c] => + [kl] => + ) + + [ivLength:OC\\Security\\Crypto:private] => 16 + [config:OC\\Security\\Crypto:private] => OC\\AllConfig Object + ( + [connection:OC\\AllConfig:private] => + [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object + ( + [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512 + [cache:OCP\\Cache\\CappedMemoryCache:private] => Array + ( + ) + + ) + + [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object + ( + [sensitiveValues:protected] => Array + ( + [instanceid] => 1 + [datadirectory] => 1 + [dbname] => 1 + [dbhost] => 1 + [dbpassword] => 1 + [dbuser] => 1 + [activity_dbname] => 1 + [activity_dbhost] => 1 + [activity_dbpassword] => 1 + [activity_dbuser] => 1 + [mail_from_address] => 1 + [mail_domain] => 1 + [mail_smtphost] => 1 + [mail_smtpname] => 1 + [mail_smtppassword] => 1 + [passwordsalt] => 1 + [secret] => 1 + [updater.secret] => 1 + [updater.server.url] => 1 + [trusted_proxies] => 1 + [preview_imaginary_url] => 1 + [proxyuserpwd] => 1 + [sentry.dsn] => 1 + [sentry.public-dsn] => 1 + [zammad.download.secret] => 1 + [zammad.portal.secret] => 1 + [zammad.secret] => 1 + [github.client_id] => 1 + [github.client_secret] => 1 + [log.condition] => Array + ( + [shared_secret] => 1 + ) + + [license-key] => 1 + [redis] => Array + ( + [host] => 1 + [password] => 1 + ) + + [redis.cluster] => Array + ( + [seeds] => 1 + [password] => 1 + ) + + [objectstore] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [objectstore_multibucket] => Array + ( + [arguments] => Array + ( + [options] => Array + ( + [credentials] => Array + ( + [key] => 1 + [secret] => 1 + ) + + ) + + [key] => 1 + [secret] => 1 + [username] => 1 + [password] => 1 + [user] => Array + ( + [name] => 1 + [password] => 1 + ) + + ) + + ) + + [onlyoffice] => Array + ( + [jwt_secret] => 1 + ) + + ) + + [config:OC\\SystemConfig:private] => OC\\Config Object + ( + [cache:protected] => Array + ( + [htaccess.RewriteBase] => / + [memcache.local] => \\OC\\Memcache\\APCu + [apps_paths] => Array + ( + [0] => Array + ( + [path] => /var/www/html/apps + [url] => /apps + [writable] => + ) + + [1] => Array + ( + [path] => /var/www/html/custom_apps + [url] => /custom_apps + [writable] => 1 + ) + + ) + + [upgrade.disable-web] => 1 + [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k + [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9 + [trusted_domains] => Array + ( + [0] => localhost + ) + + [datadirectory] => /var/www/html/data + [dbtype] => mysql + [version] => 29.0.1.1 + [overwrite.cli.url] => http://localhost + [dbname] => nextcloud + [dbhost] => mariadb-nc-1 + [dbport] => + [dbtableprefix] => oc_ + [loglevel] => 0 + [trusted_proxies] => Array + ( + [0] => 10.1.0.180 + ) + + [overwritehost] => nc-1.nl + [overwriteprotocol] => https + [mysql.utf8mb4] => 1 + [dbuser] => nextcloud + [dbpassword] => nextcloud + [installed] => 1 + [instanceid] => oc0cys0f28e0 + ) + + [envCache:protected] => Array + ( + [HOSTNAME] => da5fe9de4559 + [PHP_VERSION] => 8.2.20 + [APACHE_CONFDIR] => /etc/apache2 + [NEXTCLOUD_VERSION] => 29.0.1 + [PHP_INI_DIR] => /usr/local/etc/php + [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC + [PHP_LDFLAGS] => -Wl,-O1 -pie + [ADMIN_PASS] => passw + [PWD] => /var/www/html + [APACHE_LOG_DIR] => /var/log/apache2 + [PHP_MEMORY_LIMIT] => 512M + [LANG] => C + [APACHE_BODY_LIMIT] => 1073741824 + [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + [APACHE_PID_FILE] => /var/run/apache2/apache2.pid + [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c + [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31 + [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663 + [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz + [APACHE_RUN_GROUP] => www-data + [PHP_UPLOAD_LIMIT] => 512M + [APACHE_LOCK_DIR] => /var/lock/apache2 + [SHLVL] => 0 + [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + [APACHE_RUN_DIR] => /var/run/apache2 + [APACHE_ENVVARS] => /etc/apache2/envvars + [APACHE_RUN_USER] => www-data + [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + [DEBUG] => true + [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc + [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + ) + + [configDir:protected] => /var/www/html/config/ + [configFilePath:protected] => /var/www/html/config/config.php + [configFileName:protected] => config.php + [isReadOnly:protected] => + ) + + ) + + ) + + ) + + [passphrase:protected] => 7Lalvsix5wllH+C7lDO0mKdJdb95ZSGDlV1r4msAD6h1r1ULWTaUT3l0cl0jsIjj80MYVlbDIz8K59vNDYvgkMeSi0+nwrGDgA1C926gsF6L4QcF2PC1aMBzoXmdir9v + [sessionValues:protected] => Array + ( + [LAST_ACTIVITY] => 1718637660 + [requesttoken] => SqFb8pQbZpHstA0N82m9OES/DcIqknKp + [checkServer_succeeded] => 1 + ) + + [isModified:protected] => + ) + + ) + + [csrfToken:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfToken Object + ( + [encryptedValue:OC\\Security\\CSRF\\CsrfToken:private] => Iq5Wua3TezVXBiWoVR5lkvpMEsvmpDJhOSWA1FDBSEE=:cd8Q25WjKlcNdm3bIV9V3MJ+f/Kp4WFOfUbJpTuvAzE= + [value:OC\\Security\\CSRF\\CsrfToken:private] => SqFb8pQbZpHstA0N82m9OES/DcIqknKp + ) + + [tokenGenerator:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfTokenGenerator Object + ( + [random:OC\\Security\\CSRF\\CsrfTokenGenerator:private] => OC\\Security\\SecureRandom Object + ( + ) + + ) + + ) + + [contentDecoded:protected] => +) \ No newline at end of file diff --git a/tests/docker/integration-tests/src/tests/util/success.txt b/tests/docker/integration-tests/src/tests/util/success.txt new file mode 100644 index 0000000..ae5f6e1 --- /dev/null +++ b/tests/docker/integration-tests/src/tests/util/success.txt @@ -0,0 +1 @@ +"OC\\AppFramework\\Http\\Request Object\n(\n [inputStream:protected] => php://input\n [content:protected] => \n [items:protected] => Array\n (\n [params] => Array\n (\n )\n\n [get] => Array\n (\n )\n\n [post] => Array\n (\n )\n\n [files] => Array\n (\n )\n\n [server] => Array\n (\n [HTTP_AUTHORIZATION] => Basic YWRtaW46cGFzc3c=\n [modHeadersAvailable] => true\n [htaccessWorking] => true\n [front_controller_active] => true\n [HTTP_HOST] => nc-1\n [HTTP_X_FORWARDED_FOR] => 10.1.0.1\n [HTTP_X_FORWARDED_PROTO] => http\n [HTTP_X_FORWARDED_HOST] => nc-1.nl\n [HTTP_CONNECTION] => close\n [HTTP_USER_AGENT] => curl/7.81.0\n [HTTP_ACCEPT] => */*\n [HTTP_OCS_APIREQUEST] => true\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [SERVER_SIGNATURE] =>
Apache/2.4.59 (Debian) Server at nc-1 Port 80
\n\n [SERVER_SOFTWARE] => Apache/2.4.59 (Debian)\n [SERVER_NAME] => nc-1\n [SERVER_ADDR] => 10.1.0.100\n [SERVER_PORT] => 80\n [REMOTE_ADDR] => 10.1.0.1\n [DOCUMENT_ROOT] => /var/www/html\n [REQUEST_SCHEME] => http\n [CONTEXT_PREFIX] => \n [CONTEXT_DOCUMENT_ROOT] => /var/www/html\n [SERVER_ADMIN] => webmaster@localhost\n [SCRIPT_FILENAME] => /var/www/html/ocs/v2.php\n [REMOTE_PORT] => 38516\n [GATEWAY_INTERFACE] => CGI/1.1\n [SERVER_PROTOCOL] => HTTP/1.0\n [REQUEST_METHOD] => GET\n [QUERY_STRING] => \n [REQUEST_URI] => /ocs/v2.php/core/getapppassword\n [SCRIPT_NAME] => /ocs/v2.php\n [PATH_INFO] => /core/getapppassword\n [PATH_TRANSLATED] => redirect:/index.php\n [PHP_SELF] => /ocs/v2.php/core/getapppassword\n [PHP_AUTH_USER] => admin\n [PHP_AUTH_PW] => passw\n [REQUEST_TIME_FLOAT] => 1718637660.2152\n [REQUEST_TIME] => 1718637660\n [argv] => Array\n (\n )\n\n [argc] => 0\n )\n\n [env] => Array\n (\n [HOSTNAME] => da5fe9de4559\n [PHP_VERSION] => 8.2.20\n [APACHE_CONFDIR] => /etc/apache2\n [NEXTCLOUD_VERSION] => 29.0.1\n [PHP_INI_DIR] => /usr/local/etc/php\n [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\n [PHP_LDFLAGS] => -Wl,-O1 -pie\n [ADMIN_PASS] => passw\n [PWD] => /var/www/html\n [APACHE_LOG_DIR] => /var/log/apache2\n [PHP_MEMORY_LIMIT] => 512M\n [LANG] => C\n [APACHE_BODY_LIMIT] => 1073741824\n [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50\n [APACHE_PID_FILE] => /var/run/apache2/apache2.pid\n [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\n [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31\n [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663\n [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz\n [APACHE_RUN_GROUP] => www-data\n [PHP_UPLOAD_LIMIT] => 512M\n [APACHE_LOCK_DIR] => /var/lock/apache2\n [SHLVL] => 0\n [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n [APACHE_RUN_DIR] => /var/run/apache2\n [APACHE_ENVVARS] => /etc/apache2/envvars\n [APACHE_RUN_USER] => www-data\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [DEBUG] => true\n [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc\n [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n )\n\n [cookies] => Array\n (\n )\n\n [urlParams] => Array\n (\n )\n\n [parameters] => Array\n (\n )\n\n [method] => GET\n [requesttoken] => Array\n (\n )\n\n )\n\n [allowedKeys:protected] => Array\n (\n [0] => get\n [1] => post\n [2] => files\n [3] => server\n [4] => env\n [5] => cookies\n [6] => urlParams\n [7] => parameters\n [8] => method\n [9] => requesttoken\n )\n\n [requestId:protected] => OC\\AppFramework\\Http\\RequestId Object\n (\n [secureRandom:protected] => OC\\Security\\SecureRandom Object\n (\n )\n\n [requestId:protected] => \n )\n\n [config:protected] => OC\\AllConfig Object\n (\n [connection:OC\\AllConfig:private] => \n [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object\n (\n [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512\n [cache:OCP\\Cache\\CappedMemoryCache:private] => Array\n (\n )\n\n )\n\n [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object\n (\n [sensitiveValues:protected] => Array\n (\n [instanceid] => 1\n [datadirectory] => 1\n [dbname] => 1\n [dbhost] => 1\n [dbpassword] => 1\n [dbuser] => 1\n [activity_dbname] => 1\n [activity_dbhost] => 1\n [activity_dbpassword] => 1\n [activity_dbuser] => 1\n [mail_from_address] => 1\n [mail_domain] => 1\n [mail_smtphost] => 1\n [mail_smtpname] => 1\n [mail_smtppassword] => 1\n [passwordsalt] => 1\n [secret] => 1\n [updater.secret] => 1\n [updater.server.url] => 1\n [trusted_proxies] => 1\n [preview_imaginary_url] => 1\n [proxyuserpwd] => 1\n [sentry.dsn] => 1\n [sentry.public-dsn] => 1\n [zammad.download.secret] => 1\n [zammad.portal.secret] => 1\n [zammad.secret] => 1\n [github.client_id] => 1\n [github.client_secret] => 1\n [log.condition] => Array\n (\n [shared_secret] => 1\n )\n\n [license-key] => 1\n [redis] => Array\n (\n [host] => 1\n [password] => 1\n )\n\n [redis.cluster] => Array\n (\n [seeds] => 1\n [password] => 1\n )\n\n [objectstore] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [objectstore_multibucket] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [onlyoffice] => Array\n (\n [jwt_secret] => 1\n )\n\n )\n\n [config:OC\\SystemConfig:private] => OC\\Config Object\n (\n [cache:protected] => Array\n (\n [htaccess.RewriteBase] => /\n [memcache.local] => \\OC\\Memcache\\APCu\n [apps_paths] => Array\n (\n [0] => Array\n (\n [path] => /var/www/html/apps\n [url] => /apps\n [writable] => \n )\n\n [1] => Array\n (\n [path] => /var/www/html/custom_apps\n [url] => /custom_apps\n [writable] => 1\n )\n\n )\n\n [upgrade.disable-web] => 1\n [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k\n [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9\n [trusted_domains] => Array\n (\n [0] => localhost\n )\n\n [datadirectory] => /var/www/html/data\n [dbtype] => mysql\n [version] => 29.0.1.1\n [overwrite.cli.url] => http://localhost\n [dbname] => nextcloud\n [dbhost] => mariadb-nc-1\n [dbport] => \n [dbtableprefix] => oc_\n [loglevel] => 0\n [trusted_proxies] => Array\n (\n [0] => 10.1.0.180\n )\n\n [overwritehost] => nc-1.nl\n [overwriteprotocol] => https\n [mysql.utf8mb4] => 1\n [dbuser] => nextcloud\n [dbpassword] => nextcloud\n [installed] => 1\n [instanceid] => oc0cys0f28e0\n )\n\n [envCache:protected] => Array\n (\n [HOSTNAME] => da5fe9de4559\n [PHP_VERSION] => 8.2.20\n [APACHE_CONFDIR] => /etc/apache2\n [NEXTCLOUD_VERSION] => 29.0.1\n [PHP_INI_DIR] => /usr/local/etc/php\n [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\n [PHP_LDFLAGS] => -Wl,-O1 -pie\n [ADMIN_PASS] => passw\n [PWD] => /var/www/html\n [APACHE_LOG_DIR] => /var/log/apache2\n [PHP_MEMORY_LIMIT] => 512M\n [LANG] => C\n [APACHE_BODY_LIMIT] => 1073741824\n [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50\n [APACHE_PID_FILE] => /var/run/apache2/apache2.pid\n [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\n [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31\n [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663\n [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz\n [APACHE_RUN_GROUP] => www-data\n [PHP_UPLOAD_LIMIT] => 512M\n [APACHE_LOCK_DIR] => /var/lock/apache2\n [SHLVL] => 0\n [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n [APACHE_RUN_DIR] => /var/run/apache2\n [APACHE_ENVVARS] => /etc/apache2/envvars\n [APACHE_RUN_USER] => www-data\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [DEBUG] => true\n [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc\n [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n )\n\n [configDir:protected] => /var/www/html/config/\n [configFilePath:protected] => /var/www/html/config/config.php\n [configFileName:protected] => config.php\n [isReadOnly:protected] => \n )\n\n )\n\n )\n\n [csrfTokenManager:protected] => OC\\Security\\CSRF\\CsrfTokenManager Object\n (\n [sessionStorage:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\TokenStorage\\SessionStorage Object\n (\n [session:OC\\Security\\CSRF\\TokenStorage\\SessionStorage:private] => OC\\Session\\CryptoSessionData Object\n (\n [session:protected] => OC\\Session\\Internal Object\n (\n [sessionClosed:protected] => 1\n )\n\n [crypto:protected] => OC\\Security\\Crypto Object\n (\n [cipher:OC\\Security\\Crypto:private] => phpseclib\\Crypt\\AES Object\n (\n [mode] => 2\n [block_size] => 16\n [key] => ??\u0010?t\tL?\u001c?2.???\u001c\n [iv] => \u0013\u000f???[3}?\u001e????r\n [encryptIV] => \u0013\u000f???[3}?\u001e????r\n [decryptIV] => \u0013\u000f???[3}?\u001e????r\n [continuousBuffer] => \n [enbuffer] => Array\n (\n [ciphertext] => \n [xor] => \n [pos] => 0\n [enmcrypt_init] => 1\n )\n\n [debuffer] => Array\n (\n [ciphertext] => \n [xor] => \n [pos] => 0\n [enmcrypt_init] => 1\n )\n\n [enmcrypt] => \n [demcrypt] => \n [enchanged] => 1\n [dechanged] => 1\n [ecb] => \n [cfb_init_len] => 600\n [changed] => \n [padding] => 1\n [paddable] => 1\n [engine] => 3\n [preferredEngine] => \n [cipher_name_mcrypt] => rijndael-128\n [cipher_name_openssl] => aes-128-cbc\n [cipher_name_openssl_ecb] => aes-128-ecb\n [password_default_salt] => phpseclib\n [inline_crypt] => \n [use_inline_crypt] => 1\n [openssl_emulate_ctr] => \n [openssl_options] => 3\n [explicit_key_length] => \n [skip_key_adjustment] => \n [w] => \n [dw] => \n [Nb] => 4\n [key_length] => 16\n [Nk] => 4\n [Nr] => \n [c] => \n [kl] => \n )\n\n [ivLength:OC\\Security\\Crypto:private] => 16\n [config:OC\\Security\\Crypto:private] => OC\\AllConfig Object\n (\n [connection:OC\\AllConfig:private] => \n [userCache:OC\\AllConfig:private] => OCP\\Cache\\CappedMemoryCache Object\n (\n [capacity:OCP\\Cache\\CappedMemoryCache:private] => 512\n [cache:OCP\\Cache\\CappedMemoryCache:private] => Array\n (\n )\n\n )\n\n [systemConfig:OC\\AllConfig:private] => OC\\SystemConfig Object\n (\n [sensitiveValues:protected] => Array\n (\n [instanceid] => 1\n [datadirectory] => 1\n [dbname] => 1\n [dbhost] => 1\n [dbpassword] => 1\n [dbuser] => 1\n [activity_dbname] => 1\n [activity_dbhost] => 1\n [activity_dbpassword] => 1\n [activity_dbuser] => 1\n [mail_from_address] => 1\n [mail_domain] => 1\n [mail_smtphost] => 1\n [mail_smtpname] => 1\n [mail_smtppassword] => 1\n [passwordsalt] => 1\n [secret] => 1\n [updater.secret] => 1\n [updater.server.url] => 1\n [trusted_proxies] => 1\n [preview_imaginary_url] => 1\n [proxyuserpwd] => 1\n [sentry.dsn] => 1\n [sentry.public-dsn] => 1\n [zammad.download.secret] => 1\n [zammad.portal.secret] => 1\n [zammad.secret] => 1\n [github.client_id] => 1\n [github.client_secret] => 1\n [log.condition] => Array\n (\n [shared_secret] => 1\n )\n\n [license-key] => 1\n [redis] => Array\n (\n [host] => 1\n [password] => 1\n )\n\n [redis.cluster] => Array\n (\n [seeds] => 1\n [password] => 1\n )\n\n [objectstore] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [objectstore_multibucket] => Array\n (\n [arguments] => Array\n (\n [options] => Array\n (\n [credentials] => Array\n (\n [key] => 1\n [secret] => 1\n )\n\n )\n\n [key] => 1\n [secret] => 1\n [username] => 1\n [password] => 1\n [user] => Array\n (\n [name] => 1\n [password] => 1\n )\n\n )\n\n )\n\n [onlyoffice] => Array\n (\n [jwt_secret] => 1\n )\n\n )\n\n [config:OC\\SystemConfig:private] => OC\\Config Object\n (\n [cache:protected] => Array\n (\n [htaccess.RewriteBase] => /\n [memcache.local] => \\OC\\Memcache\\APCu\n [apps_paths] => Array\n (\n [0] => Array\n (\n [path] => /var/www/html/apps\n [url] => /apps\n [writable] => \n )\n\n [1] => Array\n (\n [path] => /var/www/html/custom_apps\n [url] => /custom_apps\n [writable] => 1\n )\n\n )\n\n [upgrade.disable-web] => 1\n [passwordsalt] => vTtdPiLF5mxWWyNTVNbMrhBTE4rI3k\n [secret] => MIOTZa6oerl0vEQFEEKeQ0fWwMGDN2lb7cW6Yb1l3blYwmC9\n [trusted_domains] => Array\n (\n [0] => localhost\n )\n\n [datadirectory] => /var/www/html/data\n [dbtype] => mysql\n [version] => 29.0.1.1\n [overwrite.cli.url] => http://localhost\n [dbname] => nextcloud\n [dbhost] => mariadb-nc-1\n [dbport] => \n [dbtableprefix] => oc_\n [loglevel] => 0\n [trusted_proxies] => Array\n (\n [0] => 10.1.0.180\n )\n\n [overwritehost] => nc-1.nl\n [overwriteprotocol] => https\n [mysql.utf8mb4] => 1\n [dbuser] => nextcloud\n [dbpassword] => nextcloud\n [installed] => 1\n [instanceid] => oc0cys0f28e0\n )\n\n [envCache:protected] => Array\n (\n [HOSTNAME] => da5fe9de4559\n [PHP_VERSION] => 8.2.20\n [APACHE_CONFDIR] => /etc/apache2\n [NEXTCLOUD_VERSION] => 29.0.1\n [PHP_INI_DIR] => /usr/local/etc/php\n [GPG_KEYS] => 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\n [PHP_LDFLAGS] => -Wl,-O1 -pie\n [ADMIN_PASS] => passw\n [PWD] => /var/www/html\n [APACHE_LOG_DIR] => /var/log/apache2\n [PHP_MEMORY_LIMIT] => 512M\n [LANG] => C\n [APACHE_BODY_LIMIT] => 1073741824\n [PHP_SHA256] => 4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50\n [APACHE_PID_FILE] => /var/run/apache2/apache2.pid\n [PHPIZE_DEPS] => autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\n [TEST_UUID_1] => c33056f9-2abf-4a1c-98d3-b579b1db8e31\n [TEST_UUID_2] => 5f23338a-b767-41e3-9233-1c1249444663\n [PHP_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz\n [APACHE_RUN_GROUP] => www-data\n [PHP_UPLOAD_LIMIT] => 512M\n [APACHE_LOCK_DIR] => /var/lock/apache2\n [SHLVL] => 0\n [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n [APACHE_RUN_DIR] => /var/run/apache2\n [APACHE_ENVVARS] => /etc/apache2/envvars\n [APACHE_RUN_USER] => www-data\n [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n [DEBUG] => true\n [PHP_ASC_URL] => https://www.php.net/distributions/php-8.2.20.tar.xz.asc\n [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\n )\n\n [configDir:protected] => /var/www/html/config/\n [configFilePath:protected] => /var/www/html/config/config.php\n [configFileName:protected] => config.php\n [isReadOnly:protected] => \n )\n\n )\n\n )\n\n )\n\n [passphrase:protected] => 7Lalvsix5wllH+C7lDO0mKdJdb95ZSGDlV1r4msAD6h1r1ULWTaUT3l0cl0jsIjj80MYVlbDIz8K59vNDYvgkMeSi0+nwrGDgA1C926gsF6L4QcF2PC1aMBzoXmdir9v\n [sessionValues:protected] => Array\n (\n [LAST_ACTIVITY] => 1718637660\n [requesttoken] => SqFb8pQbZpHstA0N82m9OES/DcIqknKp\n [checkServer_succeeded] => 1\n )\n\n [isModified:protected] => \n )\n\n )\n\n [csrfToken:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfToken Object\n (\n [encryptedValue:OC\\Security\\CSRF\\CsrfToken:private] => Iq5Wua3TezVXBiWoVR5lkvpMEsvmpDJhOSWA1FDBSEE=:cd8Q25WjKlcNdm3bIV9V3MJ+f/Kp4WFOfUbJpTuvAzE=\n [value:OC\\Security\\CSRF\\CsrfToken:private] => SqFb8pQbZpHstA0N82m9OES/DcIqknKp\n )\n\n [tokenGenerator:OC\\Security\\CSRF\\CsrfTokenManager:private] => OC\\Security\\CSRF\\CsrfTokenGenerator Object\n (\n [random:OC\\Security\\CSRF\\CsrfTokenGenerator:private] => OC\\Security\\SecureRandom Object\n (\n )\n\n )\n\n )\n\n [contentDecoded:protected] => \n)\n \ No newline at end of file diff --git a/tests/docker/integration-tests/tests.sh b/tests/docker/integration-tests/tests.sh new file mode 100644 index 0000000..07c1d2c --- /dev/null +++ b/tests/docker/integration-tests/tests.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# start the actual tests +echo Start Invitation app integration tests +echo sleeping 60s ... giving owncloud time to startup && sleep 15 && + +curl -u admin:passw -H 'OCS-APIRequest: true' http://nc-1.nl/ocs/v2.php/core/getapppassword + +echo +echo +echo "Starting integration unit tests" +cd /tmp/tests/src +./vendor/phpunit/phpunit/phpunit -c phpunit.xml +# and exit with the phpunit exit code +exit $? + diff --git a/tests/docker/nc-1/Dockerfile-github b/tests/docker/nc-1/Dockerfile-github new file mode 100644 index 0000000..341049e --- /dev/null +++ b/tests/docker/nc-1/Dockerfile-github @@ -0,0 +1,30 @@ +FROM nextcloud:29.0.1 as builder + +ARG BRANCH + +RUN apt update \ + && apt install -y git make nano + +# it needs the certs from all mesh hosts +COPY nc-1/nc-1.nl/certs/cert.pem /usr/share/ca-certificates/rd-mesh/nc-1.pem +RUN echo 'rd-mesh/nc-1.pem' >> /etc/ca-certificates.conf \ + # && echo 'rd-mesh/oc-1.pem' >> /etc/ca-certificates.conf \ + && update-ca-certificates \ + && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt + +# Add the Invitation app from repository +RUN mkdir -p /tmp/invitation \ + && git clone -b ${BRANCH} https://github.com/sara-nl/nc-invitation.git /tmp/invitation + +RUN cp /tmp/invitation/tests/docker/integration-tests/Version20240209130007.php /tmp/invitation/lib/Migration +RUN cp /tmp/invitation/tests/docker/integration-tests/OcsController.php /tmp/invitation/lib/Controller + +# add pre install script +RUN cp -R /tmp/invitation/tests/docker/nc-1/before-starting.sh /docker-entrypoint-hooks.d/before-starting +RUN chown -R www-data /docker-entrypoint-hooks.d/before-starting \ + && chmod u+x /docker-entrypoint-hooks.d/before-starting/before-starting.sh \ + && chown -R www-data /tmp/invitation + +USER www-data + +ENV DEBUG=true \ No newline at end of file diff --git a/tests/docker/nc-1/Dockerfile-local b/tests/docker/nc-1/Dockerfile-local new file mode 100644 index 0000000..26a8d6b --- /dev/null +++ b/tests/docker/nc-1/Dockerfile-local @@ -0,0 +1,27 @@ +FROM nextcloud:29.0.1 as builder + +RUN apt update \ + && apt install -y git make nano + +# it needs the certs from all mesh hosts +COPY tests/docker/nc-1/nc-1.nl/certs/cert.pem /usr/share/ca-certificates/rd-mesh/nc-1.pem +RUN echo 'rd-mesh/nc-1.pem' >> /etc/ca-certificates.conf \ + && update-ca-certificates \ + && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt + +# Add the Invitation app from local source +RUN mkdir -p /tmp/invitation +COPY . /tmp/invitation + +RUN cp /tmp/invitation/tests/docker/integration-tests/Version20240209130007.php /tmp/invitation/lib/Migration +RUN cp /tmp/invitation/tests/docker/integration-tests/OcsController.php /tmp/invitation/lib/Controller + +# add pre install script +RUN cp -R /tmp/invitation/tests/docker/nc-1/before-starting.sh /docker-entrypoint-hooks.d/before-starting +RUN chown -R www-data /docker-entrypoint-hooks.d/before-starting \ + && chmod u+x /docker-entrypoint-hooks.d/before-starting/before-starting.sh \ + && chown -R www-data /tmp/invitation + +USER www-data + +ENV DEBUG=true \ No newline at end of file diff --git a/tests/docker/nc-1/before-starting.sh b/tests/docker/nc-1/before-starting.sh new file mode 100644 index 0000000..d876d35 --- /dev/null +++ b/tests/docker/nc-1/before-starting.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +status=$?; +cmd=php /var/www/html/occ maintenance:mode; +status=$?; + +# status 0 means nextcloud already installed +if [ $status -eq 1 ] +then + echo 'Setup nextcloud database'; + php /var/www/html/occ maintenance:install --database mysql --database-name nextcloud --database-host mariadb-nc-1 --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass passw --admin-email admin@nc-1.nl; + # add necessary config.php settings + sed -i "/^);/i 'loglevel' => 0, 'trusted_proxies' => [0 => '10.1.0.100'], 'overwritehost' => 'nc-1.nl', 'overwriteprotocol' => 'https'" /var/www/html/config/config.php; + echo 'Install Invitation app'; + cd /tmp/invitation; + make -e version=test buildapp-tests; + tar xvf /tmp/invitation/build/artifacts/app/invitation_test.tar.gz -C /var/www/html/apps; + # mkdir /var/www/html/log; + # mv /var/www/html/apps/invitation/appinfo/routes.php /var/www/html/apps/invitation/appinfo/routes-main.php; + php /var/www/html/occ app:enable invitation; +else + echo 'Nextcloud already installed' +fi diff --git a/tests/docker/nc-1/nc-1.nl/certs/cert.pem b/tests/docker/nc-1/nc-1.nl/certs/cert.pem new file mode 100644 index 0000000..d1120f3 --- /dev/null +++ b/tests/docker/nc-1/nc-1.nl/certs/cert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDKDCCAhCgAwIBAgIILBbK0uXKnVAwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE +AxMVbWluaWNhIHJvb3QgY2EgNzU1MDkxMB4XDTI0MDIyOTE1NDY0MVoXDTI2MDMz +MTE0NDY0MVowEjEQMA4GA1UEAxMHbmMtMS5ubDCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAOSmprdSbZoCgwouNyqY6Efn+dv1MJfImPn9dw/xK2NilPty +edjZCX3OmVkRK2BvZcBbvUXMnn62fEn6xfeYv7KBeNC4/WNXojZwadvRLDLv2MF/ +jEnxyzlIl9ttYAHxsjWrGu8cBI+RvIGYfLS3WwCe3dK1xD9pbRq3RsXQJ2SHRDRY +3nOD2ZfmhmZPPojh1AmXWslaltiELGGnLkP8zakNdV/vGFJvqHQHOgrqUtjf/TZ4 +7MBxhUuNAgiCZ9xHaOk8qAQDzI6Q0khVKGW61l1d1xLDoQbUEulKDShR8d09XDJX +aeYKhki3TmOPCtNix0oFACwLyZqYLhA19DEJljkCAwEAAaN0MHIwDgYDVR0PAQH/ +BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8E +AjAAMB8GA1UdIwQYMBaAFPC6NaqixCqeoW+Rn4MqD80+pRkHMBIGA1UdEQQLMAmC +B25jLTEubmwwDQYJKoZIhvcNAQELBQADggEBAKKDu15uFyrdgrKmY7YPv0wAjo2W +QxUNr/SJXh8Za9HKuiRY3seXisAPopLfa/Cu/7CvbIinXwRxCdkic0OpIwzgcJyT +Up7h0c3UiYRVKW/It07+bmK+YD4/bv+mm39rJ7RpHGv2CfKzdlhOzixuvKW3b/Ho +wrSPX/VjzK8+ijLSW2cYlR+BU64FUhKDaIhMXJbRkQ+MjE4tS15ud7SnjQqSWjqs +Pv7Ot6rVVDRj4P3hvGzzsNPXXo/2QvHoOgsMWJuneaf+didcyafLe8qAMTXglWpz +rYEK++sen3zn2CsPzGjvl5DEddhUFXvU+hs1uk4YwexXpHy6tmDqmqkDOvs= +-----END CERTIFICATE----- diff --git a/tests/docker/nc-1/nc-1.nl/certs/key.pem b/tests/docker/nc-1/nc-1.nl/certs/key.pem new file mode 100644 index 0000000..a0c16e0 --- /dev/null +++ b/tests/docker/nc-1/nc-1.nl/certs/key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpgIBAAKCAQEA5Kamt1JtmgKDCi43KpjoR+f52/Uwl8iY+f13D/ErY2KU+3J5 +2NkJfc6ZWRErYG9lwFu9RcyefrZ8SfrF95i/soF40Lj9Y1eiNnBp29EsMu/YwX+M +SfHLOUiX221gAfGyNasa7xwEj5G8gZh8tLdbAJ7d0rXEP2ltGrdGxdAnZIdENFje +c4PZl+aGZk8+iOHUCZdayVqW2IQsYacuQ/zNqQ11X+8YUm+odAc6CupS2N/9Nnjs +wHGFS40CCIJn3Edo6TyoBAPMjpDSSFUoZbrWXV3XEsOhBtQS6UoNKFHx3T1cMldp +5gqGSLdOY48K02LHSgUALAvJmpguEDX0MQmWOQIDAQABAoIBAQDYIDo30B8vUy5/ +4f1dM1lkFn6TjeiXoBIRQqdXF1Q2xgkiwCsycLxLAYzrppIEvmdEcrKulmI+Tcmf +t/2GMwkH9t+3ExTX4Q7APHOjRs1rfFC7Xg/CGV5J0DdSPslgLRCRMCHuX+JjvpKb +QQKnYyUOqhvsvsk4UzPA6/pmooGJv5SZ4fb4lgN32K5jiRkWYAG64y3zo1eTQPp2 +w//dk2q3piTpuXGav7aHzjpBj6Fd+B3WdTSXmy6qY1OwmpCz7DWYFc/G5lr+KUjC +SJVzPYKltY53sgIEWYQN3hzxqM7yfM9wG6dbLpueR930qxIOMb3aDwwcswLLqmiP +T6V2Ijg9AoGBAPckGeZNLdgFtHeBELmAzYvDElX3xXuDC9Ivn3ZvebH54ndL5aaA +TxPou6SJaTzVYx+2P/vZ7eRJGSqhzWGBZSqWxkk3XahNMot30ce7ksH5C5uY0rWL +7ylwtAgLnEzkMVkBmiMdzNr53h10zzvLWNkZSouz+TJoNOx31CyxEScvAoGBAOzY +4CLGXp5A8+yRyxclC0KwTR5HuRaP+xdghhKh8eWY0uAotvtnzrV3U+Pkq3QOUTSa +zYswxv0WywNvGF3E5qR6WBZiuxX94eDkBYipDacBkIFWF9/lHpv0do0fwqnjra2/ +/G/LYK5buTVPmIaUA4Q5VCC4MnaJ21O0jpK3Lb8XAoGBAN7Nihfo3nqQ8hiGn9hM ++YGVlJMyM7Rc+Sw9SMqSRykfeX5JSzlnFWOCfqAgTWLNkXaGbHqWBvS2vdyEUE8m +Q1k44nwhUOso5Xd8xwAE55K9/iwBg3yuMieu9m8GYJulYaO3YQlllUiY2Ri/NRDY +Czp1pZH65578+TFx+jNsUmV7AoGBAKHojCgZlVr3qggBjmUPBMic/ssBWszKtmo/ +qMeZ/2Pl+doU2ym3x/4TSbzTeEWI+AhO/s31FUK0TynUy0JmtQihPhBng98/xCbZ +mdLXRibxkdhogz+iQC96iYRlvswmgXbydF30GO54c363H9x32IOOMS2A3bZc/RsW +phQztskXAoGBAKgF6mSRJIXyz/H+fSnhNdlRqPwBSYWlrG7Y3OJOXdgqSvuFS1Zn +HgS9vdBHVKS7l0dLGr4bkVqHCDSZJ2BgTemYMu9K3LdNv0r3bppKPDacG9VLPN/7 +jH8xNAWtG5NYBfu6ww0N40z8IO+zhXWmZ/DJZ99DdhPg/zeRmCbfJaQz +-----END RSA PRIVATE KEY----- diff --git a/tests/docker/nc-1/nc-1.nl/nc-1-nginx-proxy.conf b/tests/docker/nc-1/nc-1.nl/nc-1-nginx-proxy.conf new file mode 100644 index 0000000..b81113c --- /dev/null +++ b/tests/docker/nc-1/nc-1.nl/nc-1-nginx-proxy.conf @@ -0,0 +1,53 @@ + server { + listen 443 ssl; + server_name nc-1.nl; + + client_max_body_size 20M; + ssl_certificate /etc/nginx/certs/nc-1/cert.pem; + ssl_certificate_key /etc/nginx/certs/nc-1/key.pem; + + error_page 497 301 =307 https://localhost:443$request_uri; + + ssl_session_cache builtin:1000 shared:SSL:10m; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; + ssl_prefer_server_ciphers on; + + location / { + proxy_pass http://nc-1:80; + + proxy_set_header Host nc-1; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection $connection_upgrade; + + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + } + } + server { + listen 80; + server_name nc-1.nl; + + location / { + proxy_pass http://nc-1:80; + + proxy_set_header Host nc-1; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection $connection_upgrade; + + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + } + } diff --git a/tests/docker/nginx-proxy/Dockerfile b/tests/docker/nginx-proxy/Dockerfile new file mode 100644 index 0000000..a98da12 --- /dev/null +++ b/tests/docker/nginx-proxy/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1.25.2 as builder + +COPY nc-1/nc-1.nl/nc-1-nginx-proxy.conf /etc/nginx/conf.d/nc-1.conf +COPY nc-1/nc-1.nl/certs /etc/nginx/certs/nc-1/