From 9f576ab02af0578265134c1e728b6703f14d5a7d Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Fri, 27 Oct 2017 09:16:35 +0530
Subject: [PATCH 001/348] Fix the missing argument to DecryptAll
logger is the last argument to DecryptAll which
was missing when DecryptAll is called. This change
fixes the same.
Signed-off-by: Sujith H
---
lib/Command/RecreateMasterKey.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Command/RecreateMasterKey.php b/lib/Command/RecreateMasterKey.php
index 1da833dc..23477a5c 100644
--- a/lib/Command/RecreateMasterKey.php
+++ b/lib/Command/RecreateMasterKey.php
@@ -240,7 +240,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
protected function decryptAllUsers(InputInterface $input, OutputInterface $output) {
- $this->decryptAll = new DecryptAll($this->encryptionManager, $this->userManager, $this->rootView);
+ $this->decryptAll = new DecryptAll($this->encryptionManager, $this->userManager, $this->rootView, $this->logger);
$this->decryptAll->decryptAll($input,$output);
}
From 1965482b7a247040836b14ad756eadd5c7565b9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Fri, 17 Nov 2017 16:40:12 +0100
Subject: [PATCH 002/348] Add codecov.io
---
.travis.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 74350c44..539b2c7f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,6 +49,9 @@ script:
- sh -c "if [ '$INTEGRATION' != '1' -a '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' -a '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi"
- cd ..
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
+
matrix:
include:
# - php: 5.6
From df0875d790261b6849eef77d8327ada8e3b65a67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Tue, 19 Dec 2017 10:28:49 +0100
Subject: [PATCH 003/348] Add php 7.2
---
.travis.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.travis.yml b/.travis.yml
index 539b2c7f..2d94f5b0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,7 @@ php:
- 5.6
- 7.0
- 7.1
+ - 7.2
- nightly
env:
From abbb595f17c48f4f74d48a2341154e2774bc645e Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Mon, 22 Jan 2018 19:15:10 +0530
Subject: [PATCH 004/348] Clear text when recovery key is dsiabled
When recovery key is disabled after enabled
earlier, the password texts are cleared.
Signed-off-by: Sujith H
---
js/settings-admin.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/js/settings-admin.js b/js/settings-admin.js
index d7aafec1..e5fb491f 100644
--- a/js/settings-admin.js
+++ b/js/settings-admin.js
@@ -103,6 +103,8 @@ $(document).ready(function () {
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
$('input:button[name="enableRecoveryKey"]').attr('value', 'Enable recovery key');
$('input:button[name="enableRecoveryKey"]').attr('status', '0');
+ $("#encryptionRecoveryPassword").val("");
+ $("#repeatEncryptionRecoveryPassword").val("");
} else {
$('input:password[name="changeRecoveryPassword"]').val("");
$('p[name="changeRecoveryPasswordBlock"]').removeClass("hidden");
From 1add5bf881f70441d2318f6a7d24ccb093a23d20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Wed, 14 Mar 2018 09:42:06 +0100
Subject: [PATCH 005/348] Test properly with core branch master and stable10
---
.travis.yml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 2d94f5b0..6d2dd4ec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ php:
env:
global:
- - CORE_BRANCH=master
+ - CORE_BRANCH=stable10
- APP_NAME=encryption
matrix:
- DB=sqlite
@@ -61,6 +61,10 @@ matrix:
# env: DB=mysql CODECHECK=1
- php: 5.6
env: DB=mysql CODECHECK=2
+ - php: 7.1
+ env: DB=mysql CORE_BRANCH=master
+ - php: 7.2
+ env: DB=mysql CORE_BRANCH=master
allow_failures:
- php: nightly
fast_finish: true
From 21083239fcc091103b9abc417a84a55e4e74152d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Wed, 14 Mar 2018 12:52:41 +0100
Subject: [PATCH 006/348] Ready for 11
---
appinfo/info.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appinfo/info.xml b/appinfo/info.xml
index d5875e98..2a898c67 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -27,7 +27,7 @@
trueopenssl
-
+ OCA\Encryption\Command\SelectEncryptionType
From ce1346b1b45c0290a2c2effebb43e2e40d0aac8a Mon Sep 17 00:00:00 2001
From: Patrick Jahns
Date: Thu, 29 Mar 2018 16:11:42 +0200
Subject: [PATCH 007/348] bootstrap drone for testing encryption
---
.drone.yml | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 123 insertions(+)
create mode 100644 .drone.yml
diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 00000000..1b5b23fe
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,123 @@
+workspace:
+ base: /var/www/owncloud
+ path: apps/encryption
+
+branches: [master, release*]
+
+pipeline:
+ install-server:
+ image: owncloudci/core
+ pull: true
+ exclude: "apps/encryption"
+ version: ${OC_VERSION}
+
+ code-check:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - ../../lib/composer/bin/parallel-lint . --exclude 3rdparty --exclude build .
+ #- cd /var/www/owncloud
+ #- php ./occ app:check-code encryption -c private -c strong-comparison
+ #- php ./occ app:check-code encryption -c deprecation
+
+ phpunit:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - ../../lib/composer/bin/phpunit --configuration tests/phpunit.xml
+
+ configure-server:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - cd /var/www/owncloud
+ - php occ a:l
+ - php occ a:e testing
+ - php occ a:l
+ - php occ config:system:set trusted_domains 1 --value=server
+ - php occ config:system:set trusted_domains 2 --value=federated
+ - php occ log:manage --level 0
+ - php occ config:list
+
+ api-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - TEST_SERVER_URL=http://server/ocs/
+ - TEST_SERVER_FED_URL=http://federated/ocs/
+ commands:
+ - cd /var/www/owncloud
+ - ./tests/drone/test-api-acceptance.sh
+ when:
+ matrix:
+ TEST_SUITE: api
+
+ webui-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - BROWSER=chrome
+ - SELENIUM_HOST=selenium
+ - SRV_HOST_NAME=server
+ - SRV_HOST_PORT=80
+ - REMOTE_FED_SRV_HOST_NAME=federated
+ - REMOTE_FED_SRV_HOST_PORT=80
+ - SKELETON_DIR=/drone/src/tests/acceptance/webUISkeleton
+ - SELENIUM_PORT=4444
+ - PLATFORM=Linux
+ commands:
+ - cd /var/www/owncloud
+ - bash tests/travis/start_ui_tests.sh --remote
+ when:
+ matrix:
+ TEST_SUITE: selenium
+
+ selenium:
+ image: selenium/standalone-chrome-debug:latest
+ pull: true
+ when:
+ matrix:
+ TEST_SUITE: selenium
+
+services:
+ server:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - APACHE_WEBROOT=/drone/src/
+ command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
+ when:
+ matrix:
+ USE_SERVER: true
+
+ federated:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - APACHE_WEBROOT=/drone/src/
+ command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
+ when:
+ matrix:
+ USE_FEDERATED_SERVER: true
+
+matrix:
+ include:
+ #master
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+
+ - PHP_VERSION: 7.2
+ OC_VERSION: daily-master-qa
+
+ # stable10
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+
+ - PHP_VERSION: 7.0
+ OC_VERSION: daily-stable10-qa
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-stable10-qa
+
+ - PHP_VERSION: 7.2
+ OC_VERSION: daily-stable10-qa
From a3095a41758553f3d7ac520b8245ba19cfef1a21 Mon Sep 17 00:00:00 2001
From: Patrick Jahns
Date: Thu, 29 Mar 2018 17:48:31 +0200
Subject: [PATCH 008/348] enable app for testing
---
.drone.yml | 174 ++++++++++++++++++++++++++++++++++++++++----
tests/bootstrap.php | 1 +
2 files changed, 162 insertions(+), 13 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index 1b5b23fe..4492d9c4 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -6,10 +6,12 @@ branches: [master, release*]
pipeline:
install-server:
- image: owncloudci/core
+ image: patrickjahns/occore
pull: true
exclude: "apps/encryption"
version: ${OC_VERSION}
+ db_type: ${DB_TYPE}
+ db_host: ${DB_HOST}
code-check:
image: owncloudci/php:${PHP_VERSION}
@@ -19,12 +21,20 @@ pipeline:
#- cd /var/www/owncloud
#- php ./occ app:check-code encryption -c private -c strong-comparison
#- php ./occ app:check-code encryption -c deprecation
+ when:
+ matrix:
+ TEST_SUITE: phpunit
+
phpunit:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- - ../../lib/composer/bin/phpunit --configuration tests/phpunit.xml
+ - ../../lib/composer/bin/phpunit --configuration tests/phpunit.xml --log-junit tests/output/junit/report2.xml
+ when:
+ matrix:
+ TEST_SUITE: phpunit
+
configure-server:
image: owncloudci/php:${PHP_VERSION}
@@ -33,20 +43,31 @@ pipeline:
- cd /var/www/owncloud
- php occ a:l
- php occ a:e testing
+ - php occ a:e encryption
+ - php occ encryption:enable
+ - php occ encryption:select-encryption-type ${ENCRYPTION_TYPE} --yes
- php occ a:l
- php occ config:system:set trusted_domains 1 --value=server
- php occ config:system:set trusted_domains 2 --value=federated
- php occ log:manage --level 0
- php occ config:list
+ - chown -R www-data. /var/www/owncloud
+ when:
+ matrix:
+ PREPARE_ACCEPTANCE: true
+
api-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- - TEST_SERVER_URL=http://server/ocs/
- - TEST_SERVER_FED_URL=http://federated/ocs/
+ - TEST_SERVER_URL=http://server/
+ - TEST_SERVER_FED_URL=http://federated/
+ - BEHAT_FILTER_TAGS=~@no_encryption
commands:
- cd /var/www/owncloud
+ - chmod +x ./tests/drone/test-api-acceptance.sh
+ - chmod +x ./tests/acceptance/run.sh
- ./tests/drone/test-api-acceptance.sh
when:
matrix:
@@ -62,29 +83,32 @@ pipeline:
- SRV_HOST_PORT=80
- REMOTE_FED_SRV_HOST_NAME=federated
- REMOTE_FED_SRV_HOST_PORT=80
- - SKELETON_DIR=/drone/src/tests/acceptance/webUISkeleton
+ - SKELETON_DIR=/var/www/owncloud/tests/acceptance/webUISkeleton
- SELENIUM_PORT=4444
- PLATFORM=Linux
+ - MAILHOG_HOST=email
commands:
- cd /var/www/owncloud
- - bash tests/travis/start_ui_tests.sh --remote
+ - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R
+ - bash tests/travis/start_ui_tests.sh --remote --all-suites
when:
matrix:
TEST_SUITE: selenium
- selenium:
- image: selenium/standalone-chrome-debug:latest
- pull: true
+ print-log:
+ image: owncloudci/php
+ commands:
+ - cat /var/www/owncloud/data/owncloud.log
when:
- matrix:
- TEST_SUITE: selenium
+ status: [ failure ]
+
services:
server:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- - APACHE_WEBROOT=/drone/src/
+ - APACHE_WEBROOT=/var/www/owncloud
command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
when:
matrix:
@@ -94,30 +118,154 @@ services:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- - APACHE_WEBROOT=/drone/src/
+ - APACHE_WEBROOT=/var/www/owncloud
command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
when:
matrix:
USE_FEDERATED_SERVER: true
+ selenium:
+ image: selenium/standalone-chrome-debug:latest
+ pull: true
+ when:
+ matrix:
+ TEST_SUITE: selenium
+
+ mysql:
+ image: mysql:5.7
+ environment:
+ - MYSQL_USER=owncloud
+ - MYSQL_PASSWORD=owncloud
+ - MYSQL_DATABASE=owncloud
+ - MYSQL_ROOT_PASSWORD=owncloud
+ when:
+ matrix:
+ DB_HOST: mysql
+
+ email:
+ image: mailhog/mailhog
+ pull: true
+ when:
+ matrix:
+ TEST_SUITE: selenium
+
+
matrix:
include:
+ # UnitTests
+
#master
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: sqlite
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: sqlite
# stable10
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: sqlite
- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: sqlite
- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: sqlite
- PHP_VERSION: 7.2
OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: sqlite
+
+ # Acceptance Tests
+
+ ## API
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ ## UI
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
\ No newline at end of file
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 87bae88d..e1d3b1a7 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -33,3 +33,4 @@
// Fix for "Autoload path not allowed: .../notifications/tests/testcase.php"
\OC_App::loadApp('encryption');
+\OC_App::enable('encryption');
From 60184ae2ba1c73b39a8c4834d0bc82a78eb9fc83 Mon Sep 17 00:00:00 2001
From: Patrick Jahns
Date: Sun, 27 May 2018 22:57:13 +0200
Subject: [PATCH 009/348] bootstrap unit tests
---
.drone.yml | 206 +++++-----------------------------------------
tests/phpunit.xml | 2 +-
2 files changed, 20 insertions(+), 188 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index 4492d9c4..4f061f86 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -2,7 +2,7 @@ workspace:
base: /var/www/owncloud
path: apps/encryption
-branches: [master, release*]
+branches: [master, release*, release/*]
pipeline:
install-server:
@@ -30,70 +30,24 @@ pipeline:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- - ../../lib/composer/bin/phpunit --configuration tests/phpunit.xml --log-junit tests/output/junit/report2.xml
+ - phpdbg -d memory_limit=4096M -rr ../../lib/composer/bin/phpunit --configuration tests/phpunit.xml
when:
matrix:
TEST_SUITE: phpunit
-
- configure-server:
- image: owncloudci/php:${PHP_VERSION}
- pull: true
- commands:
- - cd /var/www/owncloud
- - php occ a:l
- - php occ a:e testing
- - php occ a:e encryption
- - php occ encryption:enable
- - php occ encryption:select-encryption-type ${ENCRYPTION_TYPE} --yes
- - php occ a:l
- - php occ config:system:set trusted_domains 1 --value=server
- - php occ config:system:set trusted_domains 2 --value=federated
- - php occ log:manage --level 0
- - php occ config:list
- - chown -R www-data. /var/www/owncloud
- when:
- matrix:
- PREPARE_ACCEPTANCE: true
-
-
- api-acceptance-tests:
- image: owncloudci/php:${PHP_VERSION}
- pull: true
- environment:
- - TEST_SERVER_URL=http://server/
- - TEST_SERVER_FED_URL=http://federated/
- - BEHAT_FILTER_TAGS=~@no_encryption
- commands:
- - cd /var/www/owncloud
- - chmod +x ./tests/drone/test-api-acceptance.sh
- - chmod +x ./tests/acceptance/run.sh
- - ./tests/drone/test-api-acceptance.sh
- when:
- matrix:
- TEST_SUITE: api
-
- webui-acceptance-tests:
- image: owncloudci/php:${PHP_VERSION}
+ codecov:
+ image: plugins/codecov:2
+ secrets: [codecov_token]
pull: true
- environment:
- - BROWSER=chrome
- - SELENIUM_HOST=selenium
- - SRV_HOST_NAME=server
- - SRV_HOST_PORT=80
- - REMOTE_FED_SRV_HOST_NAME=federated
- - REMOTE_FED_SRV_HOST_PORT=80
- - SKELETON_DIR=/var/www/owncloud/tests/acceptance/webUISkeleton
- - SELENIUM_PORT=4444
- - PLATFORM=Linux
- - MAILHOG_HOST=email
- commands:
- - cd /var/www/owncloud
- - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R
- - bash tests/travis/start_ui_tests.sh --remote --all-suites
+ paths:
+ - tests/output
+ files:
+ - '*.xml'
when:
+ local: false
matrix:
- TEST_SUITE: selenium
+ TEST_SUITE: phpunit
+ PHP_VERSION: 7.1
print-log:
image: owncloudci/php
@@ -102,52 +56,14 @@ pipeline:
when:
status: [ failure ]
-
-services:
- server:
- image: owncloudci/php:${PHP_VERSION}
- pull: true
- environment:
- - APACHE_WEBROOT=/var/www/owncloud
- command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
- when:
- matrix:
- USE_SERVER: true
-
- federated:
- image: owncloudci/php:${PHP_VERSION}
- pull: true
- environment:
- - APACHE_WEBROOT=/var/www/owncloud
- command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
- when:
- matrix:
- USE_FEDERATED_SERVER: true
-
- selenium:
- image: selenium/standalone-chrome-debug:latest
- pull: true
- when:
- matrix:
- TEST_SUITE: selenium
-
- mysql:
- image: mysql:5.7
- environment:
- - MYSQL_USER=owncloud
- - MYSQL_PASSWORD=owncloud
- - MYSQL_DATABASE=owncloud
- - MYSQL_ROOT_PASSWORD=owncloud
- when:
- matrix:
- DB_HOST: mysql
-
- email:
- image: mailhog/mailhog
+ slack:
+ image: plugins/slack:1
pull: true
+ secrets: [ slack_webhook ]
+ channel: builds
when:
- matrix:
- TEST_SUITE: selenium
+ local: false
+ status: [ changed, failure ]
matrix:
@@ -184,88 +100,4 @@ matrix:
- PHP_VERSION: 7.2
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
- DB_TYPE: sqlite
-
- # Acceptance Tests
-
- ## API
- - PHP_VERSION: 5.6
- OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: api
- ENCRYPTION_TYPE: masterkey
- DB_TYPE: mysql
- DB_HOST: mysql
-
- - PHP_VERSION: 5.6
- OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: api
- ENCRYPTION_TYPE: user-keys
- DB_TYPE: mysql
- DB_HOST: mysql
-
- - PHP_VERSION: 7.1
- OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: api
- ENCRYPTION_TYPE: masterkey
- DB_TYPE: mysql
- DB_HOST: mysql
-
- - PHP_VERSION: 7.1
- OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: api
- ENCRYPTION_TYPE: user-keys
- DB_TYPE: mysql
- DB_HOST: mysql
-
- ## UI
- - PHP_VERSION: 5.6
- OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: selenium
- ENCRYPTION_TYPE: masterkey
- DB_TYPE: mysql
- DB_HOST: mysql
-
- - PHP_VERSION: 5.6
- OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: selenium
- ENCRYPTION_TYPE: user-keys
- DB_TYPE: mysql
- DB_HOST: mysql
-
- - PHP_VERSION: 7.1
- OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: selenium
- ENCRYPTION_TYPE: masterkey
- DB_TYPE: mysql
- DB_HOST: mysql
-
- - PHP_VERSION: 7.1
- OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- USE_FEDERATED_SERVER: true
- TEST_SUITE: selenium
- ENCRYPTION_TYPE: user-keys
- DB_TYPE: mysql
- DB_HOST: mysql
\ No newline at end of file
+ DB_TYPE: sqlite
\ No newline at end of file
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 42f8fc93..6e202f1b 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -19,7 +19,7 @@
-
+
From f34150b1304cb61ca15c7cc78bf2092b13319dbf Mon Sep 17 00:00:00 2001
From: Patrick Jahns
Date: Sun, 27 May 2018 23:07:38 +0200
Subject: [PATCH 010/348] add scrutinizer
---
.drone.yml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/.drone.yml b/.drone.yml
index 4f061f86..478826c9 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -49,6 +49,18 @@ pipeline:
TEST_SUITE: phpunit
PHP_VERSION: 7.1
+ scrutinizer:
+ image: owncloudci/php:7.1
+ pull: true
+ commands:
+ - wget -q https://scrutinizer-ci.com/ocular.phar
+ - php ocular.phar code-coverage:upload --format=php-clover tests/output/clover.xml --access-token="09d3585a3ed80b16c3b9eed9912b27cfd85e6ed8c190d95893a02bef73dbde68"
+ when:
+ local: false
+ matrix:
+ TEST_SUITE: phpunit
+ PHP_VERSION: 7.1
+
print-log:
image: owncloudci/php
commands:
@@ -64,6 +76,7 @@ pipeline:
when:
local: false
status: [ changed, failure ]
+ event: [ push, tag ]
matrix:
From 01cfeb2a45af964a4025f2ff59c60e79ea33bc9f Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Wed, 30 May 2018 16:43:13 +0530
Subject: [PATCH 011/348] Use '.part' name appended to the file name for
encryptall and exclude encrypting incoming share
When dealing with copy and rename operation in
encryptall, its better to use '.part' appended
to the file name.
Exclude encrypting incoming share.
Signed-off-by: Sujith H
---
lib/Crypto/EncryptAll.php | 6 ++-
tests/Crypto/EncryptAllTest.php | 91 +++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/lib/Crypto/EncryptAll.php b/lib/Crypto/EncryptAll.php
index 59942d50..d1c0579d 100644
--- a/lib/Crypto/EncryptAll.php
+++ b/lib/Crypto/EncryptAll.php
@@ -265,6 +265,10 @@ protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) {
while ($root = array_pop($directories)) {
$content = $this->rootView->getDirectoryContent($root);
foreach ($content as $file) {
+ // only encrypt files owned by the user, exclude incoming local shares, and incoming federated shares
+ if ($file->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
+ continue;
+ }
$path = $root . '/' . $file['name'];
if ($this->rootView->is_dir($path)) {
$directories[] = $path;
@@ -290,7 +294,7 @@ protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) {
protected function encryptFile($path) {
$source = $path;
- $target = $path . '.encrypted.' . time();
+ $target = $path . '.encrypted.' . time() . '.part';
try {
$this->keyManager->setVersion($source, 0, $this->rootView);
diff --git a/tests/Crypto/EncryptAllTest.php b/tests/Crypto/EncryptAllTest.php
index 3972b3d1..1b052fd4 100644
--- a/tests/Crypto/EncryptAllTest.php
+++ b/tests/Crypto/EncryptAllTest.php
@@ -25,10 +25,24 @@
namespace OCA\Encryption\Tests\Crypto;
+use OC\Files\FileInfo;
+use OC\Files\Storage\Common;
+use OC\Files\View;
use OCA\Encryption\Crypto\EncryptAll;
+use Symfony\Component\Console\Helper\ProgressBar;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
+use Test\Traits\UserTrait;
+/**
+ * Class EncryptAllTest
+ *
+ * @group DB
+ *
+ * @package OCA\Encryption\Tests\Crypto
+ */
class EncryptAllTest extends TestCase {
+ use UserTrait;
/** @var \PHPUnit_Framework_MockObject_MockObject | \OCA\Encryption\KeyManager */
protected $keyManager;
@@ -321,7 +335,84 @@ function($path) {
->disableOriginalConstructor()->getMock();
$this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
+ }
+
+ public function testEncryptUsersFilesIncomingShares() {
+ /** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
+ $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ ->setConstructorArgs(
+ [
+ $this->setupUser,
+ $this->userManager,
+ $this->view,
+ $this->keyManager,
+ $this->util,
+ $this->config,
+ $this->mailer,
+ $this->l,
+ $this->questionHelper,
+ $this->secureRandom
+ ]
+ )
+ ->setMethods(['encryptFile', 'setupUserFS'])
+ ->getMock();
+
+ $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
+
+ $commonStorage = $this->createMock(Common::class);
+ $commonStorage->expects($this->once())
+ ->method('instanceOfStorage')
+ ->with('\OCA\Files_Sharing\ISharedStorage')
+ ->willReturn(true);
+ $fileInfo = $this->createMock(FileInfo::class);
+ $fileInfo->expects($this->once())
+ ->method('getStorage')
+ ->willReturn($commonStorage);
+ $this->view->expects($this->any())
+ ->method('getDirectoryContent')
+ ->with('/user1/files')
+ ->willReturn([$fileInfo]);
+
+ $outputInterface = $this->createMock(OutputInterface::class);
+ $progressBar = new ProgressBar($outputInterface);
+
+ $result = $this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
+ $this->assertNull($result);
+ }
+
+ public function testEncryptFileFileId() {
+ $this->createUser('user1', 'user1');
+ \OC::$server->getUserFolder('user1');
+
+ $view = new View('/user1/files');
+ $view->touch('bar.txt');
+ $oldFileInfo = $view->getFileInfo('bar.txt');
+
+ /** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
+ $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ ->setConstructorArgs(
+ [
+ $this->setupUser,
+ $this->userManager,
+ $this->view,
+ $this->keyManager,
+ $this->util,
+ $this->config,
+ $this->mailer,
+ $this->l,
+ $this->questionHelper,
+ $this->secureRandom
+ ]
+ )
+ ->setMethods(['setupUserFS'])
+ ->getMock();
+
+ $result = $this->invokePrivate($encryptAll, 'encryptFile', ['/user1/files/bar.txt']);
+ $this->assertTrue($result);
+ $view1 = new View('/');
+ $fileInfo = $view1->getFileInfo('/user1/files/bar.txt');
+ $this->assertEquals($fileInfo->getId(), $oldFileInfo->getId());
}
public function testGenerateOneTimePassword() {
From 3c6050e6033601379db47d8e7ea2d77b090738d6 Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Fri, 1 Jun 2018 15:52:38 +0530
Subject: [PATCH 012/348] Enable user-keys if no encryption mode is enabled
during login
Enable user-keys if no encryption mode is enabled
during user login.
Signed-off-by: Sujith H
---
lib/AppInfo/Application.php | 2 +-
lib/Hooks/UserHooks.php | 14 +++++++++++++-
tests/Hooks/UserHooksTest.php | 28 +++++++++++++++++++++-------
3 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 38beb92c..7062856b 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -94,7 +94,7 @@ public function registerHooks() {
$container->query('Util'),
$container->query('Session'),
$container->query('Crypt'),
- $container->query('Recovery'))
+ $container->query('Recovery'), $server->getConfig())
]);
$hookManager->fireHooks();
diff --git a/lib/Hooks/UserHooks.php b/lib/Hooks/UserHooks.php
index 5846b7b2..05c87e90 100644
--- a/lib/Hooks/UserHooks.php
+++ b/lib/Hooks/UserHooks.php
@@ -26,6 +26,7 @@
use OC\Files\Filesystem;
+use OCP\IConfig;
use OCP\IUserManager;
use OCP\Util as OCUtil;
use OCA\Encryption\Hooks\Contracts\IHook;
@@ -76,6 +77,10 @@ class UserHooks implements IHook {
* @var Crypt
*/
private $crypt;
+ /**
+ * @var IConfig
+ */
+ private $config;
/**
* UserHooks constructor.
@@ -89,6 +94,7 @@ class UserHooks implements IHook {
* @param Session $session
* @param Crypt $crypt
* @param Recovery $recovery
+ * @param IConfig $config
*/
public function __construct(KeyManager $keyManager,
IUserManager $userManager,
@@ -98,7 +104,7 @@ public function __construct(KeyManager $keyManager,
Util $util,
Session $session,
Crypt $crypt,
- Recovery $recovery) {
+ Recovery $recovery, IConfig $config) {
$this->keyManager = $keyManager;
$this->userManager = $userManager;
@@ -109,6 +115,7 @@ public function __construct(KeyManager $keyManager,
$this->session = $session;
$this->recovery = $recovery;
$this->crypt = $crypt;
+ $this->config = $config;
}
/**
@@ -166,6 +173,11 @@ public function login($params) {
$this->userSetup->setupUser($params['uid'], $params['password']);
}
+ if (($this->util->isMasterKeyEnabled() === false) &&
+ ($this->config->getAppValue('encryption', 'userSpecificKey', '') === '')) {
+ $this->config->setAppValue('encryption', 'userSpecificKey', '1');
+ }
+
$this->keyManager->init($params['uid'], $params['password']);
}
diff --git a/tests/Hooks/UserHooksTest.php b/tests/Hooks/UserHooksTest.php
index 8acfcc7f..51514d67 100644
--- a/tests/Hooks/UserHooksTest.php
+++ b/tests/Hooks/UserHooksTest.php
@@ -30,6 +30,8 @@
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Hooks\UserHooks;
+use OCA\Encryption\Util;
+use OCP\IConfig;
use Test\TestCase;
/**
@@ -76,6 +78,7 @@ class UserHooksTest extends TestCase {
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $loggerMock;
+ private $config;
/**
* @var UserHooks
*/
@@ -92,6 +95,12 @@ public function testLogin() {
->method('init')
->with('testUser', 'password');
+ $this->config->expects($this->once())
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['encryption', 'userSpecificKey', '', ''],
+ ]);
+
$this->assertNull($this->instance->login($this->params));
}
@@ -136,7 +145,8 @@ public function testPreSetPassphrase($canChange) {
$this->utilMock,
$this->sessionMock,
$this->cryptMock,
- $this->recoveryMock
+ $this->recoveryMock,
+ $this->config
]
)
->setMethods(['setPassphrase'])
@@ -215,7 +225,8 @@ public function testSetPassphrase() {
$this->utilMock,
$this->sessionMock,
$this->cryptMock,
- $this->recoveryMock
+ $this->recoveryMock,
+ $this->config
]
)->setMethods(['initMountPoints'])->getMock();
@@ -278,7 +289,8 @@ public function testSetPasswordNoUser() {
$this->utilMock,
$this->sessionMock,
$this->cryptMock,
- $this->recoveryMock
+ $this->recoveryMock,
+ $this->config
]
)->setMethods(['initMountPoints'])->getMock();
@@ -331,9 +343,9 @@ protected function setUp() {
->method($this->anything())
->will($this->returnSelf());
- $utilMock = $this->getMockBuilder('OCA\Encryption\Util')
+ /*$utilMock = $this->getMockBuilder('OCA\Encryption\Util')
->disableOriginalConstructor()
- ->getMock();
+ ->getMock();*/
$sessionMock = $this->getMockBuilder('OCA\Encryption\Session')
->disableOriginalConstructor()
@@ -345,10 +357,11 @@ protected function setUp() {
$recoveryMock = $this->getMockBuilder('OCA\Encryption\Recovery')
->disableOriginalConstructor()
->getMock();
+ $this->config = $this->createMock(IConfig::class);
$this->sessionMock = $sessionMock;
$this->recoveryMock = $recoveryMock;
- $this->utilMock = $utilMock;
+ $this->utilMock = $this->createMock(Util::class);
$this->utilMock->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
$this->instance = $this->getMockBuilder('OCA\Encryption\Hooks\UserHooks')
@@ -362,7 +375,8 @@ protected function setUp() {
$this->utilMock,
$this->sessionMock,
$this->cryptMock,
- $this->recoveryMock
+ $this->recoveryMock,
+ $this->config
]
)->setMethods(['setupFS'])->getMock();
From 7021243b51b2fd83273b5982cfa8c628bceb5fed Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Mon, 2 Jul 2018 14:18:36 +0530
Subject: [PATCH 013/348] Fix login exception in decryptall
When the decryptall is called with user-keys
enabled, make sure the password provided by
user is correct else throw exception.
Signed-off-by: Sujith H
---
lib/AppInfo/Application.php | 1 +
lib/Crypto/DecryptAll.php | 29 +++++++++++++++
tests/Crypto/DecryptAllTest.php | 64 +++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+)
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 7062856b..ba20d313 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -259,6 +259,7 @@ function(IAppContainer $c) {
$c->query('KeyManager'),
$c->query('Crypt'),
$c->query('Session'),
+ $c->getServer()->getUserManager(),
new QuestionHelper()
);
}
diff --git a/lib/Crypto/DecryptAll.php b/lib/Crypto/DecryptAll.php
index 52ab9e80..3500edca 100644
--- a/lib/Crypto/DecryptAll.php
+++ b/lib/Crypto/DecryptAll.php
@@ -23,9 +23,11 @@
namespace OCA\Encryption\Crypto;
+use OC\User\LoginException;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Session;
use OCA\Encryption\Util;
+use OCP\IUserManager;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -49,6 +51,9 @@ class DecryptAll {
/** @var Session */
protected $session;
+ /** @var IUserManager */
+ protected $userManager;
+
/**
* @param Util $util
* @param KeyManager $keyManager
@@ -61,22 +66,28 @@ public function __construct(
KeyManager $keyManager,
Crypt $crypt,
Session $session,
+ IUserManager $userManager,
QuestionHelper $questionHelper
) {
$this->util = $util;
$this->keyManager = $keyManager;
$this->crypt = $crypt;
$this->session = $session;
+ $this->userManager = $userManager;
$this->questionHelper = $questionHelper;
}
/**
* prepare encryption module to decrypt all files
*
+ * - Throws LoginException when user login fails either recovery password fails
+ * or if the user password fails
+ *
* @param InputInterface $input
* @param OutputInterface $output
* @param $user
* @return bool
+ * @throws LoginException
*/
public function prepare(InputInterface $input, OutputInterface $output, $user) {
@@ -115,6 +126,24 @@ public function prepare(InputInterface $input, OutputInterface $output, $user) {
$question->setHidden(true);
$question->setHiddenFallback(false);
$password = $this->questionHelper->ask($input, $output, $question);
+
+
+ $throwLoginException = false;
+ if ($recoveryKeyId === $user) {
+ try {
+ if ($this->keyManager->checkRecoveryPassword($password) === false) {
+ $throwLoginException = true;
+ }
+ } catch (\Exception $e) {
+ $throwLoginException = true;
+ }
+ } elseif ($this->userManager->checkPassword($user, $password) === false) {
+ $throwLoginException = true;
+ }
+
+ if ($throwLoginException === true) {
+ throw new LoginException('Invalid credentials provided');
+ }
}
$privateKey = $this->getPrivateKey($user, $password);
diff --git a/tests/Crypto/DecryptAllTest.php b/tests/Crypto/DecryptAllTest.php
index 0dcd1bee..2e0d08ec 100644
--- a/tests/Crypto/DecryptAllTest.php
+++ b/tests/Crypto/DecryptAllTest.php
@@ -24,15 +24,27 @@
namespace OCA\Encryption\Tests\Crypto;
+use OC\User\LoginException;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Crypto\DecryptAll;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Session;
use OCA\Encryption\Util;
+use OCP\IUserManager;
use Symfony\Component\Console\Helper\QuestionHelper;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
+use Test\Traits\UserTrait;
+/**
+ * Class DecryptAllTest
+ *
+ * @group DB
+ * @package OCA\Encryption\Tests\Crypto
+ */
class DecryptAllTest extends TestCase {
+ use UserTrait;
/** @var DecryptAll */
protected $instance;
@@ -49,6 +61,8 @@ class DecryptAllTest extends TestCase {
/** @var Session | \PHPUnit_Framework_MockObject_MockObject */
protected $session;
+ protected $userManager;
+
/** @var QuestionHelper | \PHPUnit_Framework_MockObject_MockObject */
protected $questionHelper;
@@ -63,6 +77,7 @@ public function setUp() {
->disableOriginalConstructor()->getMock();
$this->session = $this->getMockBuilder('OCA\Encryption\Session')
->disableOriginalConstructor()->getMock();
+ $this->userManager = $this->createMock(IUserManager::class);
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
@@ -71,6 +86,7 @@ public function setUp() {
$this->keyManager,
$this->crypt,
$this->session,
+ $this->userManager,
$this->questionHelper
);
}
@@ -131,4 +147,52 @@ public function dataTestGetPrivateKey() {
];
}
+ public function providerPrepareLoginException() {
+ return [
+ ['user1'],
+ ['recoverykey'],
+ ['throwExceptionInCheckRecovery']
+ ];
+ }
+ /**
+ * @dataProvider providerPrepareLoginException
+ * @expectedException \OC\User\LoginException
+ * @expectedExceptionMessage Invalid credentials provided
+ */
+ public function testPrepareLoginException($loginType) {
+ $this->createUser('user1', 'pass');
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $this->util->expects($this->once())
+ ->method('isMasterKeyEnabled')
+ ->willReturn(false);
+
+ $this->keyManager->expects($this->any())
+ ->method('getRecoveryKeyId')
+ ->willReturn('xyz');
+
+ $this->questionHelper->expects($this->any())
+ ->method('ask')
+ ->willReturn('foo');
+
+ if ($loginType === 'user1') {
+ $this->userManager->expects($this->any())
+ ->method('checkPassword')
+ ->willReturn(false);
+ $this->instance->prepare($input, $output, 'user1');
+ } elseif ($loginType === 'recoverykey') {
+ $this->keyManager->expects($this->once())
+ ->method('checkRecoveryPassword')
+ ->willReturn(false);
+ $this->instance->prepare($input, $output, 'xyz');
+ } else {
+ $this->keyManager->expects($this->once())
+ ->method('checkRecoveryPassword')
+ ->willThrowException(new \Exception());
+ $this->instance->prepare($input, $output, 'xyz');
+ }
+
+
+ }
}
From 66ebfc76212c11aea5800c2484a3efa43a16abe8 Mon Sep 17 00:00:00 2001
From: Patrick Jahns
Date: Sun, 27 May 2018 23:19:04 +0200
Subject: [PATCH 014/348] initialize ui testing
---
.drone.yml | 511 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 510 insertions(+), 1 deletion(-)
diff --git a/.drone.yml b/.drone.yml
index 478826c9..3ce8a7b1 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -13,6 +13,41 @@ pipeline:
db_type: ${DB_TYPE}
db_host: ${DB_HOST}
+ install-fed-server:
+ image: owncloudci/core
+ pull: true
+ version: ${FEDERATION_OC_VERSION}
+ core_path: /var/www/owncloud/fed-server
+ when:
+ matrix:
+ USE_FEDERATED_SERVER: true
+
+ configure-federation-server:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - cd /var/www/owncloud/fed-server
+ - php occ a:l
+ - php occ a:e testing
+ - php occ a:l
+ - php occ config:system:set trusted_domains 1 --value=server
+ - php occ config:system:set trusted_domains 2 --value=federated
+ - php occ log:manage --level 0
+ - php occ config:list
+ - echo "export TEST_SERVER_FED_URL=http://federated" > /var/www/owncloud/saved-settings.sh
+ when:
+ matrix:
+ USE_FEDERATED_SERVER: true
+
+ fix-permissions-federation-server:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - chown www-data /var/www/owncloud/fed-server -R
+ when:
+ matrix:
+ USE_FEDERATED_SERVER: true
+
code-check:
image: owncloudci/php:${PHP_VERSION}
pull: true
@@ -61,6 +96,49 @@ pipeline:
TEST_SUITE: phpunit
PHP_VERSION: 7.1
+ configure-server:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - cd /var/www/owncloud
+ - php occ a:l
+ - php occ a:e testing
+ - php occ a:e encryption
+ - php occ encryption:enable
+ - php occ encryption:select-encryption-type ${ENCRYPTION_TYPE} --yes
+ - php occ a:l
+ - php occ config:system:set trusted_domains 1 --value=server
+ - php occ config:system:set trusted_domains 2 --value=federated
+ - php occ log:manage --level 0
+ - php occ config:list
+ - chown -R www-data. /var/www/owncloud
+ when:
+ matrix:
+ PREPARE_ACCEPTANCE: true
+
+ webui-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - BROWSER=chrome
+ - SELENIUM_HOST=selenium
+ - TEST_SERVER_URL=http://server
+ - SELENIUM_PORT=4444
+ - PLATFORM=Linux
+ - MAILHOG_HOST=email
+ - DIVIDE_INTO_NUM_PARTS=8
+ - RUN_PART=${PART}
+ commands:
+ - cd /var/www/owncloud/tests/acceptance/
+ - chmod 777 filesForUpload -R
+ - chmod +x run.sh
+ - touch /var/www/owncloud/saved-settings.sh
+ - . /var/www/owncloud/saved-settings.sh
+ - su-exec www-data ./run.sh --remote --type webUI --tags '~@skipOnEncryption&&~@skip'
+ when:
+ matrix:
+ TEST_SUITE: selenium
+
print-log:
image: owncloudci/php
commands:
@@ -78,6 +156,51 @@ pipeline:
status: [ changed, failure ]
event: [ push, tag ]
+services:
+ server:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - APACHE_WEBROOT=/var/www/owncloud
+ command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
+ when:
+ matrix:
+ USE_SERVER: true
+
+ federated:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - APACHE_WEBROOT=/var/www/owncloud/fed-server
+ command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
+ when:
+ matrix:
+ USE_FEDERATED_SERVER: true
+
+ selenium:
+ image: selenium/standalone-chrome-debug:latest
+ pull: true
+ when:
+ matrix:
+ TEST_SUITE: selenium
+
+ mysql:
+ image: mysql:5.7
+ environment:
+ - MYSQL_USER=owncloud
+ - MYSQL_PASSWORD=owncloud
+ - MYSQL_DATABASE=owncloud
+ - MYSQL_ROOT_PASSWORD=owncloud
+ when:
+ matrix:
+ DB_HOST: mysql
+
+ email:
+ image: mailhog/mailhog
+ pull: true
+ when:
+ matrix:
+ TEST_SUITE: selenium
matrix:
include:
@@ -113,4 +236,390 @@ matrix:
- PHP_VERSION: 7.2
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
- DB_TYPE: sqlite
\ No newline at end of file
+ DB_TYPE: sqlite
+
+ # Acceptance Tests
+ ## UI
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 1
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 2
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 3
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 4
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 5
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 6
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 7
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 8
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 1
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 2
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 3
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 4
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 5
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 6
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 7
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 8
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 1
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 2
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 3
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 4
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 5
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 6
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 7
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 8
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 1
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 2
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 3
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 4
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 5
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 6
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 7
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ PART: 8
\ No newline at end of file
From 1372b3d525bc7faa452d42bd198cb29e2144c343 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Sat, 11 Aug 2018 18:41:27 +0545
Subject: [PATCH 015/348] Add comment description of each block of UI matrix
jobs
---
.drone.yml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/.drone.yml b/.drone.yml
index 3ce8a7b1..3490920e 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -239,7 +239,7 @@ matrix:
DB_TYPE: sqlite
# Acceptance Tests
- ## UI
+ ## UI core stable10 with masterkey encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
PREPARE_ACCEPTANCE: true
@@ -336,6 +336,7 @@ matrix:
DB_HOST: mysql
PART: 8
+ ## UI core stable10 with user-keys encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
PREPARE_ACCEPTANCE: true
@@ -432,6 +433,7 @@ matrix:
DB_HOST: mysql
PART: 8
+ ## UI core master with masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
PREPARE_ACCEPTANCE: true
@@ -528,6 +530,7 @@ matrix:
DB_HOST: mysql
PART: 8
+ ## UI core master with user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
PREPARE_ACCEPTANCE: true
From 8f535462aa3a0081bfea16b6b85cf83d11e52da0 Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Thu, 26 Jul 2018 21:51:47 +0530
Subject: [PATCH 016/348] Provision to access recovery and oc password from env
It should be able to read recovery password and oc
password from the env. This change helps to do the
same.
Signed-off-by: Sujith H
---
lib/AppInfo/Application.php | 4 +-
lib/Crypto/DecryptAll.php | 142 +++++++++++++-----
tests/Crypto/DecryptAllTest.php | 253 +++++++++++++++++++++++++++++++-
3 files changed, 353 insertions(+), 46 deletions(-)
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index ba20d313..6c4ddbef 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -24,6 +24,7 @@
use OC\Files\View;
+use OC\Helper\EnvironmentHelper;
use OCA\Encryption\Controller\RecoveryController;
use OCA\Encryption\Controller\SettingsController;
use OCA\Encryption\Controller\StatusController;
@@ -260,7 +261,8 @@ function(IAppContainer $c) {
$c->query('Crypt'),
$c->query('Session'),
$c->getServer()->getUserManager(),
- new QuestionHelper()
+ new QuestionHelper(),
+ new EnvironmentHelper()
);
}
);
diff --git a/lib/Crypto/DecryptAll.php b/lib/Crypto/DecryptAll.php
index 3500edca..34e562b9 100644
--- a/lib/Crypto/DecryptAll.php
+++ b/lib/Crypto/DecryptAll.php
@@ -23,6 +23,7 @@
namespace OCA\Encryption\Crypto;
+use OC\Helper\EnvironmentHelper;
use OC\User\LoginException;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Session;
@@ -42,6 +43,9 @@ class DecryptAll {
/** @var QuestionHelper */
protected $questionHelper;
+ /** @var EnvironmentHelper */
+ protected $environmentHelper;
+
/** @var Crypt */
protected $crypt;
@@ -55,11 +59,15 @@ class DecryptAll {
protected $userManager;
/**
+ * DecryptAll constructor.
+ *
* @param Util $util
* @param KeyManager $keyManager
* @param Crypt $crypt
* @param Session $session
+ * @param IUserManager $userManager
* @param QuestionHelper $questionHelper
+ * @param EnvironmentHelper $environmentHelper
*/
public function __construct(
Util $util,
@@ -67,7 +75,8 @@ public function __construct(
Crypt $crypt,
Session $session,
IUserManager $userManager,
- QuestionHelper $questionHelper
+ QuestionHelper $questionHelper,
+ EnvironmentHelper $environmentHelper
) {
$this->util = $util;
$this->keyManager = $keyManager;
@@ -75,70 +84,124 @@ public function __construct(
$this->session = $session;
$this->userManager = $userManager;
$this->questionHelper = $questionHelper;
+ $this->environmentHelper = $environmentHelper;
}
/**
* prepare encryption module to decrypt all files
*
+ * - The value of $user (when called from decrypt-all command ) is as follows:
+ * the uid of user passed, if the oC filesystem is encrypted using user-keys
+ * the empty string '', if the oC filesystem is encrypted using master-key
+ *
* - Throws LoginException when user login fails either recovery password fails
* or if the user password fails
*
* @param InputInterface $input
* @param OutputInterface $output
- * @param $user
+ * @param string|null $user The uid of the user ( a non empty string ) for user-keys, or empty or null string for masterkey decryption
* @return bool
* @throws LoginException
*/
public function prepare(InputInterface $input, OutputInterface $output, $user) {
-
- $question = new Question('Please enter the recovery key password: ');
-
+ // We need to setup the module with everything it needs in order to decrypt user data
+ // This could be using master key or user key encryption
+ // and could also be for a single user or multiple users
+
+ /**
+ * Try to stop decrypting process if password method is used for decrypting all users.
+ * If the decrypt-all command doesn't provide a user, which means decryption of oC
+ * filesystem. And if the method provided is password then it should stop decryption
+ * process, because same password can not be used for every user. Even though the
+ * input user is empty the $user can have value of each user(s) in oC.
+ */
+ if (($input->getArgument('user') === '') && ($input->getOption('method') === 'password')) {
+ $output->writeln('Password method can not be used for decrypting all users.');
+ $output->writeln('Aborting the decryption process');
+ return false;
+ }
+ // First lets work out the mode
if ($this->util->isMasterKeyEnabled()) {
- $output->writeln('Use master key to decrypt all files');
+ $output->writeln('Using master key for decryption');
$user = $this->keyManager->getMasterKeyId();
$password = $this->keyManager->getMasterKeyPassword();
} else {
- $recoveryKeyId = $this->keyManager->getRecoveryKeyId();
- if (!empty($user)) {
- $output->writeln('You can only decrypt the users files if you know');
- $output->writeln('the users password or if he activated the recovery key.');
- $output->writeln('');
- $questionUseLoginPassword = new ConfirmationQuestion(
- 'Do you want to use the user: ' . $user . ' login password to decrypt all files? (y/n) ',
- false
- );
- $useLoginPassword = $this->questionHelper->ask($input, $output, $questionUseLoginPassword);
- if ($useLoginPassword) {
- $question = new Question('Please enter the user\'s login password: ');
- } else if ($this->util->isRecoveryEnabledForUser($user) === false) {
- $output->writeln('No recovery key available for user ' . $user);
- return false;
+ $throwLoginException = false;
+ $output->writeln("Configuring encryption module for decryption with user based keys");
+ // We must be using user key - now finish the prep
+ // Must either be using recovery keys, or just decrypting one user and know their password
+
+ // Check a method has been passed
+ if(!$input->hasOption('method') && !in_array($input->getOption('method'),['recovery', 'password'])) {
+ $output->writeln('A method must be supplied when decrypting from user-key state');
+ return false;
+ }
+ if (empty($user)) {
+ // all users, so only recovery is possible
+ if ($input->getOption('method') === 'recovery' &&
+ (($this->environmentHelper->getEnvVar('OC_RECOVERY_PASSWORD') !== ''))) {
+ // Then we can attempt to use this for all of the users
+ $output->writeln('Attempting to use recovery key from environment for all users. Users must have enabled recovery keys for this to work.');
+ $password = $this->environmentHelper->getEnvVar('OC_RECOVERY_PASSWORD');
} else {
- $user = $recoveryKeyId;
+ $output->writeLn('Recovery key is the only supported method for decrypting all users in one command. The key is read from OC_RECOVERY_PASSWORD.');
+ return false;
}
} else {
- $output->writeln('You can only decrypt the files of all users if the');
- $output->writeln('recovery key is enabled by the admin and activated by the users.');
- $output->writeln('');
- $user = $recoveryKeyId;
- }
-
- $question->setHidden(true);
- $question->setHiddenFallback(false);
- $password = $this->questionHelper->ask($input, $output, $question);
+ // Specific user, password is an option here
+ if ($input->getOption('method') === 'recovery' &&
+ ($this->environmentHelper->getEnvVar('OC_RECOVERY_PASSWORD') !== '')) {
+ if ($this->util->isRecoveryEnabledForUser($user) === false) {
+ $output->writeln('Password recovery is not enabled for ' . $user);
+ return false;
+ }
+ // Then we can attempt to use this for all of the users
+ $output->writeln('Attempting to use recovery key from environment: OC_RECOVERY_PASSWORD');
+ $password = $this->environmentHelper->getEnvVar('OC_RECOVERY_PASSWORD');
+
+ try {
+ if ($this->keyManager->checkRecoveryPassword($password) === false) {
+ $throwLoginException = true;
+ }
+ } catch (\Exception $e) {
+ $throwLoginException = true;
+ }
+ $recoveryKeyId = $this->keyManager->getRecoveryKeyId();
+ $user = $recoveryKeyId;
+ } elseif ($input->getOption('method') === 'password' && ($this->environmentHelper->getEnvVar('OC_PASSWORD') !== '')) {
+ $output->writeln('Attempting to use users password from environment: OC_PASSWORD');
+ // Then we want to use the users password and it has been supplied
+ $password = $this->environmentHelper->getEnvVar('OC_PASSWORD');
- $throwLoginException = false;
- if ($recoveryKeyId === $user) {
- try {
- if ($this->keyManager->checkRecoveryPassword($password) === false) {
+ if ($this->userManager->checkPassword($user, $password) === false) {
$throwLoginException = true;
}
- } catch (\Exception $e) {
- $throwLoginException = true;
+ } elseif ($input->getOption('method') === null) {
+ //Grab user specific password
+ $question = new Question('Please enter the login password for user: ' . $user);
+ $question->setHidden(true);
+ $question->setHiddenFallback(false);
+ $password = $this->questionHelper->ask($input, $output, $question);
+
+ if ($this->userManager->checkPassword($user, $password) === false) {
+ throw new LoginException('Invalid credentials provided');
+ }
+ } else {
+ //If method or password is used and the environment is not set, then trigger LoginException
+ if (($input->getOption('method') === 'recovery') || ($input->getOption('method') === 'password')) {
+ if (($this->environmentHelper->getEnvVar('OC_RECOVERY_PASSWORD') === false) ||
+ ($this->environmentHelper->getEnvVar('OC_RECOVERY_PASSWORD') === '')) {
+ $output->writeln('Recovery password not set in the envrironment');
+ $throwLoginException = true;
+ } elseif (($this->environmentHelper->getEnvVar('OC_PASSWORD') === false) ||
+ ($this->environmentHelper->getEnvVar('OC_PASSWORD') === '')) {
+ $output->writeln('OC password not set in the envrironment');
+ $throwLoginException = true;
+ }
+ }
+
}
- } elseif ($this->userManager->checkPassword($user, $password) === false) {
- $throwLoginException = true;
}
if ($throwLoginException === true) {
@@ -154,7 +217,6 @@ public function prepare(InputInterface $input, OutputInterface $output, $user) {
$output->writeln('Could not decrypt private key, maybe you entered the wrong password?');
}
-
return false;
}
diff --git a/tests/Crypto/DecryptAllTest.php b/tests/Crypto/DecryptAllTest.php
index 2e0d08ec..9c2246f1 100644
--- a/tests/Crypto/DecryptAllTest.php
+++ b/tests/Crypto/DecryptAllTest.php
@@ -24,6 +24,7 @@
namespace OCA\Encryption\Tests\Crypto;
+use OC\Helper\EnvironmentHelper;
use OC\User\LoginException;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Crypto\DecryptAll;
@@ -63,6 +64,9 @@ class DecryptAllTest extends TestCase {
protected $userManager;
+ /** @var EnvironmentHelper | \PHPUnit_Framework_MockObject_MockObject */
+ protected $envHelper;
+
/** @var QuestionHelper | \PHPUnit_Framework_MockObject_MockObject */
protected $questionHelper;
@@ -80,6 +84,7 @@ public function setUp() {
$this->userManager = $this->createMock(IUserManager::class);
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
+ $this->envHelper = $this->createMock(EnvironmentHelper::class);
$this->instance = new DecryptAll(
$this->util,
@@ -87,10 +92,50 @@ public function setUp() {
$this->crypt,
$this->session,
$this->userManager,
- $this->questionHelper
+ $this->questionHelper,
+ $this->envHelper
);
}
+ public function providesEnvVal() {
+ return [
+ ['recovery', false],
+ ['recovery', ''],
+ ['password', false],
+ ['password', '']
+ ];
+ }
+
+ /**
+ * @dataProvider providesEnvVal
+ * @expectedException \OC\User\LoginException
+ * @expectedExceptionMessage Invalid credentials provided
+ */
+ public function testPrepareWithUnsetEnv($method, $env) {
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $this->util->expects($this->once())
+ ->method('isMasterKeyEnabled')
+ ->willReturn(false);
+
+ $input->expects($this->once())
+ ->method('hasOption')
+ ->with('method')
+ ->willReturn($method);
+
+ $input->expects($this->any())
+ ->method('getOption')
+ ->with('method')
+ ->willReturn($method);
+
+ $this->envHelper->expects($this->any())
+ ->method('getEnvVar')
+ ->willReturnOnConsecutiveCalls('', $env, $env);
+
+ $this->instance->prepare($input, $output, 'user1');
+ }
+
public function testUpdateSession() {
$this->session->expects($this->once())->method('prepareDecryptAll')
->with('user1', 'key1');
@@ -150,8 +195,7 @@ public function dataTestGetPrivateKey() {
public function providerPrepareLoginException() {
return [
['user1'],
- ['recoverykey'],
- ['throwExceptionInCheckRecovery']
+ ['recoverykey']
];
}
/**
@@ -164,6 +208,11 @@ public function testPrepareLoginException($loginType) {
$input = $this->createMock(InputInterface::class);
$output = $this->createMock(OutputInterface::class);
+ $input->expects($this->once())
+ ->method('hasOption')
+ ->with('method')
+ ->willReturn(true);
+
$this->util->expects($this->once())
->method('isMasterKeyEnabled')
->willReturn(false);
@@ -182,17 +231,211 @@ public function testPrepareLoginException($loginType) {
->willReturn(false);
$this->instance->prepare($input, $output, 'user1');
} elseif ($loginType === 'recoverykey') {
+ $input->expects($this->once())
+ ->method('getOption')
+ ->with('method')
+ ->willReturn('recovery');
+ $this->envHelper->expects($this->exactly(2))
+ ->method('getEnvVar')
+ ->with('OC_RECOVERY_PASSWORD')
+ ->willReturn('foo');
+
+ $this->util->expects($this->once())
+ ->method('isRecoveryEnabledForUser')
+ ->willReturn(true);
+
$this->keyManager->expects($this->once())
->method('checkRecoveryPassword')
->willReturn(false);
$this->instance->prepare($input, $output, 'xyz');
+ }
+ }
+
+ public function providesMasterKeyPrepareResult() {
+ return [
+ [true],
+ [false]
+ ];
+ }
+
+ /**
+ * @dataProvider providesMasterKeyPrepareResult
+ */
+ public function testPrepareMasterKey($expectedResult) {
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $this->util->expects($this->once())
+ ->method('isMasterKeyEnabled')
+ ->willReturn(true);
+ $this->keyManager->expects($this->exactly(2))
+ ->method('getMasterKeyId')
+ ->willReturn('user1');
+ $this->keyManager->expects($this->once())
+ ->method('getMasterKeyPassword')
+ ->willReturn('pass');
+ $this->keyManager->expects($this->once())
+ ->method('getRecoveryKeyId')
+ ->willReturn('user1');
+ if (!$expectedResult) {
+ $this->crypt->expects($this->once())
+ ->method('decryptPrivateKey')
+ ->willReturn(false);
+ }
+
+ $result = $this->instance->prepare($input, $output, 'user1');
+ $this->assertEquals($expectedResult, $result);
+ }
+
+ public function providesUserKeyPrepareResult() {
+ return [
+ [true, 'user1'],
+ [false, 'user1'],
+ [true, ''],
+ [false, '']
+ ];
+ }
+
+ /**
+ * @dataProvider providesUserKeyPrepareResult
+ */
+ public function testPrepareUserKeyWithRecoveryPasswd($expectedResult, $user) {
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $this->util->expects($this->once())
+ ->method('isMasterKeyEnabled')
+ ->willReturn(false);
+
+ if (!(($expectedResult === false) && ($user === ''))) {
+ $input->expects($this->exactly(2))
+ ->method('getOption')
+ ->with('method')
+ ->willReturn('recovery');
+ $this->envHelper->expects($this->any())
+ ->method('getEnvVar')
+ ->with('OC_RECOVERY_PASSWORD')
+ ->willReturn('foo');
} else {
+ $input->expects($this->exactly(1))
+ ->method('getOption')
+ ->with('method')
+ ->willReturn('foo');
+ }
+
+ if (!$expectedResult && ($user !== '')) {
+ $this->util->expects($this->once())
+ ->method('isRecoveryEnabledForUser')
+ ->willReturn(true);
+
$this->keyManager->expects($this->once())
->method('checkRecoveryPassword')
- ->willThrowException(new \Exception());
- $this->instance->prepare($input, $output, 'xyz');
+ ->willReturn(true);
+
+ $this->keyManager->expects($this->exactly(2))
+ ->method('getRecoveryKeyId')
+ ->willReturn($user);
+ }
+
+ if (($expectedResult === true) && ($user === '')) {
+ $this->keyManager->expects($this->exactly(1))
+ ->method('getRecoveryKeyId')
+ ->willReturn($user);
}
+ if ($expectedResult === true) {
+ $this->crypt->expects($this->once())
+ ->method('decryptPrivateKey')
+ ->willReturn(true);
+ } else {
+ if (!(($expectedResult === false) && ($user === ''))) {
+ $this->crypt->expects($this->once())
+ ->method('decryptPrivateKey')
+ ->willReturn(false);
+ }
+ }
+
+
+ $result = $this->instance->prepare($input, $output, $user);
+ $this->assertEquals($expectedResult, $result);
+ }
+
+ /**
+ * @dataProvider providesMasterKeyPrepareResult
+ */
+ public function testPrepareUserKeyWithOCPasswd($expectedResult) {
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $this->util->expects($this->once())
+ ->method('isMasterKeyEnabled')
+ ->willReturn(false);
+
+ $input->expects($this->once())
+ ->method('hasOption')
+ ->willReturn(true);
+ $input->expects($this->exactly(2))
+ ->method('getOption')
+ ->with('method')
+ ->willReturnOnConsecutiveCalls(null, 'password');
+ $this->envHelper->expects($this->any())
+ ->method('getEnvVar')
+ ->willReturnMap([
+ ['OC_RECOVERY_PASSWORD', ''],
+ ['OC_PASSWORD', 'foo']
+ ]);
+
+ $this->userManager->expects($this->once())
+ ->method('checkPassword')
+ ->willReturn(true);
+
+ if ($expectedResult === true) {
+ $this->crypt->expects($this->once())
+ ->method('decryptPrivateKey')
+ ->willReturn(true);
+ } else {
+ $this->crypt->expects($this->once())
+ ->method('decryptPrivateKey')
+ ->willReturn(false);
+ }
+
+ $result = $this->instance->prepare($input, $output, 'user1');
+ $this->assertEquals($expectedResult, $result);
+ }
+
+ public function testPrepareWithWrongMethod() {
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $this->util->expects($this->once())
+ ->method('isMasterKeyEnabled')
+ ->willReturn(false);
+
+ $input->expects($this->once())
+ ->method('hasOption')
+ ->with('method')
+ ->willReturn(false);
+ $input->expects($this->once())
+ ->method('getOption')
+ ->with('method')
+ ->willReturn('foo');
+
+ $this->assertFalse($this->instance->prepare($input, $output, 'user1'));
+ }
+
+ public function testPrepareWithWrongMethodToDecryptAll() {
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
+
+ $input->expects($this->once())
+ ->method('getArgument')
+ ->with('user')
+ ->willReturn('');
+ $input->expects($this->once())
+ ->method('getOption')
+ ->with('method')
+ ->willReturn('password');
+ $this->assertFalse($this->instance->prepare($input, $output, 'user1'));
}
}
From 8b970fb80b5c207a252445f3fd3e6af2efddda7c Mon Sep 17 00:00:00 2001
From: Artur Neumann
Date: Thu, 16 Aug 2018 16:46:30 +0545
Subject: [PATCH 017/348] run encryption specific api acceptance tests
---
.drone.yml | 88 ++++++++++++++++---
tests/acceptance/config/behat.yml | 21 +++++
.../apiEncryption/recreatemasterkey.feature | 15 ++++
.../features/bootstrap/EncryptionContext.php | 70 +++++++++++++++
.../features/bootstrap/bootstrap.php | 33 +++++++
5 files changed, 214 insertions(+), 13 deletions(-)
create mode 100644 tests/acceptance/config/behat.yml
create mode 100644 tests/acceptance/features/apiEncryption/recreatemasterkey.feature
create mode 100644 tests/acceptance/features/bootstrap/EncryptionContext.php
create mode 100644 tests/acceptance/features/bootstrap/bootstrap.php
diff --git a/.drone.yml b/.drone.yml
index 3490920e..3ad4671e 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -13,6 +13,12 @@ pipeline:
db_type: ${DB_TYPE}
db_host: ${DB_HOST}
+ print-log:
+ image: owncloudci/php
+ detach: true
+ commands:
+ - tail -f /var/www/owncloud/data/owncloud.log
+
install-fed-server:
image: owncloudci/core
pull: true
@@ -111,12 +117,34 @@ pipeline:
- php occ config:system:set trusted_domains 2 --value=federated
- php occ log:manage --level 0
- php occ config:list
- - chown -R www-data. /var/www/owncloud
when:
matrix:
PREPARE_ACCEPTANCE: true
- webui-acceptance-tests:
+ fix-permissions:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - chown www-data /var/www/owncloud -R
+ - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R
+ - chmod +x /var/www/owncloud/tests/acceptance/run.sh
+ when:
+ matrix:
+ PREPARE_ACCEPTANCE: true
+
+ api-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - TEST_SERVER_URL=http://server
+ commands:
+ - cd /var/www/owncloud/tests/acceptance/
+ - su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml
+ when:
+ matrix:
+ TEST_SOURCE: encryption
+
+ core-webui-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
@@ -130,21 +158,12 @@ pipeline:
- RUN_PART=${PART}
commands:
- cd /var/www/owncloud/tests/acceptance/
- - chmod 777 filesForUpload -R
- - chmod +x run.sh
- touch /var/www/owncloud/saved-settings.sh
- . /var/www/owncloud/saved-settings.sh
- - su-exec www-data ./run.sh --remote --type webUI --tags '~@skipOnEncryption&&~@skip'
+ - su-exec www-data ./run.sh --remote --type webUI --tags '~@skipOnEncryption&&~@skipOnEncryptionType:${ENCRYPTION_TYPE}&&~@skip'
when:
matrix:
- TEST_SUITE: selenium
-
- print-log:
- image: owncloudci/php
- commands:
- - cat /var/www/owncloud/data/owncloud.log
- when:
- status: [ failure ]
+ TEST_SOURCE: core-webUI
slack:
image: plugins/slack:1
@@ -239,6 +258,17 @@ matrix:
DB_TYPE: sqlite
# Acceptance Tests
+ ## encryption API acceptance tests masterkey encryption
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: encryption
+
## UI core stable10 with masterkey encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
@@ -250,6 +280,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 1
- PHP_VERSION: 5.6
@@ -262,6 +293,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 2
- PHP_VERSION: 5.6
@@ -274,6 +306,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 3
- PHP_VERSION: 5.6
@@ -286,6 +319,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 4
- PHP_VERSION: 5.6
@@ -298,6 +332,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 5
- PHP_VERSION: 5.6
@@ -310,6 +345,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 6
- PHP_VERSION: 5.6
@@ -322,6 +358,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 7
- PHP_VERSION: 5.6
@@ -334,6 +371,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 8
## UI core stable10 with user-keys encryption
@@ -347,6 +385,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 1
- PHP_VERSION: 5.6
@@ -359,6 +398,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 2
- PHP_VERSION: 5.6
@@ -371,6 +411,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 3
- PHP_VERSION: 5.6
@@ -383,6 +424,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 4
- PHP_VERSION: 5.6
@@ -395,6 +437,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 5
- PHP_VERSION: 5.6
@@ -407,6 +450,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 6
- PHP_VERSION: 5.6
@@ -419,6 +463,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 7
- PHP_VERSION: 5.6
@@ -431,6 +476,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 8
## UI core master with masterkey encryption
@@ -444,6 +490,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 1
- PHP_VERSION: 7.1
@@ -456,6 +503,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 2
- PHP_VERSION: 7.1
@@ -468,6 +516,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 3
- PHP_VERSION: 7.1
@@ -480,6 +529,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 4
- PHP_VERSION: 7.1
@@ -492,6 +542,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 5
- PHP_VERSION: 7.1
@@ -504,6 +555,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 6
- PHP_VERSION: 7.1
@@ -516,6 +568,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 7
- PHP_VERSION: 7.1
@@ -528,6 +581,7 @@ matrix:
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 8
## UI core master with user-keys encryption
@@ -541,6 +595,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 1
- PHP_VERSION: 7.1
@@ -553,6 +608,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 2
- PHP_VERSION: 7.1
@@ -565,6 +621,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 3
- PHP_VERSION: 7.1
@@ -577,6 +634,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 4
- PHP_VERSION: 7.1
@@ -589,6 +647,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 5
- PHP_VERSION: 7.1
@@ -601,6 +660,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 6
- PHP_VERSION: 7.1
@@ -613,6 +673,7 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 7
- PHP_VERSION: 7.1
@@ -625,4 +686,5 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
+ TEST_SOURCE: core-webUI
PART: 8
\ No newline at end of file
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
new file mode 100644
index 00000000..ea2e1e3b
--- /dev/null
+++ b/tests/acceptance/config/behat.yml
@@ -0,0 +1,21 @@
+default:
+ autoload:
+ '': %paths.base%/../features/bootstrap
+
+ suites:
+ apiEncryption:
+ paths:
+ - %paths.base%/../features/apiEncryption
+ contexts:
+ - EncryptionContext:
+ - FeatureContext: &common_feature_context_params
+ baseUrl: http://localhost:8080
+ adminUsername: admin
+ adminPassword: admin
+ regularUserPassword: 123456
+ ocPath: apps/testing/api/v1/occ
+
+ extensions:
+ jarnaiz\JUnitFormatter\JUnitFormatterExtension:
+ filename: report.xml
+ outputDir: %paths.base%/../output/
diff --git a/tests/acceptance/features/apiEncryption/recreatemasterkey.feature b/tests/acceptance/features/apiEncryption/recreatemasterkey.feature
new file mode 100644
index 00000000..0028098f
--- /dev/null
+++ b/tests/acceptance/features/apiEncryption/recreatemasterkey.feature
@@ -0,0 +1,15 @@
+@api
+Feature: recreate-master-key
+
+ Scenario: recreate masterkey
+ Given user "admin" has uploaded file "data/textfile.txt" to "/somefile.txt"
+ When the administrator successfully recreates the encryption masterkey using the occ command
+ Then the downloaded content when downloading file "/somefile.txt" for user "admin" with range "bytes=0-6" should be "This is"
+
+ Scenario: recreate masterkey and upload data
+ Given user "user0" has been created
+ And user "user0" has uploaded file "data/textfile.txt" to "/somefile.txt"
+ When the administrator successfully recreates the encryption masterkey using the occ command
+ And user "user0" uploads chunk file "1" of "1" with "AA" to "/somefile.txt" using the WebDAV API
+ Then the downloaded content when downloading file "/somefile.txt" for user "user0" with range "bytes=0-3" should be "AA"
+
diff --git a/tests/acceptance/features/bootstrap/EncryptionContext.php b/tests/acceptance/features/bootstrap/EncryptionContext.php
new file mode 100644
index 00000000..604b6391
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/EncryptionContext.php
@@ -0,0 +1,70 @@
+
+ * @copyright Copyright (c) 2018 Artur Neumann info@jankaritech.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+use Behat\Behat\Context\Context;
+use Behat\Behat\Hook\Scope\BeforeScenarioScope;
+use TestHelpers\SetupHelper;
+
+require_once 'bootstrap.php';
+
+/**
+ * Context for encryption specific steps
+ */
+class EncryptionContext implements Context {
+
+ /**
+ * @var FeatureContext
+ */
+ private $featureContext;
+
+ /**
+ * @When /^the administrator successfully recreates the encryption masterkey using the occ command$/
+ * @Given /^the administrator has successfully recreated the encryption masterkey$/
+ *
+ * @return void
+ * @throws \Exception
+ */
+ public function recreateMasterKeyUsingOccCommand() {
+ $this->featureContext->runOcc(['encryption:recreate-master-key', '-y']);
+ $this->featureContext->theCommandShouldHaveBeenSuccessful();
+ }
+
+ /**
+ * @BeforeScenario
+ *
+ * @param BeforeScenarioScope $scope
+ *
+ * @return void
+ */
+ public function setUpScenario(BeforeScenarioScope $scope) {
+ // Get the environment
+ $environment = $scope->getEnvironment();
+ // Get all the contexts you need in this context
+ $this->featureContext = $environment->getContext('FeatureContext');
+ SetupHelper::init(
+ $this->featureContext->getAdminUsername(),
+ $this->featureContext->getAdminPassword(),
+ $this->featureContext->getBaseUrl(),
+ $this->featureContext->getOcPath()
+ );
+ }
+}
diff --git a/tests/acceptance/features/bootstrap/bootstrap.php b/tests/acceptance/features/bootstrap/bootstrap.php
new file mode 100644
index 00000000..8f970bf0
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/bootstrap.php
@@ -0,0 +1,33 @@
+
+ * @copyright Copyright (c) 2018 Artur Neumann info@jankaritech.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+require __DIR__ . '/../../../../../../lib/base.php';
+require __DIR__ . '/../../../../../../lib/composer/autoload.php';
+
+$classLoader = new \Composer\Autoload\ClassLoader();
+$classLoader->addPsr4(
+ "", __DIR__ . "/../../../../../../tests/acceptance/features/bootstrap", true
+);
+$classLoader->addPsr4(
+ "TestHelpers\\", __DIR__ . "/../../../../../../tests/TestHelpers", true
+);
+
+$classLoader->register();
\ No newline at end of file
From d42ef7189ae9bf2975daf056fdf412144fd97fd6 Mon Sep 17 00:00:00 2001
From: Martin
Date: Fri, 24 Aug 2018 05:07:24 +0200
Subject: [PATCH 018/348] Update README.md
Initial readme.md text copied from info.xml
---
README.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/README.md b/README.md
index 028acca9..f5039b9a 100644
--- a/README.md
+++ b/README.md
@@ -4,3 +4,12 @@
[](https://travis-ci.org/owncloud/encryption)
[](https://scrutinizer-ci.com/g/owncloud/encryption/?branch=master)
[](https://scrutinizer-ci.com/g/owncloud/encryption/?branch=master)
+
+In order to use this encryption module you need to enable server-side
+encryption in the admin settings. Once enabled this module will encrypt
+all your files transparently. The encryption is based on AES 256 keys.
+The module won't touch existing files, only new files will be encrypted
+after server-side encryption was enabled. It is also not possible to
+disable the encryption again and switch back to a unencrypted system.
+Please read the documentation to know all implications before you decide
+to enable server-side encryption.
From 769e7b4acc286f1f6882a4010d4fc70e54d2980e Mon Sep 17 00:00:00 2001
From: Artur Neumann
Date: Wed, 22 Aug 2018 12:17:50 +0545
Subject: [PATCH 019/348] run api acceptance tests from core
---
.drone.yml | 856 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 854 insertions(+), 2 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index 3ad4671e..e7199b2b 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -154,7 +154,7 @@ pipeline:
- SELENIUM_PORT=4444
- PLATFORM=Linux
- MAILHOG_HOST=email
- - DIVIDE_INTO_NUM_PARTS=8
+ - DIVIDE_INTO_NUM_PARTS=12
- RUN_PART=${PART}
commands:
- cd /var/www/owncloud/tests/acceptance/
@@ -165,6 +165,23 @@ pipeline:
matrix:
TEST_SOURCE: core-webUI
+ core-api-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - TEST_SERVER_URL=http://server
+ - MAILHOG_HOST=email
+ - DIVIDE_INTO_NUM_PARTS=12
+ - RUN_PART=${PART}
+ commands:
+ - cd /var/www/owncloud/tests/acceptance/
+ - touch /var/www/owncloud/saved-settings.sh
+ - . /var/www/owncloud/saved-settings.sh
+ - su-exec www-data ./run.sh --remote --type api --tags '~@skipOnEncryption&&~@skipOnEncryptionType:${ENCRYPTION_TYPE}&&~@skip'
+ when:
+ matrix:
+ TEST_SOURCE: core-api
+
slack:
image: plugins/slack:1
pull: true
@@ -374,6 +391,58 @@ matrix:
TEST_SOURCE: core-webUI
PART: 8
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 9
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 10
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 11
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 12
+
## UI core stable10 with user-keys encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
@@ -479,6 +548,58 @@ matrix:
TEST_SOURCE: core-webUI
PART: 8
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 9
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 10
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 11
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 12
+
## UI core master with masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
@@ -584,6 +705,58 @@ matrix:
TEST_SOURCE: core-webUI
PART: 8
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 9
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 10
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 11
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 12
+
## UI core master with user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
@@ -687,4 +860,683 @@ matrix:
DB_TYPE: mysql
DB_HOST: mysql
TEST_SOURCE: core-webUI
- PART: 8
\ No newline at end of file
+ PART: 8
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 9
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 10
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 11
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-webUI
+ PART: 12
+
+ ## API core stable10 with masterkey encryption
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 1
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 2
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 3
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 4
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 5
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 6
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 7
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 8
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 9
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 10
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 11
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 12
+ ## API core stable10 with user-keys encryption
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 1
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 2
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 3
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 4
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 5
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 6
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 7
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 8
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 9
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 10
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 11
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 12
+
+ ## API core master with masterkey encryption
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 1
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 2
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 3
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 4
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 5
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 6
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 7
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 8
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 9
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 10
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 11
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 12
+
+ ## API core master with user-keys encryption
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 1
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 2
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 3
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 4
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 5
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 6
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 7
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 8
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 9
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 10
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 11
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: core-api
+ PART: 12
\ No newline at end of file
From 62e48923810b336d8374fb6cc506a642a437ef4c Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Wed, 12 Sep 2018 19:00:57 +0530
Subject: [PATCH 020/348] Fix user-keys encryption when user created with email
When user tries to set the password without logging
in for once and no session available, the user-keys
encryption was failing to create the private key
for the new password. This change helps to fix the
issue.
Signed-off-by: Sujith H
---
lib/Hooks/UserHooks.php | 12 +++--
tests/Hooks/UserHooksTest.php | 87 ++++++++++++++++++++++++++++++++++-
2 files changed, 94 insertions(+), 5 deletions(-)
diff --git a/lib/Hooks/UserHooks.php b/lib/Hooks/UserHooks.php
index 05c87e90..0a06ad67 100644
--- a/lib/Hooks/UserHooks.php
+++ b/lib/Hooks/UserHooks.php
@@ -246,10 +246,14 @@ public function preSetPassphrase($params) {
* @return boolean|null
*/
public function setPassphrase($params) {
-
- // Get existing decrypted private key
- $privateKey = $this->session->getPrivateKey();
- $user = $this->user->getUser();
+ $privateKey = null;
+ $user = null;
+ //Check if a session is there or not
+ if ($this->user->getUser() !== null) {
+ // Get existing decrypted private key
+ $privateKey = $this->session->getPrivateKey();
+ $user = $this->user->getUser();
+ }
// current logged in user changes his own password
if ($user && $params['uid'] === $user->getUID() && $privateKey) {
diff --git a/tests/Hooks/UserHooksTest.php b/tests/Hooks/UserHooksTest.php
index 51514d67..78348bf6 100644
--- a/tests/Hooks/UserHooksTest.php
+++ b/tests/Hooks/UserHooksTest.php
@@ -28,10 +28,17 @@
namespace OCA\Encryption\Tests\Hooks;
+use OC\User\Manager;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Hooks\UserHooks;
+use OCA\Encryption\KeyManager;
+use OCA\Encryption\Recovery;
+use OCA\Encryption\Session;
+use OCA\Encryption\Users\Setup;
use OCA\Encryption\Util;
use OCP\IConfig;
+use OCP\ILogger;
+use OCP\IUserSession;
use Test\TestCase;
/**
@@ -262,8 +269,86 @@ public function testSetPassphrase() {
$this->assertNull($this->instance->setPassphrase($this->params));
}
+ /**
+ * Test setPassphrase without session and no logger error should appear
+ */
+ public function testSetPassphraseWithoutSession() {
+ $keyManager = $this->createMock(KeyManager::class);
+ $userManager = $this->createMock(Manager::class);
+ $logger = $this->createMock(ILogger::class);
+ $setUp = $this->createMock(Setup::class);
+ $userSession = $this->createMock(IUserSession::class);
+ $encryptionUtil = $this->createMock(Util::class);
+ $encryptionSession = $this->createMock(Session::class);
+ $recovery = $this->createMock(Recovery::class);
+ $crypt = $this->createMock(Crypt::class);
+ $config = $this->createMock(IConfig::class);
+
+ //$userHooks = new UserHooks($keyManager, $userManager, $logger, $setUp, $userSession, $encryptionUtil, $encryptionSession, $crypt, $recovery, $config);
+ $userHooks = $this->getMockBuilder(UserHooks::class)
+ ->setConstructorArgs([
+ $keyManager, $userManager, $logger,
+ $setUp, $userSession, $encryptionUtil,
+ $encryptionSession, $crypt, $recovery, $config
+ ])->setMethods(['initMountPoints'])->getMock();
+
+ $userSession->expects($this->any())
+ ->method('getUser')
+ ->willReturn(null);
+
+ $crypt->expects($this->any())
+ ->method('encryptPrivateKey')
+ ->willReturn(true);
+
+ $keyManager->expects($this->any())
+ ->method('setPrivateKey')
+ ->willReturn(true);
+
+ //No logger error should appear
+ $logger->expects($this->never())
+ ->method('error');
+
+ $userHooks->setPassphrase($this->params);
+ }
+
+ public function testSetPassphraseWithoutSessionLoggerError() {
+ $keyManager = $this->createMock(KeyManager::class);
+ $userManager = $this->createMock(Manager::class);
+ $logger = $this->createMock(ILogger::class);
+ $setUp = $this->createMock(Setup::class);
+ $userSession = $this->createMock(IUserSession::class);
+ $encryptionUtil = $this->createMock(Util::class);
+ $encryptionSession = $this->createMock(Session::class);
+ $recovery = $this->createMock(Recovery::class);
+ $crypt = $this->createMock(Crypt::class);
+ $config = $this->createMock(IConfig::class);
+
+ //$userHooks = new UserHooks($keyManager, $userManager, $logger, $setUp, $userSession, $encryptionUtil, $encryptionSession, $crypt, $recovery, $config);
+ $userHooks = $this->getMockBuilder(UserHooks::class)
+ ->setConstructorArgs([
+ $keyManager, $userManager, $logger,
+ $setUp, $userSession, $encryptionUtil,
+ $encryptionSession, $crypt, $recovery, $config
+ ])->setMethods(['initMountPoints'])->getMock();
+
+ $userSession->expects($this->any())
+ ->method('getUser')
+ ->willReturn(null);
+
+ $crypt->expects($this->any())
+ ->method('encryptPrivateKey')
+ ->willReturn(false);
+
+ //No logger error should appear
+ $logger->expects($this->any())
+ ->method('error')
+ ->with('Encryption Could not update users encryption password');
+
+ $userHooks->setPassphrase($this->params);
+ }
+
public function testSetPasswordNoUser() {
- $this->sessionMock->expects($this->once())
+ $this->sessionMock->expects($this->any())
->method('getPrivateKey')
->willReturn(true);
From a5d2cdd3ef85fe3ded9035b843eb1f8fb055e632 Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Tue, 16 Oct 2018 17:17:31 +0530
Subject: [PATCH 021/348] Fix re-encrypting encrypted files
When the files are already encrypted the
files need not be encrypted again.
Signed-off-by: Sujith H
---
lib/Crypto/EncryptAll.php | 5 ++++-
tests/Crypto/EncryptAllTest.php | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/Crypto/EncryptAll.php b/lib/Crypto/EncryptAll.php
index d1c0579d..601ff178 100644
--- a/lib/Crypto/EncryptAll.php
+++ b/lib/Crypto/EncryptAll.php
@@ -297,7 +297,10 @@ protected function encryptFile($path) {
$target = $path . '.encrypted.' . time() . '.part';
try {
- $this->keyManager->setVersion($source, 0, $this->rootView);
+ $version = $this->keyManager->getVersion($source, $this->rootView);
+ if ($version > 0) {
+ return false;
+ }
$this->rootView->copy($source, $target);
$this->rootView->rename($target, $source);
} catch (DecryptionFailedException $e) {
diff --git a/tests/Crypto/EncryptAllTest.php b/tests/Crypto/EncryptAllTest.php
index 1b052fd4..7f4d9812 100644
--- a/tests/Crypto/EncryptAllTest.php
+++ b/tests/Crypto/EncryptAllTest.php
@@ -425,4 +425,11 @@ public function testGenerateOneTimePassword() {
$this->assertSame($password, $userPasswords['user1']);
}
+ public function testEncryptAlreadyEncryptedFile() {
+ $this->keyManager->method('getVersion')
+ ->with('/user1/files/bar.txt', $this->view)
+ ->willReturn(1);
+ $result = $this->invokePrivate($this->encryptAll, 'encryptFile', ['/user1/files/bar.txt']);
+ $this->assertFalse($result);
+ }
}
From 694e25b8f1ad03335c0dc186aa94d341353898a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Thu, 25 Oct 2018 08:44:39 +0200
Subject: [PATCH 022/348] Bye bye scrutinizer ....
---
.travis.yml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 6d2dd4ec..fae2e5d6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -44,12 +44,6 @@ script:
- sh -c "if [ '$INTEGRATION' != '1' -a '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then ../../../lib/composer/bin/phpunit --configuration phpunit.xml; fi"
- cd ..
- # Create coverage report
- - cd tests
- - sh -c "if [ '$INTEGRATION' != '1' -a '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' -a '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- - sh -c "if [ '$INTEGRATION' != '1' -a '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' -a '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi"
- - cd ..
-
after_success:
- bash <(curl -s https://codecov.io/bash)
From f30f0d6042785e142a1daab22f6b462610581986 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Thu, 25 Oct 2018 08:45:57 +0200
Subject: [PATCH 023/348] Remove scrutiinizer from README
---
README.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/README.md b/README.md
index f5039b9a..7d8de625 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,6 @@
:lock_with_ink_pen: server side encryption of files
[](https://travis-ci.org/owncloud/encryption)
- [](https://scrutinizer-ci.com/g/owncloud/encryption/?branch=master)
- [](https://scrutinizer-ci.com/g/owncloud/encryption/?branch=master)
In order to use this encryption module you need to enable server-side
encryption in the admin settings. Once enabled this module will encrypt
From 092cb30164df788c5a19cf3491a2f5b133fd5fb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Thu, 25 Oct 2018 08:46:15 +0200
Subject: [PATCH 024/348] Delete .scrutinizer.yml
---
.scrutinizer.yml | 12 ------------
1 file changed, 12 deletions(-)
delete mode 100644 .scrutinizer.yml
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
deleted file mode 100644
index 7a3da7a8..00000000
--- a/.scrutinizer.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-filter:
- excluded_paths:
- - 'l10n/*'
- - 'tests/*'
-
-imports:
- - javascript
- - php
-
-tools:
- external_code_coverage:
- timeout: 7200 # Timeout in seconds: 2 hours
From 07e25315f158e6ef995f7fe44e5037d647cc78eb Mon Sep 17 00:00:00 2001
From: Paurakh Sharma Humagain
Date: Wed, 24 Oct 2018 10:23:08 +0545
Subject: [PATCH 025/348] Change inaccurate suite name
---
.drone.yml | 4 ++--
tests/acceptance/config/behat.yml | 4 ++--
.../recreatemasterkey.feature | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
rename tests/acceptance/features/{apiEncryption => cliEncryption}/recreatemasterkey.feature (99%)
diff --git a/.drone.yml b/.drone.yml
index e7199b2b..454e8266 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -132,14 +132,14 @@ pipeline:
matrix:
PREPARE_ACCEPTANCE: true
- api-acceptance-tests:
+ cli-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- TEST_SERVER_URL=http://server
commands:
- cd /var/www/owncloud/tests/acceptance/
- - su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml
+ - su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml --type cli
when:
matrix:
TEST_SOURCE: encryption
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
index ea2e1e3b..dd921c4f 100644
--- a/tests/acceptance/config/behat.yml
+++ b/tests/acceptance/config/behat.yml
@@ -3,9 +3,9 @@ default:
'': %paths.base%/../features/bootstrap
suites:
- apiEncryption:
+ cliEncryption:
paths:
- - %paths.base%/../features/apiEncryption
+ - %paths.base%/../features/cliEncryption
contexts:
- EncryptionContext:
- FeatureContext: &common_feature_context_params
diff --git a/tests/acceptance/features/apiEncryption/recreatemasterkey.feature b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
similarity index 99%
rename from tests/acceptance/features/apiEncryption/recreatemasterkey.feature
rename to tests/acceptance/features/cliEncryption/recreatemasterkey.feature
index 0028098f..dcd78d93 100644
--- a/tests/acceptance/features/apiEncryption/recreatemasterkey.feature
+++ b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
@@ -1,4 +1,4 @@
-@api
+@cli
Feature: recreate-master-key
Scenario: recreate masterkey
From a889a6e8a0a8d0c79f171fcd0e0bdb814dbc627f Mon Sep 17 00:00:00 2001
From: Paurakh Sharma Humagain
Date: Fri, 26 Oct 2018 10:02:08 +0545
Subject: [PATCH 026/348] Add tests to check decrypt on user specific keys
---
tests/acceptance/config/behat.yml | 11 ++
.../features/bootstrap/EncryptionContext.php | 102 ++++++++++++++++
.../WebUIAdminEncryptionSettingsContext.php | 110 ++++++++++++++++++
...WebUIPersonalEncryptionSettingsContext.php | 107 +++++++++++++++++
.../features/bootstrap/bootstrap.php | 4 +
.../cliEncryption/recreatemasterkey.feature | 3 +-
.../lib/AdminEncryptionSettingsPage.php | 99 ++++++++++++++++
.../lib/PersonalEncryptionSettingsPage.php | 91 +++++++++++++++
.../webUIUserKeysType/userKeys.feature | 32 +++++
9 files changed, 557 insertions(+), 2 deletions(-)
create mode 100644 tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php
create mode 100644 tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
create mode 100644 tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
create mode 100644 tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php
create mode 100644 tests/acceptance/features/webUIUserKeysType/userKeys.feature
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
index dd921c4f..d25933ee 100644
--- a/tests/acceptance/config/behat.yml
+++ b/tests/acceptance/config/behat.yml
@@ -15,6 +15,17 @@ default:
regularUserPassword: 123456
ocPath: apps/testing/api/v1/occ
+ webUIUserKeysType:
+ paths:
+ - %paths.base%/../features/webUIUserKeysType
+ contexts:
+ - EncryptionContext:
+ - WebUIAdminEncryptionSettingsContext:
+ - WebUIPersonalEncryptionSettingsContext:
+ - WebUIGeneralContext:
+ - WebUILoginContext:
+ - FeatureContext: *common_feature_context_params
+
extensions:
jarnaiz\JUnitFormatter\JUnitFormatterExtension:
filename: report.xml
diff --git a/tests/acceptance/features/bootstrap/EncryptionContext.php b/tests/acceptance/features/bootstrap/EncryptionContext.php
index 604b6391..b36a3281 100644
--- a/tests/acceptance/features/bootstrap/EncryptionContext.php
+++ b/tests/acceptance/features/bootstrap/EncryptionContext.php
@@ -22,7 +22,9 @@
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
+use TestHelpers\HttpRequestHelper;
use TestHelpers\SetupHelper;
+use Doctrine\DBAL\Types\VarDateTimeImmutableType;
require_once 'bootstrap.php';
@@ -48,6 +50,106 @@ public function recreateMasterKeyUsingOccCommand() {
$this->featureContext->theCommandShouldHaveBeenSuccessful();
}
+ /**
+ * @Given encryption has been enabled
+ *
+ * @return void
+ */
+ public function encryptionHasBeenEnabled() {
+ $this->featureContext->runOcc(['encryption:enable']);
+ }
+
+ /**
+ * @When the administrator sets the encryption type to :encryptionType using the occ command
+ * @Given the administrator has set the encryption type to :encryptionType
+ *
+ * @param string $encryptionType
+ *
+ * @return void
+ * @throws \Exception
+ */
+ public function theAdministratorSetsEncryptionTypeToUsingTheOccCommand($encryptionType) {
+ $this->featureContext->runOcc(
+ ["encryption:select-encryption-type", $encryptionType, "-y"]
+ );
+ }
+
+ /**
+ * @When the administrator encrypts all data using the occ command
+ * @Given the administrator has encrypted all the data
+ *
+ * @return void
+ */
+ public function theAdministratorEncryptsAllDataUsingTheOccCommand() {
+ $this->featureContext->runOcc(["encryption:encrypt-all", "-n"]);
+ }
+
+ /**
+ * @When the administrator decrypts user keys based encryption with recovery key :recoveryKey using the occ command
+ *
+ * @param string $recoveryKey
+ *
+ * @return void
+ */
+ public function theAdministratorDecryptsUserKeysBasedEncryptionWithKey($recoveryKey) {
+ $this->featureContext->invokingTheCommandWithEnvVariable(
+ "encryption:decrypt-all -m recovery -c yes",
+ 'OC_RECOVERY_PASSWORD',
+ $recoveryKey
+ );
+ }
+
+ /**
+ * @Then the file :fileName of user :username should not be encrypted
+ *
+ * @param string $fileName
+ * @param string $username
+ *
+ * @return void
+ */
+ public function theFileOfUserShouldNotBeEncrypted($fileName, $username) {
+ $fileName = \ltrim($fileName, "/");
+ $filePath = "data/$username/files/$fileName";
+ $this->featureContext->readFileInServerRoot($filePath);
+
+ $response = $this->featureContext->getResponse();
+ $parsedResponse = HttpRequestHelper::getResponseXml($response);
+ $encodedFileContent = (string)$parsedResponse->data->element->contentUrlEncoded;
+ $fileContent = urldecode($encodedFileContent);
+
+ $this->featureContext->userDownloadsTheFileUsingTheAPI($username, "/$fileName");
+ $fileContentServer = (string)$this->featureContext->getResponse()->getBody();
+
+ PHPUnit_Framework_Assert::assertEquals(
+ \trim($fileContentServer),
+ $fileContent
+ );
+ }
+
+ /**
+ * @Then the file :fileName of user :username should be encrypted
+ *
+ * @param string $fileName
+ * @param string $username
+ *
+ * @return void
+ */
+ public function theFileOfUserShouldBeEncrypted($fileName, $username) {
+ $fileName = \ltrim($fileName, "/");
+ $filePath = "data/$username/files/$fileName";
+ $this->featureContext->readFileInServerRoot($filePath);
+
+ $response = $this->featureContext->getResponse();
+ $parsedResponse = HttpRequestHelper::getResponseXml($this->featureContext->getResponse());
+ $encodedFileContent = (string)$parsedResponse->data->element->contentUrlEncoded;
+ $fileContent = urldecode($encodedFileContent);
+
+ PHPUnit_Framework_Assert::assertStringStartsWith(
+ "HBEGIN:oc_encryption_module:OC_DEFAULT_MODULE:cipher:AES-256-CTR:signed:true",
+ $fileContent
+ );
+ }
+
/**
* @BeforeScenario
*
diff --git a/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php
new file mode 100644
index 00000000..c166e9f2
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php
@@ -0,0 +1,110 @@
+
+ * @copyright Copyright (c) 2018 Paurakh Sharma Humagain
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+use Behat\Behat\Context\Context;
+use Behat\Behat\Hook\Scope\BeforeScenarioScope;
+use Behat\MinkExtension\Context\RawMinkContext;
+use Page\OwncloudPage;
+use Page\AdminEncryptionSettingsPage;
+
+require_once 'bootstrap.php';
+
+/**
+ * Context for admin encryption settings specific webUI steps
+ */
+class WebUIAdminEncryptionSettingsContext extends RawMinkContext implements Context {
+
+ /**
+ * @var FeatureContext
+ */
+ private $featureContext;
+
+ /**
+ *
+ * @var WebUIGeneralContext
+ */
+ private $webUIGeneralContext;
+
+ /**
+ *
+ * @var OwncloudPage
+ */
+ private $owncloudPage;
+
+ /**
+ *
+ * @var AdminEncryptionSettingsPage
+ */
+ private $adminEncryptionSettingsPage;
+
+ /**
+ * WebUIAdminEncryptionSettingsContext constructor.
+ *
+ * @param OwncloudPage $owncloudPage
+ * @param AdminEncryptionSettingsPage $adminEncryptionSettingsPage
+ */
+ public function __construct(
+ OwncloudPage $owncloudPage,
+ AdminEncryptionSettingsPage $adminEncryptionSettingsPage
+ ) {
+ $this->owncloudPage = $owncloudPage;
+ $this->adminEncryptionSettingsPage = $adminEncryptionSettingsPage;
+ }
+
+ /**
+ * @Given the administrator has browsed to admin encryption settings page
+ *
+ * @return void
+ */
+ public function theAdministratorHasBrowsedToAdminEncryptionSettingsPage() {
+ $this->webUIGeneralContext->adminLogsInUsingTheWebUI();
+ $this->adminEncryptionSettingsPage->open();
+ $this->adminEncryptionSettingsPage->waitTillPageIsLoaded($this->getSession());
+ }
+
+ /**
+ * @Given the administrator has enabled recovery key and set the recovery key to :recoveryKey
+ *
+ * @param string recoveryKey
+ *
+ * @return void
+ */
+ public function theAdministratorHasEnabledRecoveryKeyAndSetRecoveryKeyTo($recoveryKey) {
+ $this->adminEncryptionSettingsPage->enableRecoveryKeyAndSetRecoveryKeyTo($recoveryKey);
+ $this->adminEncryptionSettingsPage->waitForAjaxCallsToStartAndFinish($this->getSession());
+ }
+
+ /**
+ * @BeforeScenario
+ *
+ * @param BeforeScenarioScope $scope
+ *
+ * @return void
+ */
+ public function setUpScenario(BeforeScenarioScope $scope) {
+ // Get the environment
+ $environment = $scope->getEnvironment();
+ // Get all the contexts you need in this context
+ $this->featureContext = $environment->getContext('FeatureContext');
+ $this->webUIGeneralContext = $environment->getContext('WebUIGeneralContext');
+ }
+}
diff --git a/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
new file mode 100644
index 00000000..370d65bc
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
@@ -0,0 +1,107 @@
+
+ * @copyright Copyright (c) 2018 Paurakh Sharma Humagain
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+use Behat\Behat\Context\Context;
+use Behat\Behat\Hook\Scope\BeforeScenarioScope;
+use Behat\MinkExtension\Context\RawMinkContext;
+use Page\PersonalEncryptionSettingsPage;
+use Page\OwncloudPage;
+
+require_once 'bootstrap.php';
+
+/**
+ * Context for personal encryption settings specific webUI steps
+ */
+class WebUIPersonalEncryptionSettingsContext extends RawMinkContext implements Context {
+
+ /**
+ * @var FeatureContext
+ */
+ private $featureContext;
+
+ /**
+ *
+ * @var WebUIGeneralContext
+ */
+ private $webUIGeneralContext;
+
+ /**
+ *
+ * @var OwncloudPage
+ */
+ private $owncloudPage;
+
+ /**
+ *
+ * @var PersonalEncryptionSettingsPage
+ */
+ private $personalEncryptionSettingsPage;
+
+ /**
+ * WebUIPersonalEncryptionSettingsContext constructor.
+ *
+ * @param OwncloudPage $owncloudPage
+ * @param PersonalEncryptionSettingsPage $personalEncryptionSettingsPage
+ */
+ public function __construct(
+ OwncloudPage $owncloudPage,
+ PersonalEncryptionSettingsPage $personalEncryptionSettingsPage
+ ) {
+ $this->owncloudPage = $owncloudPage;
+ $this->personalEncryptionSettingsPage = $personalEncryptionSettingsPage;
+ }
+
+ /**
+ * @Given the user has browsed to personal encryption settings page
+ *
+ * @return void
+ */
+ public function theUserHasBrowsedToPersonalEncryptionSettingsPage() {
+ $this->personalEncryptionSettingsPage->open();
+ $this->personalEncryptionSettingsPage->waitTillPageIsLoaded($this->getSession());
+ }
+
+ /**
+ * @Given the user has enabled password recovery
+ *
+ * @return void
+ */
+ public function theUserHasEnabledPasswordRecovery() {
+ $this->personalEncryptionSettingsPage->enablePasswordRecovery();
+ $this->personalEncryptionSettingsPage->waitForAjaxCallsToStartAndFinish($this->getSession());
+ }
+
+ /**
+ * @BeforeScenario
+ *
+ * @param BeforeScenarioScope $scope
+ *
+ * @return void
+ */
+ public function setUpScenario(BeforeScenarioScope $scope) {
+ // Get the environment
+ $environment = $scope->getEnvironment();
+ // Get all the contexts you need in this context
+ $this->featureContext = $environment->getContext('FeatureContext');
+ $this->webUIGeneralContext = $environment->getContext('WebUIGeneralContext');
+ }
+}
diff --git a/tests/acceptance/features/bootstrap/bootstrap.php b/tests/acceptance/features/bootstrap/bootstrap.php
index 8f970bf0..1f06dd24 100644
--- a/tests/acceptance/features/bootstrap/bootstrap.php
+++ b/tests/acceptance/features/bootstrap/bootstrap.php
@@ -26,6 +26,10 @@
$classLoader->addPsr4(
"", __DIR__ . "/../../../../../../tests/acceptance/features/bootstrap", true
);
+$classLoader->addPsr4("Page\\", __DIR__ . "/../lib", true);
+$classLoader->addPsr4(
+ "Page\\", __DIR__ . "/../../../../../../tests/acceptance/features/lib", true
+);
$classLoader->addPsr4(
"TestHelpers\\", __DIR__ . "/../../../../../../tests/TestHelpers", true
);
diff --git a/tests/acceptance/features/cliEncryption/recreatemasterkey.feature b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
index dcd78d93..df52a187 100644
--- a/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
+++ b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
@@ -11,5 +11,4 @@ Feature: recreate-master-key
And user "user0" has uploaded file "data/textfile.txt" to "/somefile.txt"
When the administrator successfully recreates the encryption masterkey using the occ command
And user "user0" uploads chunk file "1" of "1" with "AA" to "/somefile.txt" using the WebDAV API
- Then the downloaded content when downloading file "/somefile.txt" for user "user0" with range "bytes=0-3" should be "AA"
-
+ Then the downloaded content when downloading file "/somefile.txt" for user "user0" with range "bytes=0-3" should be "AA"
\ No newline at end of file
diff --git a/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php b/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
new file mode 100644
index 00000000..7f4f7325
--- /dev/null
+++ b/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
@@ -0,0 +1,99 @@
+
+ * @copyright Copyright (c) 2018 Paurakh Sharma Humagain
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+namespace Page;
+
+use Behat\Mink\Session;
+
+/**
+ * PageObject for the admin encryption settings page
+ *
+ */
+class AdminEncryptionSettingsPage extends OwncloudPage {
+
+ /**
+ *
+ * @var string $path
+ */
+ protected $path = '/index.php/settings/admin?sectionid=encryption';
+
+ private $encryptionRecoveryPasswordFieldId = 'encryptionRecoveryPassword';
+ private $repeatEncryptionRecoveryPasswordFieldId = 'repeatEncryptionRecoveryPassword';
+ private $enableRecoveryBtnId = 'enableRecoveryKey';
+ private $enableEncryptionCheckboxId = 'enableEncryption';
+
+ /**
+ * Enable recovery key and set recovery key
+ *
+ * @param string $recoveryKey
+ *
+ * @return void
+ */
+ public function enableRecoveryKeyAndSetRecoveryKeyTo($recoveryKey) {
+ $this->fillField($this->encryptionRecoveryPasswordFieldId, $recoveryKey);
+ $this->fillField($this->repeatEncryptionRecoveryPasswordFieldId, $recoveryKey);
+
+ $enableRecoveryKeyBtn = $this->findById($this->enableRecoveryBtnId);
+ $this->assertElementNotNull(
+ $enableRecoveryKeyBtn,
+ __METHOD__ .
+ " id $this->enableRecoveryBtnId " .
+ "could not find enable recovery key button"
+ );
+
+ $enableRecoveryKeyBtn->click();
+ }
+
+ /**
+ * there is no reliable loading indicator on the admin encryption settings page,
+ * so just wait for the enable encryption checkbox to be there.
+ *
+ * @param Session $session
+ * @param int $timeout_msec
+ *
+ * @return void
+ * @throws \Exception
+ */
+ public function waitTillPageIsLoaded(
+ Session $session,
+ $timeout_msec = STANDARDUIWAITTIMEOUTMILLISEC
+ ) {
+ $currentTime = \microtime(true);
+ $end = $currentTime + ($timeout_msec / 1000);
+ while ($currentTime <= $end) {
+ if ($this->findById($this->enableEncryptionCheckboxId) !== null) {
+ break;
+ }
+ \usleep(STANDARDSLEEPTIMEMICROSEC);
+ $currentTime = \microtime(true);
+ }
+
+ if ($currentTime > $end) {
+ throw new \Exception(
+ __METHOD__ . " timeout waiting for admin encryption settings page to load"
+ );
+ }
+
+ $this->waitForOutstandingAjaxCalls($session);
+ }
+}
diff --git a/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php b/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php
new file mode 100644
index 00000000..56d75a88
--- /dev/null
+++ b/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php
@@ -0,0 +1,91 @@
+
+ * @copyright Copyright (c) 2018 Paurakh Sharma Humagain
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+namespace Page;
+
+use Behat\Mink\Session;
+
+/**
+ * PageObject for the personal encryption settings page
+ *
+ */
+class PersonalEncryptionSettingsPage extends OwncloudPage {
+
+ /**
+ *
+ * @var string $path
+ */
+ protected $path = '/index.php/settings/personal?sectionid=encryption';
+
+ private $userEnableRecoveryCheckboxId = 'userEnableRecoveryCheckbox';
+ private $userEnableRecoveryCheckboxXpath = '//label[@for="userEnableRecoveryCheckbox"]';
+ /**
+ * Enable password recovery
+ *
+ * @return void
+ */
+ public function enablePasswordRecovery() {
+ $userEnableRecoveryCheckbox = $this->find('xpath', $this->userEnableRecoveryCheckboxXpath);
+ $this->assertElementNotNull(
+ $userEnableRecoveryCheckbox,
+ __METHOD__ .
+ " id $this->userEnableRecoveryCheckboxXpath " .
+ "could not find enable checkbox"
+ );
+
+ $userEnableRecoveryCheckbox->click();
+ }
+
+ /**
+ * there is no reliable loading indicator on the personal encryption settings page,
+ * so just wait for the enable encryption checkbox to be there.
+ *
+ * @param Session $session
+ * @param int $timeout_msec
+ *
+ * @return void
+ * @throws \Exception
+ */
+ public function waitTillPageIsLoaded(
+ Session $session,
+ $timeout_msec = STANDARDUIWAITTIMEOUTMILLISEC
+ ) {
+ $currentTime = \microtime(true);
+ $end = $currentTime + ($timeout_msec / 1000);
+ while ($currentTime <= $end) {
+ if ($this->findById($this->userEnableRecoveryCheckboxId) !== null) {
+ break;
+ }
+ \usleep(STANDARDSLEEPTIMEMICROSEC);
+ $currentTime = \microtime(true);
+ }
+
+ if ($currentTime > $end) {
+ throw new \Exception(
+ __METHOD__ . " timeout waiting for personal encryption settings page to load"
+ );
+ }
+
+ $this->waitForOutstandingAjaxCalls($session);
+ }
+}
diff --git a/tests/acceptance/features/webUIUserKeysType/userKeys.feature b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
new file mode 100644
index 00000000..91d7de72
--- /dev/null
+++ b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
@@ -0,0 +1,32 @@
+@webUI @skipOnEncryptionType:masterkey
+Feature: encrypt files using user specific keys
+ As an admin
+ I want to be able to encrypt user files using user specific keys
+ So that users can use specific keys for encrypting their files
+
+ Background:
+ Given user "brand-new-user" has been created
+ And the app "encryption" has been enabled
+ And encryption has been enabled
+
+ Scenario: encrypt using user keys based encryption
+ When the administrator sets the encryption type to "user-keys" using the occ command
+ And the administrator encrypts all data using the occ command
+ Then the file "textfile0.txt" of user "brand-new-user" should be encrypted
+
+ Scenario: file gets encrypted if the encryption is enabled and administrator has not encrypted all files but the user has logged in
+ When the administrator sets the encryption type to "user-keys" using the occ command
+ And user "brand-new-user" has logged in using the webUI
+ Then the file "textfile0.txt" of user "brand-new-user" should be encrypted
+
+ Scenario: decrypt user keys based encryption
+ Given the administrator has set the encryption type to "user-keys"
+ And the administrator has encrypted all the data
+ And the administrator has browsed to admin encryption settings page
+ And the administrator has enabled recovery key and set the recovery key to "recoverypass"
+ And the administrator has logged out of the webUI
+ And user "brand-new-user" has logged in using the webUI
+ And the user has browsed to personal encryption settings page
+ And the user has enabled password recovery
+ When the administrator decrypts user keys based encryption with recovery key "recoverypass" using the occ command
+ Then the file "textfile0.txt" of user "brand-new-user" should not be encrypted
\ No newline at end of file
From 1115c024d611e638f9894ec0e131c6f14a909cda Mon Sep 17 00:00:00 2001
From: Paurakh Sharma Humagain
Date: Wed, 31 Oct 2018 13:50:51 +0545
Subject: [PATCH 027/348] Add skip failing test and add webui suite in drone
---
.drone.yml | 37 +++++++++++++++++--
...WebUIPersonalEncryptionSettingsContext.php | 4 +-
.../lib/AdminEncryptionSettingsPage.php | 11 ++++--
.../webUIUserKeysType/userKeys.feature | 24 +++++++++---
4 files changed, 60 insertions(+), 16 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index 454e8266..f56dda44 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -142,7 +142,25 @@ pipeline:
- su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml --type cli
when:
matrix:
- TEST_SOURCE: encryption
+ TEST_SOURCE: cli-encryption
+
+ webui-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - BROWSER=chrome
+ - SELENIUM_HOST=selenium
+ - SELENIUM_PORT=4444
+ - TEST_SERVER_URL=http://server
+ - PLATFORM=Linux
+ - BEHAT_SUITE=${BEHAT_SUITE}
+ - MAILHOG_HOST=email
+ commands:
+ - cd /var/www/owncloud/tests/acceptance/
+ - su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml --type webUI
+ when:
+ matrix:
+ TEST_SOURCE: webui-encryption
core-webui-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
@@ -280,11 +298,11 @@ matrix:
OC_VERSION: daily-master-qa
PREPARE_ACCEPTANCE: true
USE_SERVER: true
- TEST_SUITE: api
+ TEST_SUITE: cli
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: encryption
+ TEST_SOURCE: cli-encryption
## UI core stable10 with masterkey encryption
- PHP_VERSION: 5.6
@@ -1539,4 +1557,15 @@ matrix:
DB_TYPE: mysql
DB_HOST: mysql
TEST_SOURCE: core-api
- PART: 12
\ No newline at end of file
+ PART: 12
+
+ ## encryption WebUI acceptance tests user-keys encryption
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ TEST_SUITE: selenium
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: webui-encryption
\ No newline at end of file
diff --git a/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
index 370d65bc..f90f9fd1 100644
--- a/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
@@ -71,7 +71,7 @@ public function __construct(
}
/**
- * @Given the user has browsed to personal encryption settings page
+ * @Given the user/administrator has browsed to personal encryption settings page
*
* @return void
*/
@@ -81,7 +81,7 @@ public function theUserHasBrowsedToPersonalEncryptionSettingsPage() {
}
/**
- * @Given the user has enabled password recovery
+ * @Given the user/administrator has enabled password recovery
*
* @return void
*/
diff --git a/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php b/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
index 7f4f7325..76261a9b 100644
--- a/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
+++ b/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
@@ -50,17 +50,20 @@ class AdminEncryptionSettingsPage extends OwncloudPage {
* @return void
*/
public function enableRecoveryKeyAndSetRecoveryKeyTo($recoveryKey) {
- $this->fillField($this->encryptionRecoveryPasswordFieldId, $recoveryKey);
- $this->fillField($this->repeatEncryptionRecoveryPasswordFieldId, $recoveryKey);
-
$enableRecoveryKeyBtn = $this->findById($this->enableRecoveryBtnId);
$this->assertElementNotNull(
$enableRecoveryKeyBtn,
__METHOD__ .
" id $this->enableRecoveryBtnId " .
- "could not find enable recovery key button"
+ "could not find enable/disable recovery key button"
);
+ $action = $enableRecoveryKeyBtn->getAttribute("value");
+ if ($action === "Disable recovery key") {
+ return;
+ }
+ $this->fillField($this->encryptionRecoveryPasswordFieldId, $recoveryKey);
+ $this->fillField($this->repeatEncryptionRecoveryPasswordFieldId, $recoveryKey);
$enableRecoveryKeyBtn->click();
}
diff --git a/tests/acceptance/features/webUIUserKeysType/userKeys.feature b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
index 91d7de72..34fc4e22 100644
--- a/tests/acceptance/features/webUIUserKeysType/userKeys.feature
+++ b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
@@ -5,10 +5,13 @@ Feature: encrypt files using user specific keys
So that users can use specific keys for encrypting their files
Background:
- Given user "brand-new-user" has been created
- And the app "encryption" has been enabled
+ Given the app "encryption" has been enabled
+ And these users have been created but not initialized:
+ | username |
+ | brand-new-user |
And encryption has been enabled
+ @skip @issue-33
Scenario: encrypt using user keys based encryption
When the administrator sets the encryption type to "user-keys" using the occ command
And the administrator encrypts all data using the occ command
@@ -19,14 +22,23 @@ Feature: encrypt files using user specific keys
And user "brand-new-user" has logged in using the webUI
Then the file "textfile0.txt" of user "brand-new-user" should be encrypted
- Scenario: decrypt user keys based encryption
- Given the administrator has set the encryption type to "user-keys"
- And the administrator has encrypted all the data
+ Scenario: decrypt user keys based encryption of all users
+ Given these users have been created but not initialized:
+ | username |
+ | another-new-user |
+ And the administrator has set the encryption type to "user-keys"
And the administrator has browsed to admin encryption settings page
And the administrator has enabled recovery key and set the recovery key to "recoverypass"
+ And the administrator has browsed to personal encryption settings page
+ And the administrator has enabled password recovery
And the administrator has logged out of the webUI
And user "brand-new-user" has logged in using the webUI
And the user has browsed to personal encryption settings page
And the user has enabled password recovery
+ And the user has logged out of the webUI
+ And user "another-new-user" has logged in using the webUI
+ And the user has browsed to personal encryption settings page
+ And the user has enabled password recovery
When the administrator decrypts user keys based encryption with recovery key "recoverypass" using the occ command
- Then the file "textfile0.txt" of user "brand-new-user" should not be encrypted
\ No newline at end of file
+ Then the file "textfile0.txt" of user "brand-new-user" should not be encrypted
+ And the file "textfile0.txt" of user "another-new-user" should not be encrypted
\ No newline at end of file
From 304f4a2928c7b23c08ee0dfef7c19a299e3361a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Wed, 28 Feb 2018 21:30:08 +0100
Subject: [PATCH 028/348] [phpunit] Fail on warnings
---
tests/phpunit.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 6e202f1b..9824d753 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -2,6 +2,7 @@
Date: Wed, 31 Oct 2018 14:05:53 +0100
Subject: [PATCH 029/348] Fix test which was not executed due to warning
---
tests/Crypto/EncryptAllTest.php | 82 ++++++++++++++++++---------------
1 file changed, 46 insertions(+), 36 deletions(-)
diff --git a/tests/Crypto/EncryptAllTest.php b/tests/Crypto/EncryptAllTest.php
index 7f4d9812..12ce0ad3 100644
--- a/tests/Crypto/EncryptAllTest.php
+++ b/tests/Crypto/EncryptAllTest.php
@@ -30,9 +30,20 @@
use OC\Files\View;
use OCA\Encryption\Crypto\EncryptAll;
use Symfony\Component\Console\Helper\ProgressBar;
+use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
use Test\Traits\UserTrait;
+use OCA\Files_Sharing\ISharedStorage;
+use OCP\Security\ISecureRandom;
+use OCP\UserInterface;
+use OCP\IL10N;
+use OCP\Mail\IMailer;
+use OCP\IConfig;
+use OCP\IUserManager;
+use OCA\Encryption\Util;
+use OCA\Encryption\KeyManager;
+use OCA\Encryption\Users\Setup;
/**
* Class EncryptAllTest
@@ -88,21 +99,21 @@ class EncryptAllTest extends TestCase {
function setUp() {
parent::setUp();
- $this->setupUser = $this->getMockBuilder('OCA\Encryption\Users\Setup')
+ $this->setupUser = $this->getMockBuilder(Setup::class)
->disableOriginalConstructor()->getMock();
- $this->keyManager = $this->getMockBuilder('OCA\Encryption\KeyManager')
+ $this->keyManager = $this->getMockBuilder(KeyManager::class)
->disableOriginalConstructor()->getMock();
- $this->util = $this->getMockBuilder('OCA\Encryption\Util')
+ $this->util = $this->getMockBuilder(Util::class)
->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
- $this->view = $this->getMockBuilder('OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
- $this->mailer = $this->getMockBuilder('OCP\Mail\IMailer')
+ $this->mailer = $this->getMockBuilder(IMailer::class)
->disableOriginalConstructor()->getMock();
- $this->l = $this->getMockBuilder('OCP\IL10N')
+ $this->l = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
@@ -110,20 +121,20 @@ function setUp() {
->disableOriginalConstructor()->getMock();
$this->outputInterface = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')
->disableOriginalConstructor()->getMock();
- $this->userInterface = $this->getMockBuilder('OCP\UserInterface')
+ $this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
- $this->outputInterface->expects($this->any())->method('getFormatter')
+ $this->outputInterface->method('getFormatter')
->willReturn($this->createMock('\Symfony\Component\Console\Formatter\OutputFormatterInterface'));
- $this->userManager->expects($this->any())->method('getBackends')->willReturn([$this->userInterface]);
- $this->userInterface->expects($this->any())->method('getUsers')->willReturn(['user1', 'user2']);
+ $this->userManager->method('getBackends')->willReturn([$this->userInterface]);
+ $this->userInterface->method('getUsers')->willReturn(['user1', 'user2']);
- $this->secureRandom = $this->getMockBuilder('OCP\Security\ISecureRandom')->disableOriginalConstructor()->getMock();
- $this->secureRandom->expects($this->any())->method('getMediumStrengthGenerator')->willReturn($this->secureRandom);
- $this->secureRandom->expects($this->any())->method('getLowStrengthGenerator')->willReturn($this->secureRandom);
- $this->secureRandom->expects($this->any())->method('generate')->willReturn('12345678');
+ $this->secureRandom = $this->getMockBuilder(ISecureRandom::class)->disableOriginalConstructor()->getMock();
+ $this->secureRandom->method('getMediumStrengthGenerator')->willReturn($this->secureRandom);
+ $this->secureRandom->method('getLowStrengthGenerator')->willReturn($this->secureRandom);
+ $this->secureRandom->method('generate')->willReturn('12345678');
$this->encryptAll = new EncryptAll(
@@ -142,7 +153,7 @@ function setUp() {
public function testEncryptAll() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -160,7 +171,7 @@ public function testEncryptAll() {
->setMethods(['createKeyPairs', 'encryptAllUsersFiles', 'outputPasswords'])
->getMock();
- $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
+ $this->util->method('isMasterKeyEnabled')->willReturn(false);
$encryptAll->expects($this->at(0))->method('createKeyPairs')->with();
$encryptAll->expects($this->at(1))->method('encryptAllUsersFiles')->with();
$encryptAll->expects($this->at(2))->method('outputPasswords')->with();
@@ -171,7 +182,7 @@ public function testEncryptAll() {
public function testEncryptAllWithMasterKey() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -189,7 +200,7 @@ public function testEncryptAllWithMasterKey() {
->setMethods(['createKeyPairs', 'encryptAllUsersFiles', 'outputPasswords'])
->getMock();
- $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(true);
+ $this->util->method('isMasterKeyEnabled')->willReturn(true);
$encryptAll->expects($this->never())->method('createKeyPairs');
$this->keyManager->expects($this->once())->method('validateMasterKey');
$encryptAll->expects($this->at(0))->method('encryptAllUsersFiles')->with();
@@ -201,7 +212,7 @@ public function testEncryptAllWithMasterKey() {
public function testCreateKeyPairs() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -244,13 +255,13 @@ function ($user) {
// we only expect the skipped user, because generateOneTimePassword which
// would set the user with the new password was mocked.
// This method will be tested separately
- $this->assertSame(1, count($userPasswords));
+ $this->assertCount(1, $userPasswords);
$this->assertSame('', $userPasswords['user2']);
}
public function testEncryptAllUsersFiles() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -268,7 +279,7 @@ public function testEncryptAllUsersFiles() {
->setMethods(['encryptUsersFiles'])
->getMock();
- $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
+ $this->util->method('isMasterKeyEnabled')->willReturn(false);
// set protected property $output
$this->invokePrivate($encryptAll, 'output', [$this->outputInterface]);
@@ -283,7 +294,7 @@ public function testEncryptAllUsersFiles() {
public function testEncryptUsersFiles() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -301,7 +312,7 @@ public function testEncryptUsersFiles() {
->setMethods(['encryptFile', 'setupUserFS'])
->getMock();
- $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
+ $this->util->method('isMasterKeyEnabled')->willReturn(false);
$this->view->expects($this->at(0))->method('getDirectoryContent')
->with('/user1/files')->willReturn(
@@ -318,7 +329,7 @@ public function testEncryptUsersFiles() {
]
);
- $this->view->expects($this->any())->method('is_dir')
+ $this->view->method('is_dir')
->willReturnCallback(
function($path) {
if ($path === '/user1/files/foo') {
@@ -331,15 +342,14 @@ function($path) {
$encryptAll->expects($this->at(1))->method('encryptFile')->with('/user1/files/bar');
$encryptAll->expects($this->at(2))->method('encryptFile')->with('/user1/files/foo/subfile');
- $progressBar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')
- ->disableOriginalConstructor()->getMock();
+ $progressBar = new ProgressBar(new NullOutput());
- $this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
+ self::invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
}
public function testEncryptUsersFilesIncomingShares() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -357,7 +367,7 @@ public function testEncryptUsersFilesIncomingShares() {
->setMethods(['encryptFile', 'setupUserFS'])
->getMock();
- $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
+ $this->util->method('isMasterKeyEnabled')->willReturn(false);
$commonStorage = $this->createMock(Common::class);
$commonStorage->expects($this->once())
@@ -368,7 +378,7 @@ public function testEncryptUsersFilesIncomingShares() {
$fileInfo->expects($this->once())
->method('getStorage')
->willReturn($commonStorage);
- $this->view->expects($this->any())
+ $this->view
->method('getDirectoryContent')
->with('/user1/files')
->willReturn([$fileInfo]);
@@ -389,7 +399,7 @@ public function testEncryptFileFileId() {
$oldFileInfo = $view->getFileInfo('bar.txt');
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
- $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ $encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
$this->setupUser,
@@ -417,11 +427,11 @@ public function testEncryptFileFileId() {
public function testGenerateOneTimePassword() {
$password = $this->invokePrivate($this->encryptAll, 'generateOneTimePassword', ['user1']);
- $this->assertTrue(is_string($password));
+ $this->assertInternalType('string', $password);
$this->assertSame(8, strlen($password));
$userPasswords = $this->invokePrivate($this->encryptAll, 'userPasswords');
- $this->assertSame(1, count($userPasswords));
+ $this->assertCount(1, $userPasswords);
$this->assertSame($password, $userPasswords['user1']);
}
From 3188246f12e1e1fbd16c78ef46483f314c5cd663 Mon Sep 17 00:00:00 2001
From: Sujith H
Date: Wed, 31 Oct 2018 20:14:43 +0530
Subject: [PATCH 030/348] Fix the failure in the unit test
Fix the failure in the unit test
Signed-off-by: Sujith H
---
tests/Crypto/EncryptAllTest.php | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/Crypto/EncryptAllTest.php b/tests/Crypto/EncryptAllTest.php
index 12ce0ad3..f1b0b799 100644
--- a/tests/Crypto/EncryptAllTest.php
+++ b/tests/Crypto/EncryptAllTest.php
@@ -29,6 +29,7 @@
use OC\Files\Storage\Common;
use OC\Files\View;
use OCA\Encryption\Crypto\EncryptAll;
+use OCP\Files\Mount\IMountPoint;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
@@ -314,18 +315,23 @@ public function testEncryptUsersFiles() {
$this->util->method('isMasterKeyEnabled')->willReturn(false);
+ $commonStorage = $this->createMock(Common::class);
+ $mountPoint = $this->createMock(IMountPoint::class);
+ $fileInfo1 = new FileInfo('/usr1/files/foo', $commonStorage, 'foo', ['name' => 'foo', 'type'=>'dir'], $mountPoint);
+ $fileInfo2 = new FileInfo('/usr1/files/bar', $commonStorage, 'foo', ['name' => 'bar', 'type'=>'file'], $mountPoint);
$this->view->expects($this->at(0))->method('getDirectoryContent')
->with('/user1/files')->willReturn(
[
- ['name' => 'foo', 'type'=>'dir'],
- ['name' => 'bar', 'type'=>'file'],
+ $fileInfo1,
+ $fileInfo2,
]
);
+ $fileInfo3 = new FileInfo('/usr1/files/foo/subfile', $commonStorage, 'foo', ['name' => 'subfile', 'type'=>'file'], $mountPoint);
$this->view->expects($this->at(3))->method('getDirectoryContent')
->with('/user1/files/foo')->willReturn(
[
- ['name' => 'subfile', 'type'=>'file']
+ $fileInfo3
]
);
From a3a383ee567d429a8f5cc8c2cc2619f75c03760f Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Tue, 13 Nov 2018 08:44:27 +0545
Subject: [PATCH 031/348] Adjust acceptance test step text similar to core
---
.../bootstrap/WebUIAdminEncryptionSettingsContext.php | 4 ++--
.../WebUIPersonalEncryptionSettingsContext.php | 4 ++--
.../features/webUIUserKeysType/userKeys.feature | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php
index c166e9f2..74b0e536 100644
--- a/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/WebUIAdminEncryptionSettingsContext.php
@@ -71,11 +71,11 @@ public function __construct(
}
/**
- * @Given the administrator has browsed to admin encryption settings page
+ * @Given the administrator has browsed to the admin encryption settings page
*
* @return void
*/
- public function theAdministratorHasBrowsedToAdminEncryptionSettingsPage() {
+ public function theAdministratorHasBrowsedToTheAdminEncryptionSettingsPage() {
$this->webUIGeneralContext->adminLogsInUsingTheWebUI();
$this->adminEncryptionSettingsPage->open();
$this->adminEncryptionSettingsPage->waitTillPageIsLoaded($this->getSession());
diff --git a/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
index f90f9fd1..ea792871 100644
--- a/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/WebUIPersonalEncryptionSettingsContext.php
@@ -71,11 +71,11 @@ public function __construct(
}
/**
- * @Given the user/administrator has browsed to personal encryption settings page
+ * @Given the user/administrator has browsed to the personal encryption settings page
*
* @return void
*/
- public function theUserHasBrowsedToPersonalEncryptionSettingsPage() {
+ public function theUserHasBrowsedToThePersonalEncryptionSettingsPage() {
$this->personalEncryptionSettingsPage->open();
$this->personalEncryptionSettingsPage->waitTillPageIsLoaded($this->getSession());
}
diff --git a/tests/acceptance/features/webUIUserKeysType/userKeys.feature b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
index 34fc4e22..83d8d977 100644
--- a/tests/acceptance/features/webUIUserKeysType/userKeys.feature
+++ b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
@@ -5,7 +5,7 @@ Feature: encrypt files using user specific keys
So that users can use specific keys for encrypting their files
Background:
- Given the app "encryption" has been enabled
+ Given app "encryption" has been enabled
And these users have been created but not initialized:
| username |
| brand-new-user |
@@ -27,17 +27,17 @@ Feature: encrypt files using user specific keys
| username |
| another-new-user |
And the administrator has set the encryption type to "user-keys"
- And the administrator has browsed to admin encryption settings page
+ And the administrator has browsed to the admin encryption settings page
And the administrator has enabled recovery key and set the recovery key to "recoverypass"
- And the administrator has browsed to personal encryption settings page
+ And the administrator has browsed to the personal encryption settings page
And the administrator has enabled password recovery
And the administrator has logged out of the webUI
And user "brand-new-user" has logged in using the webUI
- And the user has browsed to personal encryption settings page
+ And the user has browsed to the personal encryption settings page
And the user has enabled password recovery
And the user has logged out of the webUI
And user "another-new-user" has logged in using the webUI
- And the user has browsed to personal encryption settings page
+ And the user has browsed to the personal encryption settings page
And the user has enabled password recovery
When the administrator decrypts user keys based encryption with recovery key "recoverypass" using the occ command
Then the file "textfile0.txt" of user "brand-new-user" should not be encrypted
From 8b44da5635c290492611f90b718d2474c59814c5 Mon Sep 17 00:00:00 2001
From: Dipak Acharya
Date: Fri, 2 Nov 2018 16:56:46 +0545
Subject: [PATCH 032/348] Add more tests to drone and remove scrutinizer
---
.drone.yml | 118 ++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 99 insertions(+), 19 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index f56dda44..ebe2a972 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -12,6 +12,9 @@ pipeline:
version: ${OC_VERSION}
db_type: ${DB_TYPE}
db_host: ${DB_HOST}
+ db_name: ${DB_NAME}
+ db_username: autotest
+ db_password: owncloud
print-log:
image: owncloudci/php
@@ -66,7 +69,6 @@ pipeline:
matrix:
TEST_SUITE: phpunit
-
phpunit:
image: owncloudci/php:${PHP_VERSION}
pull: true
@@ -90,18 +92,6 @@ pipeline:
TEST_SUITE: phpunit
PHP_VERSION: 7.1
- scrutinizer:
- image: owncloudci/php:7.1
- pull: true
- commands:
- - wget -q https://scrutinizer-ci.com/ocular.phar
- - php ocular.phar code-coverage:upload --format=php-clover tests/output/clover.xml --access-token="09d3585a3ed80b16c3b9eed9912b27cfd85e6ed8c190d95893a02bef73dbde68"
- when:
- local: false
- matrix:
- TEST_SUITE: phpunit
- PHP_VERSION: 7.1
-
configure-server:
image: owncloudci/php:${PHP_VERSION}
pull: true
@@ -241,7 +231,7 @@ services:
mysql:
image: mysql:5.7
environment:
- - MYSQL_USER=owncloud
+ - MYSQL_USER=autotest
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=owncloud
- MYSQL_ROOT_PASSWORD=owncloud
@@ -249,6 +239,16 @@ services:
matrix:
DB_HOST: mysql
+ pgsql:
+ image: postgres:9.4
+ environment:
+ - POSTGRES_USER=autotest
+ - POSTGRES_PASSWORD=owncloud
+ - POSTGRES_DB=owncloud
+ when:
+ matrix:
+ DB_TYPE: pgsql
+
email:
image: mailhog/mailhog
pull: true
@@ -260,37 +260,97 @@ matrix:
include:
# UnitTests
- #master
+ #
+ # master
+ #
+ # php 7.1
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: pgsql
+ DB_HOST: pgsql
+
+ # php 7.2
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ - PHP_VERSION: 7.2
+ OC_VERSION: daily-master-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.2
+ OC_VERSION: daily-master-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: pgsql
+ DB_HOST: pgsql
+
+ #
# stable10
+ #
+ # php 5.6
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: pgsql
+ DB_HOST: pgsql
+
+ # php 7.0
- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
- DB_TYPE: sqlite
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ # php 7.1
- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: mysql
+ DB_HOST: mysql
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-stable10-qa
+ TEST_SUITE: phpunit
+ DB_TYPE: pgsql
+ DB_HOST: pgsql
+
+ # php 7.2
- PHP_VERSION: 7.2
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
- DB_TYPE: sqlite
+ DB_TYPE: mysql
+ DB_HOST: mysql
# Acceptance Tests
## encryption API acceptance tests masterkey encryption
@@ -303,7 +363,27 @@ matrix:
DB_TYPE: mysql
DB_HOST: mysql
TEST_SOURCE: cli-encryption
-
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: pgsql
+ DB_HOST: pgsql
+ TEST_SOURCE: encryption
+
+ - PHP_VERSION: 7.2
+ OC_VERSION: daily-master-qa
+ PREPARE_ACCEPTANCE: true
+ USE_SERVER: true
+ TEST_SUITE: api
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SOURCE: encryption
+
## UI core stable10 with masterkey encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
@@ -1568,4 +1648,4 @@ matrix:
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: webui-encryption
\ No newline at end of file
+ TEST_SOURCE: webui-encryption
From e871b5502cdce90ea817fe39bb30d2697858655d Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Tue, 20 Nov 2018 09:36:46 +0545
Subject: [PATCH 033/348] Adjust acceptance test step text that was changed in
core
---
.../features/bootstrap/EncryptionContext.php | 15 +++++++--------
.../features/webUIUserKeysType/userKeys.feature | 8 ++++----
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/tests/acceptance/features/bootstrap/EncryptionContext.php b/tests/acceptance/features/bootstrap/EncryptionContext.php
index b36a3281..8cf246d6 100644
--- a/tests/acceptance/features/bootstrap/EncryptionContext.php
+++ b/tests/acceptance/features/bootstrap/EncryptionContext.php
@@ -24,7 +24,6 @@
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use TestHelpers\HttpRequestHelper;
use TestHelpers\SetupHelper;
-use Doctrine\DBAL\Types\VarDateTimeImmutableType;
require_once 'bootstrap.php';
@@ -39,8 +38,8 @@ class EncryptionContext implements Context {
private $featureContext;
/**
- * @When /^the administrator successfully recreates the encryption masterkey using the occ command$/
- * @Given /^the administrator has successfully recreated the encryption masterkey$/
+ * @When the administrator successfully recreates the encryption masterkey using the occ command
+ * @Given the administrator has successfully recreated the encryption masterkey
*
* @return void
* @throws \Exception
@@ -100,14 +99,14 @@ public function theAdministratorDecryptsUserKeysBasedEncryptionWithKey($recovery
}
/**
- * @Then the file :fileName of user :username should not be encrypted
+ * @Then file :fileName of user :username should not be encrypted
*
* @param string $fileName
* @param string $username
*
* @return void
*/
- public function theFileOfUserShouldNotBeEncrypted($fileName, $username) {
+ public function fileOfUserShouldNotBeEncrypted($fileName, $username) {
$fileName = \ltrim($fileName, "/");
$filePath = "data/$username/files/$fileName";
$this->featureContext->readFileInServerRoot($filePath);
@@ -117,7 +116,7 @@ public function theFileOfUserShouldNotBeEncrypted($fileName, $username) {
$encodedFileContent = (string)$parsedResponse->data->element->contentUrlEncoded;
$fileContent = urldecode($encodedFileContent);
- $this->featureContext->userDownloadsTheFileUsingTheAPI($username, "/$fileName");
+ $this->featureContext->userDownloadsFileUsingTheAPI($username, "/$fileName");
$fileContentServer = (string)$this->featureContext->getResponse()->getBody();
PHPUnit_Framework_Assert::assertEquals(
@@ -127,14 +126,14 @@ public function theFileOfUserShouldNotBeEncrypted($fileName, $username) {
}
/**
- * @Then the file :fileName of user :username should be encrypted
+ * @Then file :fileName of user :username should be encrypted
*
* @param string $fileName
* @param string $username
*
* @return void
*/
- public function theFileOfUserShouldBeEncrypted($fileName, $username) {
+ public function fileOfUserShouldBeEncrypted($fileName, $username) {
$fileName = \ltrim($fileName, "/");
$filePath = "data/$username/files/$fileName";
$this->featureContext->readFileInServerRoot($filePath);
diff --git a/tests/acceptance/features/webUIUserKeysType/userKeys.feature b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
index 83d8d977..47669fb7 100644
--- a/tests/acceptance/features/webUIUserKeysType/userKeys.feature
+++ b/tests/acceptance/features/webUIUserKeysType/userKeys.feature
@@ -15,12 +15,12 @@ Feature: encrypt files using user specific keys
Scenario: encrypt using user keys based encryption
When the administrator sets the encryption type to "user-keys" using the occ command
And the administrator encrypts all data using the occ command
- Then the file "textfile0.txt" of user "brand-new-user" should be encrypted
+ Then file "textfile0.txt" of user "brand-new-user" should be encrypted
Scenario: file gets encrypted if the encryption is enabled and administrator has not encrypted all files but the user has logged in
When the administrator sets the encryption type to "user-keys" using the occ command
And user "brand-new-user" has logged in using the webUI
- Then the file "textfile0.txt" of user "brand-new-user" should be encrypted
+ Then file "textfile0.txt" of user "brand-new-user" should be encrypted
Scenario: decrypt user keys based encryption of all users
Given these users have been created but not initialized:
@@ -40,5 +40,5 @@ Feature: encrypt files using user specific keys
And the user has browsed to the personal encryption settings page
And the user has enabled password recovery
When the administrator decrypts user keys based encryption with recovery key "recoverypass" using the occ command
- Then the file "textfile0.txt" of user "brand-new-user" should not be encrypted
- And the file "textfile0.txt" of user "another-new-user" should not be encrypted
\ No newline at end of file
+ Then file "textfile0.txt" of user "brand-new-user" should not be encrypted
+ And file "textfile0.txt" of user "another-new-user" should not be encrypted
\ No newline at end of file
From 170bc2bffb79ad3b0d22e7a388bca4a8c0adabe4 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Thu, 22 Nov 2018 08:06:42 +0545
Subject: [PATCH 034/348] Adjust upload steps for filesForUpload
---
.../features/cliEncryption/recreatemasterkey.feature | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/acceptance/features/cliEncryption/recreatemasterkey.feature b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
index df52a187..fff5954e 100644
--- a/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
+++ b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
@@ -2,13 +2,13 @@
Feature: recreate-master-key
Scenario: recreate masterkey
- Given user "admin" has uploaded file "data/textfile.txt" to "/somefile.txt"
+ Given user "admin" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt"
When the administrator successfully recreates the encryption masterkey using the occ command
Then the downloaded content when downloading file "/somefile.txt" for user "admin" with range "bytes=0-6" should be "This is"
Scenario: recreate masterkey and upload data
Given user "user0" has been created
- And user "user0" has uploaded file "data/textfile.txt" to "/somefile.txt"
+ And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt"
When the administrator successfully recreates the encryption masterkey using the occ command
And user "user0" uploads chunk file "1" of "1" with "AA" to "/somefile.txt" using the WebDAV API
Then the downloaded content when downloading file "/somefile.txt" for user "user0" with range "bytes=0-3" should be "AA"
\ No newline at end of file
From 743a88076e0255473958172a0a3c980dd7eefaf0 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Thu, 22 Nov 2018 08:19:21 +0545
Subject: [PATCH 035/348] Adjust user create step
---
.../acceptance/features/cliEncryption/recreatemasterkey.feature | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/acceptance/features/cliEncryption/recreatemasterkey.feature b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
index fff5954e..d6ffee7d 100644
--- a/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
+++ b/tests/acceptance/features/cliEncryption/recreatemasterkey.feature
@@ -7,7 +7,7 @@ Feature: recreate-master-key
Then the downloaded content when downloading file "/somefile.txt" for user "admin" with range "bytes=0-6" should be "This is"
Scenario: recreate masterkey and upload data
- Given user "user0" has been created
+ Given user "user0" has been created with default attributes
And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt"
When the administrator successfully recreates the encryption masterkey using the occ command
And user "user0" uploads chunk file "1" of "1" with "AA" to "/somefile.txt" using the WebDAV API
From 0007f2b9a2e6ba78aef5fa02c36229e284c00e5a Mon Sep 17 00:00:00 2001
From: Dipak Acharya
Date: Mon, 19 Nov 2018 16:58:35 +0545
Subject: [PATCH 036/348] Remove travis as tests are now in drone
---
.drone.yml | 4 ++--
.travis.yml | 64 -----------------------------------------------------
2 files changed, 2 insertions(+), 66 deletions(-)
delete mode 100644 .travis.yml
diff --git a/.drone.yml b/.drone.yml
index ebe2a972..9961961d 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -62,9 +62,9 @@ pipeline:
pull: true
commands:
- ../../lib/composer/bin/parallel-lint . --exclude 3rdparty --exclude build .
- #- cd /var/www/owncloud
+ - cd /var/www/owncloud
#- php ./occ app:check-code encryption -c private -c strong-comparison
- #- php ./occ app:check-code encryption -c deprecation
+ - php ./occ app:check-code encryption -c deprecation
when:
matrix:
TEST_SUITE: phpunit
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index fae2e5d6..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-language: php
-php:
- - 5.6
- - 7.0
- - 7.1
- - 7.2
- - nightly
-
-env:
- global:
- - CORE_BRANCH=stable10
- - APP_NAME=encryption
- matrix:
- - DB=sqlite
-
-branches:
- only:
- - master
- - /^stable\d+(\.\d+)?$/
-
-before_install:
- - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
- - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
-
- # Add some output debugging information
- - cd ../core
- - ./occ check
- - ./occ status
- - ./occ app:list
- - ./occ app:enable $APP_NAME
- - ./occ app:list
-
-script:
- # Test the app
- - cd apps/$APP_NAME/
- - sh -c "if [ '$CODECHECK' = '1' ]; then find . -name \*.php -exec php -l \"{}\" \;; fi"
- - cd ../../
- - sh -c "if [ '$CODECHECK' = '1' ]; then ./occ app:check-code $APP_NAME -c private -c strong-comparison; fi"
- - sh -c "if [ '$CODECHECK' = '2' ]; then ./occ app:check-code $APP_NAME -c deprecation; fi"
- - cd apps/$APP_NAME/
-
- # Run phpunit tests
- - cd tests
- - sh -c "if [ '$INTEGRATION' != '1' -a '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then ../../../lib/composer/bin/phpunit --configuration phpunit.xml; fi"
- - cd ..
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
-
-matrix:
- include:
-# - php: 5.6
-# env: DB=mysql CORE_BRANCH=stable10
-# - php: 5.6
-# env: DB=mysql CODECHECK=1
- - php: 5.6
- env: DB=mysql CODECHECK=2
- - php: 7.1
- env: DB=mysql CORE_BRANCH=master
- - php: 7.2
- env: DB=mysql CORE_BRANCH=master
- allow_failures:
- - php: nightly
- fast_finish: true
From 39be1e275b345157853c76b99572c866b0f23940 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Thu, 29 Nov 2018 19:40:57 +0545
Subject: [PATCH 037/348] adjust acceptance test time constant names
---
tests/acceptance/features/lib/AdminEncryptionSettingsPage.php | 4 ++--
.../features/lib/PersonalEncryptionSettingsPage.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php b/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
index 76261a9b..fd75dfab 100644
--- a/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
+++ b/tests/acceptance/features/lib/AdminEncryptionSettingsPage.php
@@ -79,7 +79,7 @@ public function enableRecoveryKeyAndSetRecoveryKeyTo($recoveryKey) {
*/
public function waitTillPageIsLoaded(
Session $session,
- $timeout_msec = STANDARDUIWAITTIMEOUTMILLISEC
+ $timeout_msec = STANDARD_UI_WAIT_TIMEOUT_MILLISEC
) {
$currentTime = \microtime(true);
$end = $currentTime + ($timeout_msec / 1000);
@@ -87,7 +87,7 @@ public function waitTillPageIsLoaded(
if ($this->findById($this->enableEncryptionCheckboxId) !== null) {
break;
}
- \usleep(STANDARDSLEEPTIMEMICROSEC);
+ \usleep(STANDARD_SLEEP_TIME_MICROSEC);
$currentTime = \microtime(true);
}
diff --git a/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php b/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php
index 56d75a88..4fde3235 100644
--- a/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php
+++ b/tests/acceptance/features/lib/PersonalEncryptionSettingsPage.php
@@ -68,7 +68,7 @@ public function enablePasswordRecovery() {
*/
public function waitTillPageIsLoaded(
Session $session,
- $timeout_msec = STANDARDUIWAITTIMEOUTMILLISEC
+ $timeout_msec = STANDARD_UI_WAIT_TIMEOUT_MILLISEC
) {
$currentTime = \microtime(true);
$end = $currentTime + ($timeout_msec / 1000);
@@ -76,7 +76,7 @@ public function waitTillPageIsLoaded(
if ($this->findById($this->userEnableRecoveryCheckboxId) !== null) {
break;
}
- \usleep(STANDARDSLEEPTIMEMICROSEC);
+ \usleep(STANDARD_SLEEP_TIME_MICROSEC);
$currentTime = \microtime(true);
}
From ba0511a6f4d87a168088a00094c85e3093c08ebf Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Mon, 3 Dec 2018 10:16:25 +0545
Subject: [PATCH 038/348] Run cli acceptance tests for pgsql and PHP 7.2
``TEST_SOURCE: encryption`` was a NOOP - there is no pipeline step that matches it. The 2 matrix entries here were just doing all the setup and then exiting "happy". Actually there are no specific ``api`` acceptance tests in the encryption app.
Change these matrix entries so they run the ``cli`` acceptance tests, like the matrix entry above them.
---
.drone.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index 9961961d..689bb97c 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -368,21 +368,21 @@ matrix:
OC_VERSION: daily-master-qa
PREPARE_ACCEPTANCE: true
USE_SERVER: true
- TEST_SUITE: api
+ TEST_SUITE: cli
ENCRYPTION_TYPE: masterkey
DB_TYPE: pgsql
DB_HOST: pgsql
- TEST_SOURCE: encryption
+ TEST_SOURCE: cli-encryption
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
PREPARE_ACCEPTANCE: true
USE_SERVER: true
- TEST_SUITE: api
+ TEST_SUITE: cli
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: encryption
+ TEST_SOURCE: cli-encryption
## UI core stable10 with masterkey encryption
- PHP_VERSION: 5.6
From f4895f73fd8367f64bea5d7bd8fb404dc9865e84 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Mon, 3 Dec 2018 11:28:06 +0545
Subject: [PATCH 039/348] Refactor existing drone, add codestyle phan phpstan
infrastructure
---
.drone.yml | 1104 +++++++++++--------
.gitignore | 15 +
Makefile | 137 +++
composer.json | 18 +
composer.lock | 60 +
tests/phpunit.xml => phpunit.xml | 14 +-
vendor-bin/owncloud-codestyle/composer.json | 5 +
vendor-bin/phan/composer.json | 5 +
vendor-bin/phpstan/composer.json | 5 +
9 files changed, 891 insertions(+), 472 deletions(-)
create mode 100644 .gitignore
create mode 100644 Makefile
create mode 100644 composer.json
create mode 100644 composer.lock
rename tests/phpunit.xml => phpunit.xml (50%)
create mode 100644 vendor-bin/owncloud-codestyle/composer.json
create mode 100644 vendor-bin/phan/composer.json
create mode 100644 vendor-bin/phpstan/composer.json
diff --git a/.drone.yml b/.drone.yml
index 689bb97c..243182ce 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -5,22 +5,19 @@ workspace:
branches: [master, release*, release/*]
pipeline:
- install-server:
- image: patrickjahns/occore
+ install-core:
+ image: owncloudci/core
+ version: ${OC_VERSION}
pull: true
exclude: "apps/encryption"
- version: ${OC_VERSION}
db_type: ${DB_TYPE}
- db_host: ${DB_HOST}
db_name: ${DB_NAME}
+ db_host: ${DB_TYPE}
db_username: autotest
db_password: owncloud
-
- print-log:
- image: owncloudci/php
- detach: true
- commands:
- - tail -f /var/www/owncloud/data/owncloud.log
+ when:
+ matrix:
+ NEED_CORE: true
install-fed-server:
image: owncloudci/core
@@ -39,7 +36,7 @@ pipeline:
- php occ a:l
- php occ a:e testing
- php occ a:l
- - php occ config:system:set trusted_domains 1 --value=server
+ - php occ config:system:set trusted_domains 1 --value=owncloud
- php occ config:system:set trusted_domains 2 --value=federated
- php occ log:manage --level 0
- php occ config:list
@@ -57,6 +54,46 @@ pipeline:
matrix:
USE_FEDERATED_SERVER: true
+ install-app:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - cd /var/www/owncloud/
+ - php occ a:l
+ - php occ a:e encryption
+ - php occ a:e testing
+ - php occ encryption:enable
+ - php occ encryption:select-encryption-type ${ENCRYPTION_TYPE} --yes
+ - php occ a:l
+ - php occ config:system:set trusted_domains 1 --value=owncloud
+ - php occ config:system:set trusted_domains 2 --value=federated
+ - php occ log:manage --level 0
+ - php occ config:list
+ when:
+ matrix:
+ NEED_INSTALL_APP: true
+
+ fix-permissions:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ commands:
+ - chown www-data /var/www/owncloud -R
+ - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R
+ - chmod +x /var/www/owncloud/tests/acceptance/run.sh
+ when:
+ matrix:
+ NEED_SERVER: true
+
+ owncloud-log:
+ image: owncloud/ubuntu:16.04
+ detach: true
+ pull: true
+ commands:
+ - tail -f /var/www/owncloud/data/owncloud.log
+ when:
+ matrix:
+ NEED_SERVER: true
+
code-check:
image: owncloudci/php:${PHP_VERSION}
pull: true
@@ -69,70 +106,78 @@ pipeline:
matrix:
TEST_SUITE: phpunit
- phpunit:
- image: owncloudci/php:${PHP_VERSION}
+ phpstan:
+ # phpstan requires php7.1
+ image: owncloudci/php:7.1
pull: true
+ environment:
+ - COMPOSER_HOME=/var/www/owncloud/apps/password_policy/.cache/composer
commands:
- - phpdbg -d memory_limit=4096M -rr ../../lib/composer/bin/phpunit --configuration tests/phpunit.xml
+ - make test-php-phpstan
when:
matrix:
- TEST_SUITE: phpunit
+ TEST_SUITE: phpstan
- codecov:
- image: plugins/codecov:2
- secrets: [codecov_token]
+ phan-70:
+ # phan requires a recent php-ast extension
+ image: owncloudci/php:7.0
pull: true
- paths:
- - tests/output
- files:
- - '*.xml'
+ environment:
+ - COMPOSER_HOME=/var/www/owncloud/apps/password_policy/.cache/composer
+ commands:
+ - make test-php-phan
when:
- local: false
matrix:
- TEST_SUITE: phpunit
- PHP_VERSION: 7.1
+ TEST_SUITE: phan-70
- configure-server:
- image: owncloudci/php:${PHP_VERSION}
+ phan-71:
+ # phan requires a recent php-ast extension
+ image: owncloudci/php:7.1
pull: true
+ environment:
+ - COMPOSER_HOME=/var/www/owncloud/apps/password_policy/.cache/composer
commands:
- - cd /var/www/owncloud
- - php occ a:l
- - php occ a:e testing
- - php occ a:e encryption
- - php occ encryption:enable
- - php occ encryption:select-encryption-type ${ENCRYPTION_TYPE} --yes
- - php occ a:l
- - php occ config:system:set trusted_domains 1 --value=server
- - php occ config:system:set trusted_domains 2 --value=federated
- - php occ log:manage --level 0
- - php occ config:list
+ - make test-php-phan
when:
matrix:
- PREPARE_ACCEPTANCE: true
+ TEST_SUITE: phan
- fix-permissions:
+ phan-72:
+ # phan requires a recent php-ast extension
+ image: owncloudci/php:7.2
+ pull: true
+ environment:
+ - COMPOSER_HOME=/var/www/owncloud/apps/password_policy/.cache/composer
+ commands:
+ - make test-php-phan
+ when:
+ matrix:
+ TEST_SUITE: phan
+
+ phpunit-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
+ environment:
+ - COVERAGE=${COVERAGE}
commands:
- - chown www-data /var/www/owncloud -R
- - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R
- - chmod +x /var/www/owncloud/tests/acceptance/run.sh
+ - if [ -z "${COVERAGE}" ]; then make test-php-unit; fi
+ - if [ "${COVERAGE}" = "true" ]; then make test-php-unit-dbg; fi
when:
matrix:
- PREPARE_ACCEPTANCE: true
+ TEST_SUITE: phpunit
cli-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- - TEST_SERVER_URL=http://server
+ - TEST_SERVER_URL=http://owncloud
+ - PLATFORM=Linux
+ - BEHAT_SUITE=${BEHAT_SUITE}
commands:
- - cd /var/www/owncloud/tests/acceptance/
- - su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml --type cli
+ - make test-acceptance-cli
when:
matrix:
- TEST_SOURCE: cli-encryption
+ TEST_SUITE: cli-acceptance
webui-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
@@ -141,16 +186,15 @@ pipeline:
- BROWSER=chrome
- SELENIUM_HOST=selenium
- SELENIUM_PORT=4444
- - TEST_SERVER_URL=http://server
+ - TEST_SERVER_URL=http://owncloud
- PLATFORM=Linux
- BEHAT_SUITE=${BEHAT_SUITE}
- MAILHOG_HOST=email
commands:
- - cd /var/www/owncloud/tests/acceptance/
- - su-exec www-data ./run.sh --remote --config /var/www/owncloud/apps/encryption/tests/acceptance/config/behat.yml --type webUI
+ - make test-acceptance-webui
when:
matrix:
- TEST_SOURCE: webui-encryption
+ TEST_SUITE: web-acceptance
core-webui-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
@@ -158,7 +202,7 @@ pipeline:
environment:
- BROWSER=chrome
- SELENIUM_HOST=selenium
- - TEST_SERVER_URL=http://server
+ - TEST_SERVER_URL=http://owncloud
- SELENIUM_PORT=4444
- PLATFORM=Linux
- MAILHOG_HOST=email
@@ -171,13 +215,13 @@ pipeline:
- su-exec www-data ./run.sh --remote --type webUI --tags '~@skipOnEncryption&&~@skipOnEncryptionType:${ENCRYPTION_TYPE}&&~@skip'
when:
matrix:
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
core-api-acceptance-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- - TEST_SERVER_URL=http://server
+ - TEST_SERVER_URL=http://owncloud
- MAILHOG_HOST=email
- DIVIDE_INTO_NUM_PARTS=12
- RUN_PART=${PART}
@@ -188,20 +232,31 @@ pipeline:
- su-exec www-data ./run.sh --remote --type api --tags '~@skipOnEncryption&&~@skipOnEncryptionType:${ENCRYPTION_TYPE}&&~@skip'
when:
matrix:
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
+
+ codecov:
+ image: plugins/codecov:2
+ secrets: [codecov_token]
+ pull: true
+ paths:
+ - tests/output/*.xml
+ when:
+ local: false
+ matrix:
+ COVERAGE: true
- slack:
+ notify:
image: plugins/slack:1
pull: true
- secrets: [ slack_webhook ]
+ secrets: [slack_webhook]
channel: builds
when:
local: false
- status: [ changed, failure ]
- event: [ push, tag ]
+ status: [failure, changed]
+ event: [push, tag]
services:
- server:
+ owncloud:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
@@ -209,7 +264,7 @@ services:
command: [ "/usr/local/bin/apachectl", "-e", "debug" , "-D", "FOREGROUND" ]
when:
matrix:
- USE_SERVER: true
+ NEED_SERVER: true
federated:
image: owncloudci/php:${PHP_VERSION}
@@ -226,7 +281,7 @@ services:
pull: true
when:
matrix:
- TEST_SUITE: selenium
+ NEED_SELENIUM: true
mysql:
image: mysql:5.7
@@ -254,7 +309,7 @@ services:
pull: true
when:
matrix:
- TEST_SUITE: selenium
+ NEED_EMAIL: true
matrix:
include:
@@ -268,36 +323,45 @@ matrix:
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ NEED_CORE: true
+ COVERAGE: true
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_HOST: mysql
+ NEED_CORE: true
+ COVERAGE: true
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_HOST: pgsql
+ NEED_CORE: true
+ COVERAGE: true
# php 7.2
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ NEED_CORE: true
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_HOST: mysql
+ NEED_CORE: true
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_HOST: pgsql
+ NEED_CORE: true
#
# stable10
@@ -307,18 +371,21 @@ matrix:
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ NEED_CORE: true
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_HOST: mysql
+ NEED_CORE: true
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_HOST: pgsql
+ NEED_CORE: true
# php 7.0
- PHP_VERSION: 7.0
@@ -326,24 +393,28 @@ matrix:
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_HOST: mysql
+ NEED_CORE: true
# php 7.1
- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
+ NEED_CORE: true
- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_HOST: mysql
+ NEED_CORE: true
- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_HOST: pgsql
+ NEED_CORE: true
# php 7.2
- PHP_VERSION: 7.2
@@ -351,1301 +422,1404 @@ matrix:
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_HOST: mysql
+ NEED_CORE: true
# Acceptance Tests
- ## encryption API acceptance tests masterkey encryption
+ ## encryption CLI acceptance tests masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- TEST_SUITE: cli
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ BEHAT_SUITE: cliEncryption
+ TEST_SUITE: cli-acceptance
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: cli-encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- TEST_SUITE: cli
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ BEHAT_SUITE: cliEncryption
+ TEST_SUITE: cli-acceptance
ENCRYPTION_TYPE: masterkey
DB_TYPE: pgsql
DB_HOST: pgsql
- TEST_SOURCE: cli-encryption
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- TEST_SUITE: cli
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ BEHAT_SUITE: cliEncryption
+ TEST_SUITE: cli-acceptance
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: cli-encryption
## UI core stable10 with masterkey encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 1
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 2
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 3
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 4
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 5
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 6
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 7
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 8
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 9
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 10
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 11
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 12
## UI core stable10 with user-keys encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 1
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 2
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 3
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 4
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 5
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 6
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 7
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 8
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 9
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 10
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 11
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 12
## UI core master with masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 1
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 2
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 3
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 4
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 5
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 6
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 7
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 8
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 9
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 10
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 11
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 12
## UI core master with user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 1
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 2
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 3
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 4
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 5
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 6
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 7
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 8
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 9
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 10
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 11
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: selenium
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-webUI
+ TEST_SUITE: core-web-acceptance
PART: 12
## API core stable10 with masterkey encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 1
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 2
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 3
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 4
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 5
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 6
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 7
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 8
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 9
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 10
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 11
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 12
## API core stable10 with user-keys encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 1
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 2
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 3
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 4
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 5
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 6
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 7
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 8
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 9
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 10
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 11
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 12
## API core master with masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 1
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 2
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 3
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 4
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 5
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 6
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 7
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 8
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 9
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 10
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 11
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: masterkey
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 12
## API core master with user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 1
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 2
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 3
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 4
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 5
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 6
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 7
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 8
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 9
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 10
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 11
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
USE_FEDERATED_SERVER: true
FEDERATION_OC_VERSION: daily-stable10-qa
- TEST_SUITE: api
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: core-api
+ TEST_SUITE: core-api-acceptance
PART: 12
## encryption WebUI acceptance tests user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
- PREPARE_ACCEPTANCE: true
- USE_SERVER: true
- TEST_SUITE: selenium
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ BEHAT_SUITE: webUIUserKeysType
+ TEST_SUITE: web-acceptance
ENCRYPTION_TYPE: user-keys
DB_TYPE: mysql
DB_HOST: mysql
- TEST_SOURCE: webui-encryption
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..3b01309e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+/build/
+/l10n/.transifexrc
+.php_cs.cache
+
+# Composer
+vendor/
+vendor-bin/**/vendor
+vendor-bin/**/composer.lock
+
+# Mac OS
+.DS_Store
+
+# Tests - auto-generated files
+/tests/acceptance/output*
+/tests/output
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..557c033d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,137 @@
+SHELL := /bin/bash
+
+COMPOSER_BIN := $(shell command -v composer 2> /dev/null)
+ifndef COMPOSER_BIN
+ $(error composer is not available on your system, please install composer)
+endif
+
+# directories
+app_name=$(notdir $(CURDIR))
+build_dir=$(CURDIR)/build
+dist_dir=$(build_dir)/dist
+doc_files=README.md LICENSE
+src_dirs=appinfo css img js l10n lib templates
+all_src=$(src_dirs) $(doc_files)
+
+# bin file definitions
+PHPUNIT=php -d zend.enable_gc=0 ../../lib/composer/bin/phpunit
+PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "../../lib/composer/bin/phpunit"
+PHPLINT=php -d zend.enable_gc=0 vendor-bin/php-parallel-lint/vendor/bin/parallel-lint
+PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
+PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
+PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan
+
+# start with displaying help
+.DEFAULT_GOAL := help
+
+help:
+ @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
+
+##
+## Build targets
+##--------------------------------------
+
+.PHONY: dist
+dist: ## Build distribution
+dist: distdir package
+
+.PHONY: distdir
+distdir:
+ rm -rf $(build_dir)
+ mkdir -p $(dist_dir)/$(app_name)
+ cp -R $(all_src) $(dist_dir)/$(app_name)
+
+.PHONY: package
+package:
+ tar -czf $(dist_dir)/$(app_name).tar.gz -C $(dist_dir) $(app_name)
+
+##
+## Tests
+##--------------------------------------
+
+.PHONY: test-php-unit
+test-php-unit: ## Run php unit tests
+test-php-unit: ../../lib/composer/bin/phpunit
+ $(PHPUNIT) --configuration ./phpunit.xml --testsuite unit
+
+.PHONY: test-php-unit-dbg
+test-php-unit-dbg: ## Run php unit tests using phpdbg
+test-php-unit-dbg: ../../lib/composer/bin/phpunit
+ $(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit
+
+.PHONY: test-php-lint
+test-php-lint: ## Run phan
+test-php-lint: vendor-bin/php-parallel-lint/vendor
+ $(PHPLINT) appinfo lib
+
+.PHONY: test-php-style
+test-php-style: ## Run php-cs-fixer and check owncloud code-style
+test-php-style: vendor-bin/owncloud-codestyle/vendor
+ $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run
+
+.PHONY: test-php-style-fix
+test-php-style-fix: ## Run php-cs-fixer and fix code style issues
+test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
+ $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes
+
+.PHONY: test-php-phan
+test-php-phan: ## Run phan
+test-php-phan: vendor-bin/phan/vendor
+ $(PHAN) --config-file .phan/config.php --require-config-exists
+
+.PHONY: test-php-phpstan
+test-php-phpstan: ## Run phpstan
+test-php-phpstan: vendor-bin/phpstan/vendor
+ $(PHPSTAN) analyse --memory-limit=4G --configuration=./phpstan.neon --no-progress --level=5 appinfo lib
+
+.PHONY: test-acceptance-api
+test-acceptance-api: ## Run php-cs-fixer and fix code style issues
+test-acceptance-api: vendor
+ ../../tests/acceptance/run.sh --remote --type api
+
+.PHONY: test-acceptance-cli
+test-acceptance-cli: ## Run CLI acceptance tests
+test-acceptance-cli: vendor
+ ../../tests/acceptance/run.sh --remote --type cli
+
+.PHONY: test-acceptance-webui
+test-acceptance-webui: ## Run webUI acceptance tests
+test-acceptance-webui: vendor
+ ../../tests/acceptance/run.sh --remote --type webUI
+
+#
+# Dependency management
+#--------------------------------------
+
+composer.lock: composer.json
+ @echo composer.lock is not up to date.
+
+vendor:
+ composer install --no-dev
+
+vendor/bamarni/composer-bin-plugin:
+ composer install
+
+vendor-bin/php-parallel-lint/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php-parallel-lint/composer.lock
+ composer bin php-parallel-lint install --no-progress
+
+vendor-bin/php-parallel-lint/composer.lock: vendor-bin/php-parallel-lint/composer.json
+ @echo php-parallel-lint composer.lock is not up to date.
+
+vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
+ composer bin owncloud-codestyle install --no-progress
+
+vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
+ @echo owncloud-codestyle composer.lock is not up to date.
+
+vendor-bin/phan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phan/composer.lock
+ composer bin phan install --no-progress
+
+vendor-bin/phan/composer.lock: vendor-bin/phan/composer.json
+ @echo phan composer.lock is not up to date.
+
+vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan/composer.lock
+ composer bin phpstan install --no-progress
+
+vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
+ @echo phpstan composer.lock is not up to date.
diff --git a/composer.json b/composer.json
new file mode 100644
index 00000000..5174b1b8
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,18 @@
+{
+ "name": "owncloud/encryption",
+ "config" : {
+ "platform": {
+ "php": "7.1"
+ }
+ },
+ "require": {
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.2"
+ },
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": false
+ }
+ }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 00000000..9cc095e9
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,60 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "a58b812e9b3eda432f21ce81eee7dd45",
+ "packages": [],
+ "packages-dev": [
+ {
+ "name": "bamarni/composer-bin-plugin",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/bamarni/composer-bin-plugin.git",
+ "reference": "62fef740245a85f00665e81ea8f0aa0b72afe6e7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/62fef740245a85f00665e81ea8f0aa0b72afe6e7",
+ "reference": "62fef740245a85f00665e81ea8f0aa0b72afe6e7",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0"
+ },
+ "require-dev": {
+ "composer/composer": "dev-master",
+ "symfony/console": "^2.5 || ^3.0"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "Bamarni\\Composer\\Bin\\Plugin",
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Bamarni\\Composer\\Bin\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "time": "2017-09-11T13:13:58+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "platform-overrides": {
+ "php": "7.1"
+ }
+}
diff --git a/tests/phpunit.xml b/phpunit.xml
similarity index 50%
rename from tests/phpunit.xml
rename to phpunit.xml
index 9824d753..fdc1b10d 100644
--- a/tests/phpunit.xml
+++ b/phpunit.xml
@@ -1,5 +1,5 @@
-
-
- .
+
+ ./tests
- ../../encryption/lib
- ../../encryption/appinfo
- ../../encryption/templates
+ ./lib
+ ./appinfo
+ ./templates
-
+
diff --git a/vendor-bin/owncloud-codestyle/composer.json b/vendor-bin/owncloud-codestyle/composer.json
new file mode 100644
index 00000000..64973219
--- /dev/null
+++ b/vendor-bin/owncloud-codestyle/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "owncloud/coding-standard": "^1.0"
+ }
+}
diff --git a/vendor-bin/phan/composer.json b/vendor-bin/phan/composer.json
new file mode 100644
index 00000000..b8f6ca70
--- /dev/null
+++ b/vendor-bin/phan/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "phan/phan": "^1.0.0"
+ }
+}
diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json
new file mode 100644
index 00000000..cb0a6232
--- /dev/null
+++ b/vendor-bin/phpstan/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "phpstan/phpstan": "^0.10.2"
+ }
+}
From 7606ef72b4a3cb92efa502971316ffeb17bb628b Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Mon, 3 Dec 2018 12:22:11 +0545
Subject: [PATCH 040/348] Move PHP unit tests into tests/unit folder
---
phpunit.xml | 5 ++---
tests/{ => unit}/Command/RecreateMasterKeyTest.php | 0
tests/{ => unit}/Command/TestEnableMasterKey.php | 0
tests/{ => unit}/Command/TestEnableUserKey.php | 0
tests/{ => unit}/Controller/RecoveryControllerTest.php | 0
tests/{ => unit}/Controller/SettingsControllerTest.php | 0
tests/{ => unit}/Controller/StatusControllerTest.php | 0
tests/{ => unit}/Crypto/CryptTest.php | 0
tests/{ => unit}/Crypto/DecryptAllTest.php | 0
tests/{ => unit}/Crypto/EncryptAllTest.php | 0
tests/{ => unit}/Crypto/EncryptionTest.php | 0
tests/{ => unit}/HookManagerTest.php | 0
tests/{ => unit}/Hooks/UserHooksTest.php | 0
tests/{ => unit}/KeyManagerTest.php | 0
tests/{ => unit}/MigrationTest.php | 0
tests/{ => unit}/Panels/AdminTest.php | 0
tests/{ => unit}/Panels/PersonalTest.php | 0
tests/{ => unit}/RecoveryTest.php | 0
tests/{ => unit}/SessionTest.php | 0
tests/{ => unit}/Users/SetupTest.php | 0
tests/{ => unit}/UtilTest.php | 0
tests/{ => unit}/bootstrap.php | 2 +-
22 files changed, 3 insertions(+), 4 deletions(-)
rename tests/{ => unit}/Command/RecreateMasterKeyTest.php (100%)
rename tests/{ => unit}/Command/TestEnableMasterKey.php (100%)
rename tests/{ => unit}/Command/TestEnableUserKey.php (100%)
rename tests/{ => unit}/Controller/RecoveryControllerTest.php (100%)
rename tests/{ => unit}/Controller/SettingsControllerTest.php (100%)
rename tests/{ => unit}/Controller/StatusControllerTest.php (100%)
rename tests/{ => unit}/Crypto/CryptTest.php (100%)
rename tests/{ => unit}/Crypto/DecryptAllTest.php (100%)
rename tests/{ => unit}/Crypto/EncryptAllTest.php (100%)
rename tests/{ => unit}/Crypto/EncryptionTest.php (100%)
rename tests/{ => unit}/HookManagerTest.php (100%)
rename tests/{ => unit}/Hooks/UserHooksTest.php (100%)
rename tests/{ => unit}/KeyManagerTest.php (100%)
rename tests/{ => unit}/MigrationTest.php (100%)
rename tests/{ => unit}/Panels/AdminTest.php (100%)
rename tests/{ => unit}/Panels/PersonalTest.php (100%)
rename tests/{ => unit}/RecoveryTest.php (100%)
rename tests/{ => unit}/SessionTest.php (100%)
rename tests/{ => unit}/Users/SetupTest.php (100%)
rename tests/{ => unit}/UtilTest.php (100%)
rename tests/{ => unit}/bootstrap.php (95%)
diff --git a/phpunit.xml b/phpunit.xml
index fdc1b10d..decc1c5e 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,5 +1,5 @@
-
- ./tests
+ ./tests/unit
@@ -23,4 +23,3 @@
-
diff --git a/tests/Command/RecreateMasterKeyTest.php b/tests/unit/Command/RecreateMasterKeyTest.php
similarity index 100%
rename from tests/Command/RecreateMasterKeyTest.php
rename to tests/unit/Command/RecreateMasterKeyTest.php
diff --git a/tests/Command/TestEnableMasterKey.php b/tests/unit/Command/TestEnableMasterKey.php
similarity index 100%
rename from tests/Command/TestEnableMasterKey.php
rename to tests/unit/Command/TestEnableMasterKey.php
diff --git a/tests/Command/TestEnableUserKey.php b/tests/unit/Command/TestEnableUserKey.php
similarity index 100%
rename from tests/Command/TestEnableUserKey.php
rename to tests/unit/Command/TestEnableUserKey.php
diff --git a/tests/Controller/RecoveryControllerTest.php b/tests/unit/Controller/RecoveryControllerTest.php
similarity index 100%
rename from tests/Controller/RecoveryControllerTest.php
rename to tests/unit/Controller/RecoveryControllerTest.php
diff --git a/tests/Controller/SettingsControllerTest.php b/tests/unit/Controller/SettingsControllerTest.php
similarity index 100%
rename from tests/Controller/SettingsControllerTest.php
rename to tests/unit/Controller/SettingsControllerTest.php
diff --git a/tests/Controller/StatusControllerTest.php b/tests/unit/Controller/StatusControllerTest.php
similarity index 100%
rename from tests/Controller/StatusControllerTest.php
rename to tests/unit/Controller/StatusControllerTest.php
diff --git a/tests/Crypto/CryptTest.php b/tests/unit/Crypto/CryptTest.php
similarity index 100%
rename from tests/Crypto/CryptTest.php
rename to tests/unit/Crypto/CryptTest.php
diff --git a/tests/Crypto/DecryptAllTest.php b/tests/unit/Crypto/DecryptAllTest.php
similarity index 100%
rename from tests/Crypto/DecryptAllTest.php
rename to tests/unit/Crypto/DecryptAllTest.php
diff --git a/tests/Crypto/EncryptAllTest.php b/tests/unit/Crypto/EncryptAllTest.php
similarity index 100%
rename from tests/Crypto/EncryptAllTest.php
rename to tests/unit/Crypto/EncryptAllTest.php
diff --git a/tests/Crypto/EncryptionTest.php b/tests/unit/Crypto/EncryptionTest.php
similarity index 100%
rename from tests/Crypto/EncryptionTest.php
rename to tests/unit/Crypto/EncryptionTest.php
diff --git a/tests/HookManagerTest.php b/tests/unit/HookManagerTest.php
similarity index 100%
rename from tests/HookManagerTest.php
rename to tests/unit/HookManagerTest.php
diff --git a/tests/Hooks/UserHooksTest.php b/tests/unit/Hooks/UserHooksTest.php
similarity index 100%
rename from tests/Hooks/UserHooksTest.php
rename to tests/unit/Hooks/UserHooksTest.php
diff --git a/tests/KeyManagerTest.php b/tests/unit/KeyManagerTest.php
similarity index 100%
rename from tests/KeyManagerTest.php
rename to tests/unit/KeyManagerTest.php
diff --git a/tests/MigrationTest.php b/tests/unit/MigrationTest.php
similarity index 100%
rename from tests/MigrationTest.php
rename to tests/unit/MigrationTest.php
diff --git a/tests/Panels/AdminTest.php b/tests/unit/Panels/AdminTest.php
similarity index 100%
rename from tests/Panels/AdminTest.php
rename to tests/unit/Panels/AdminTest.php
diff --git a/tests/Panels/PersonalTest.php b/tests/unit/Panels/PersonalTest.php
similarity index 100%
rename from tests/Panels/PersonalTest.php
rename to tests/unit/Panels/PersonalTest.php
diff --git a/tests/RecoveryTest.php b/tests/unit/RecoveryTest.php
similarity index 100%
rename from tests/RecoveryTest.php
rename to tests/unit/RecoveryTest.php
diff --git a/tests/SessionTest.php b/tests/unit/SessionTest.php
similarity index 100%
rename from tests/SessionTest.php
rename to tests/unit/SessionTest.php
diff --git a/tests/Users/SetupTest.php b/tests/unit/Users/SetupTest.php
similarity index 100%
rename from tests/Users/SetupTest.php
rename to tests/unit/Users/SetupTest.php
diff --git a/tests/UtilTest.php b/tests/unit/UtilTest.php
similarity index 100%
rename from tests/UtilTest.php
rename to tests/unit/UtilTest.php
diff --git a/tests/bootstrap.php b/tests/unit/bootstrap.php
similarity index 95%
rename from tests/bootstrap.php
rename to tests/unit/bootstrap.php
index e1d3b1a7..f84f919a 100644
--- a/tests/bootstrap.php
+++ b/tests/unit/bootstrap.php
@@ -23,7 +23,7 @@
define('PHPUNIT_RUN', 1);
}
-require_once __DIR__ . '/../../../lib/base.php';
+require_once __DIR__ . '/../../../../lib/base.php';
// Fix for "Autoload path not allowed: .../tests/lib/testcase.php"
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
From ed4bf43d68635be2bd87e54d4dcf36fb6201af37 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Mon, 3 Dec 2018 12:33:17 +0545
Subject: [PATCH 041/348] Split core api and webUI into 15 parts
---
.drone.yml | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 294 insertions(+), 2 deletions(-)
diff --git a/.drone.yml b/.drone.yml
index 243182ce..ee9f72bd 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -206,7 +206,7 @@ pipeline:
- SELENIUM_PORT=4444
- PLATFORM=Linux
- MAILHOG_HOST=email
- - DIVIDE_INTO_NUM_PARTS=12
+ - DIVIDE_INTO_NUM_PARTS=15
- RUN_PART=${PART}
commands:
- cd /var/www/owncloud/tests/acceptance/
@@ -223,7 +223,7 @@ pipeline:
environment:
- TEST_SERVER_URL=http://owncloud
- MAILHOG_HOST=email
- - DIVIDE_INTO_NUM_PARTS=12
+ - DIVIDE_INTO_NUM_PARTS=15
- RUN_PART=${PART}
commands:
- cd /var/www/owncloud/tests/acceptance/
@@ -821,6 +821,51 @@ matrix:
TEST_SUITE: core-web-acceptance
PART: 12
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 13
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 14
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 15
+
## UI core master with masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
@@ -1002,6 +1047,51 @@ matrix:
TEST_SUITE: core-web-acceptance
PART: 12
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 13
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 14
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 15
+
## UI core master with user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
@@ -1183,6 +1273,51 @@ matrix:
TEST_SUITE: core-web-acceptance
PART: 12
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 13
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 14
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ NEED_SELENIUM: true
+ NEED_EMAIL: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-web-acceptance
+ PART: 15
+
## API core stable10 with masterkey encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
@@ -1339,6 +1474,46 @@ matrix:
DB_HOST: mysql
TEST_SUITE: core-api-acceptance
PART: 12
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 13
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 14
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 15
+
## API core stable10 with user-keys encryption
- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
@@ -1496,6 +1671,45 @@ matrix:
TEST_SUITE: core-api-acceptance
PART: 12
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 13
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 14
+
+ - PHP_VERSION: 5.6
+ OC_VERSION: daily-stable10-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 15
+
## API core master with masterkey encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
@@ -1653,6 +1867,45 @@ matrix:
TEST_SUITE: core-api-acceptance
PART: 12
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 13
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 14
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: masterkey
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 15
+
## API core master with user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
@@ -1810,6 +2063,45 @@ matrix:
TEST_SUITE: core-api-acceptance
PART: 12
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 13
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 14
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ NEED_CORE: true
+ NEED_INSTALL_APP: true
+ NEED_SERVER: true
+ USE_FEDERATED_SERVER: true
+ FEDERATION_OC_VERSION: daily-stable10-qa
+ ENCRYPTION_TYPE: user-keys
+ DB_TYPE: mysql
+ DB_HOST: mysql
+ TEST_SUITE: core-api-acceptance
+ PART: 15
+
## encryption WebUI acceptance tests user-keys encryption
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
From 4e7040387c6135a9fdc7ce7def0bf937ab7b9f46 Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Mon, 3 Dec 2018 14:30:46 +0545
Subject: [PATCH 042/348] Add config files for php-cs-fixer phhan and phpstan
---
.phan/config.php | 109 +++++++++++++++++++++++++++++++++++++++++++++++
.php_cs.dist | 14 ++++++
phpstan.neon | 4 ++
3 files changed, 127 insertions(+)
create mode 100644 .phan/config.php
create mode 100644 .php_cs.dist
create mode 100644 phpstan.neon
diff --git a/.phan/config.php b/.phan/config.php
new file mode 100644
index 00000000..6004d6e1
--- /dev/null
+++ b/.phan/config.php
@@ -0,0 +1,109 @@
+
+ *
+ * @copyright Copyright (c) 2018, ownCloud GmbH
+ * @license GPL-2.0
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+return [
+
+ // Supported values: '7.0', '7.1', '7.2', null.
+ // If this is set to null,
+ // then Phan assumes the PHP version which is closest to the minor version
+ // of the php executable used to execute phan.
+ 'target_php_version' => null,
+
+ // A list of directories that should be parsed for class and
+ // method information. After excluding the directories
+ // defined in exclude_analysis_directory_list, the remaining
+ // files will be statically analyzed for errors.
+ //
+ // Thus, both first-party and third-party code being used by
+ // your application should be included in this list.
+ 'directory_list' => [
+ 'appinfo',
+ 'lib',
+ 'vendor',
+ '../../lib',
+ '../../core'
+ ],
+
+ // A directory list that defines files that will be excluded
+ // from static analysis, but whose class and method
+ // information should be included.
+ //
+ // Generally, you'll want to include the directories for
+ // third-party code (such as "vendor/") in this list.
+ //
+ // n.b.: If you'd like to parse but not analyze 3rd
+ // party code, directories containing that code
+ // should be added to both the `directory_list`
+ // and `exclude_analysis_directory_list` arrays.
+ 'exclude_analysis_directory_list' => [
+ 'vendor',
+ '../../lib',
+ '../../core'
+ ],
+
+ // A regular expression to match files to be excluded
+ // from parsing and analysis and will not be read at all.
+ //
+ // This is useful for excluding groups of test or example
+ // directories/files, unanalyzable files, or files that
+ // can't be removed for whatever reason.
+ // (e.g. '@Test\.php$@', or '@vendor/.*/(tests|Tests)/@')
+ 'exclude_file_regex' => '@.*/[^/]*(tests|Tests|templates)/@',
+
+ // If true, missing properties will be created when
+ // they are first seen. If false, we'll report an
+ // error message.
+ "allow_missing_properties" => false,
+
+ // If enabled, allow null to be cast as any array-like type.
+ // This is an incremental step in migrating away from null_casts_as_any_type.
+ // If null_casts_as_any_type is true, this has no effect.
+ "null_casts_as_any_type" => true,
+
+ // Backwards Compatibility Checking. This is slow
+ // and expensive, but you should consider running
+ // it before upgrading your version of PHP to a
+ // new version that has backward compatibility
+ // breaks.
+ 'backward_compatibility_checks' => false,
+
+ // The initial scan of the function's code block has no
+ // type information for `$arg`. It isn't until we see
+ // the call and rescan test()'s code block that we can
+ // detect that it is actually returning the passed in
+ // `string` instead of an `int` as declared.
+ 'quick_mode' => false,
+
+ // The minimum severity level to report on. This can be
+ // set to Issue::SEVERITY_LOW, Issue::SEVERITY_NORMAL or
+ // Issue::SEVERITY_CRITICAL. Setting it to only
+ // critical issues is a good place to start on a big
+ // sloppy mature code base.
+ 'minimum_severity' => 5,
+
+ // A set of fully qualified class-names for which
+ // a call to parent::__construct() is required
+ 'parent_constructor_required' => [
+ ],
+
+];
\ No newline at end of file
diff --git a/.php_cs.dist b/.php_cs.dist
new file mode 100644
index 00000000..2d1a88c2
--- /dev/null
+++ b/.php_cs.dist
@@ -0,0 +1,14 @@
+setUsingCache(true)
+ ->getFinder()
+ ->exclude('l10n')
+ ->exclude('vendor')
+ ->exclude('vendor-bin')
+ ->notPath('/^c3.php/')
+ ->in(__DIR__);
+
+return $config;
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 00000000..fc21becb
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,4 @@
+parameters:
+ bootstrap: %currentWorkingDirectory%/../../lib/base.php
+ ignoreErrors:
+
From 81616db7cf268331843243cdebb51d9b99d71f1f Mon Sep 17 00:00:00 2001
From: Phil Davis
Date: Mon, 3 Dec 2018 14:42:29 +0545
Subject: [PATCH 043/348] php-cs-fixer code style changes
---
appinfo/Migrations/Version20170913113840.php | 3 +-
appinfo/routes.php | 2 -
lib/AppInfo/Application.php | 38 +++---
lib/Command/MigrateKeys.php | 6 +-
lib/Command/RecreateMasterKey.php | 8 +-
lib/Command/SelectEncryptionType.php | 4 -
lib/Controller/RecoveryController.php | 4 -
lib/Controller/SettingsController.php | 2 -
lib/Controller/StatusController.php | 4 -
lib/Crypto/Crypt.php | 117 ++++++++----------
lib/Crypto/DecryptAll.php | 7 +-
lib/Crypto/EncryptAll.php | 26 ++--
lib/Crypto/Encryption.php | 38 ++----
lib/Exceptions/MultiKeyDecryptException.php | 1 -
lib/Exceptions/MultiKeyEncryptException.php | 1 -
lib/Exceptions/PrivateKeyMissingException.php | 1 -
lib/Exceptions/PublicKeyMissingException.php | 1 -
lib/HookManager.php | 7 +-
lib/Hooks/Contracts/IHook.php | 1 -
lib/Hooks/UserHooks.php | 11 +-
lib/KeyManager.php | 26 ++--
lib/Migration.php | 51 ++++----
lib/Panels/Admin.php | 2 +-
lib/Panels/Personal.php | 2 +-
lib/Recovery.php | 9 +-
lib/Session.php | 15 ++-
lib/Users/Setup.php | 4 +-
lib/Util.php | 8 +-
templates/settings-admin.php | 8 +-
templates/settings-personal.php | 4 +-
.../features/bootstrap/EncryptionContext.php | 4 +-
.../features/bootstrap/bootstrap.php | 2 +-
tests/unit/Command/RecreateMasterKeyTest.php | 16 +--
tests/unit/Command/TestEnableMasterKey.php | 7 +-
tests/unit/Command/TestEnableUserKey.php | 8 +-
.../Controller/RecoveryControllerTest.php | 12 --
.../Controller/SettingsControllerTest.php | 11 +-
.../unit/Controller/StatusControllerTest.php | 6 +-
tests/unit/Crypto/CryptTest.php | 66 ++++------
tests/unit/Crypto/DecryptAllTest.php | 4 -
tests/unit/Crypto/EncryptAllTest.php | 14 +--
tests/unit/Crypto/EncryptionTest.php | 19 +--
tests/unit/HookManagerTest.php | 6 -
tests/unit/Hooks/UserHooksTest.php | 8 +-
tests/unit/KeyManagerTest.php | 39 ++----
tests/unit/MigrationTest.php | 91 +++++++-------
tests/unit/Panels/AdminTest.php | 3 +-
tests/unit/Panels/PersonalTest.php | 3 +-
tests/unit/RecoveryTest.php | 9 --
tests/unit/SessionTest.php | 4 -
tests/unit/Users/SetupTest.php | 5 -
tests/unit/UtilTest.php | 4 -
tests/unit/bootstrap.php | 4 +-
53 files changed, 262 insertions(+), 494 deletions(-)
diff --git a/appinfo/Migrations/Version20170913113840.php b/appinfo/Migrations/Version20170913113840.php
index 092a15ab..23e6f1d5 100644
--- a/appinfo/Migrations/Version20170913113840.php
+++ b/appinfo/Migrations/Version20170913113840.php
@@ -32,7 +32,7 @@ class Version20170913113840 implements ISimpleMigration {
public function run(IOutput $out) {
$installedVersion = \OC::$server->getConfig()->getSystemValue('version', '0.0.0');
- if (version_compare('10.0.3', $installedVersion, '>=') === true) {
+ if (\version_compare('10.0.3', $installedVersion, '>=') === true) {
$encryptionEnable = \OC::$server->getAppConfig()->getValue('encryption', 'enabled', 'yes');
$coreEncryptionEnable = \OC::$server->getAppConfig()->getValue('core', 'encryption_enabled', 'yes');
$userSpecificKey = \OC::$server->getAppConfig()->getValue('encryption', 'userSpecificKey', '');
@@ -45,4 +45,3 @@ public function run(IOutput $out) {
}
}
}
-
diff --git a/appinfo/routes.php b/appinfo/routes.php
index f8ca0a79..5fb3ebfe 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -21,7 +21,6 @@
*
*/
-
namespace OCA\Encryption\AppInfo;
(new Application())->registerRoutes($this, ['routes' => [
@@ -57,5 +56,4 @@
'verb' => 'GET'
]
-
]]);
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 6c4ddbef..ba93d9f1 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -22,7 +22,6 @@
*/
namespace OCA\Encryption\AppInfo;
-
use OC\Files\View;
use OC\Helper\EnvironmentHelper;
use OCA\Encryption\Controller\RecoveryController;
@@ -45,7 +44,6 @@
use OCP\IConfig;
use Symfony\Component\Console\Helper\QuestionHelper;
-
class Application extends \OCP\AppFramework\App {
/** @var IManager */
@@ -80,7 +78,6 @@ public function __construct($urlParams = [], $encryptionSystemReady = true) {
public function registerHooks() {
if (!$this->config->getSystemValue('maintenance', false)) {
-
$container = $this->getContainer();
$server = $container->getServer();
// Register our hooks and fire them.
@@ -99,7 +96,6 @@ public function registerHooks() {
]);
$hookManager->fireHooks();
-
} else {
// Logout user if we are in maintenance to force re-login
$this->getContainer()->getServer()->getUserSession()->logout();
@@ -109,13 +105,11 @@ public function registerHooks() {
public function registerEncryptionModule() {
$container = $this->getContainer();
-
$this->encryptionManager->registerEncryptionModule(
Encryption::ID,
Encryption::DISPLAY_NAME,
- function() use ($container) {
-
- return new Encryption(
+ function () use ($container) {
+ return new Encryption(
$container->query('Crypt'),
$container->query('KeyManager'),
$container->query('Util'),
@@ -125,15 +119,14 @@ function() use ($container) {
$container->getServer()->getLogger(),
$container->getServer()->getL10N($container->getAppName())
);
- });
-
+ });
}
public function registerServices() {
$container = $this->getContainer();
$container->registerService('Crypt',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new Crypt($server->getLogger(),
$server->getUserSession(),
@@ -142,14 +135,14 @@ function(IAppContainer $c) {
});
$container->registerService('Session',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new Session($server->getSession());
}
);
$container->registerService('KeyManager',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new KeyManager($server->getEncryptionKeyStorage(),
@@ -163,7 +156,7 @@ function(IAppContainer $c) {
});
$container->registerService('Recovery',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new Recovery(
@@ -177,7 +170,7 @@ function(IAppContainer $c) {
new View());
});
- $container->registerService('RecoveryController', function(IAppContainer $c) {
+ $container->registerService('RecoveryController', function (IAppContainer $c) {
$server = $c->getServer();
return new RecoveryController(
$c->getAppName(),
@@ -187,7 +180,7 @@ function(IAppContainer $c) {
$c->query('Recovery'));
});
- $container->registerService('StatusController', function(IAppContainer $c) {
+ $container->registerService('StatusController', function (IAppContainer $c) {
$server = $c->getServer();
return new StatusController(
$c->getAppName(),
@@ -197,7 +190,7 @@ function(IAppContainer $c) {
);
});
- $container->registerService('SettingsController', function(IAppContainer $c) {
+ $container->registerService('SettingsController', function (IAppContainer $c) {
$server = $c->getServer();
return new SettingsController(
$c->getAppName(),
@@ -214,7 +207,7 @@ function(IAppContainer $c) {
});
$container->registerService('UserSetup',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new Setup($server->getLogger(),
$server->getUserSession(),
@@ -223,7 +216,7 @@ function(IAppContainer $c) {
});
$container->registerService('Util',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new Util(
@@ -236,7 +229,7 @@ function(IAppContainer $c) {
});
$container->registerService('EncryptAll',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
$server = $c->getServer();
return new EncryptAll(
$c->query('UserSetup'),
@@ -254,7 +247,7 @@ function(IAppContainer $c) {
);
$container->registerService('DecryptAll',
- function(IAppContainer $c) {
+ function (IAppContainer $c) {
return new DecryptAll(
$c->query('Util'),
$c->query('KeyManager'),
@@ -266,9 +259,8 @@ function(IAppContainer $c) {
);
}
);
- $container->registerService('OCP\Encryption\Keys\IStorage', function(IAppContainer $c) {
+ $container->registerService('OCP\Encryption\Keys\IStorage', function (IAppContainer $c) {
return $c->getServer()->getEncryptionKeyStorage();
});
}
-
}
diff --git a/lib/Command/MigrateKeys.php b/lib/Command/MigrateKeys.php
index 6d78cc66..6de08890 100644
--- a/lib/Command/MigrateKeys.php
+++ b/lib/Command/MigrateKeys.php
@@ -59,7 +59,6 @@ public function __construct(IUserManager $userManager,
IDBConnection $connection,
IConfig $config,
ILogger $logger) {
-
$this->userManager = $userManager;
$this->view = $view;
$this->connection = $connection;
@@ -99,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$migration->reorganizeSystemFolderStructure();
$migration->updateDB();
foreach ($this->userManager->getBackends() as $backend) {
- $name = get_class($backend);
+ $name = \get_class($backend);
if ($backend instanceof IUserBackend) {
$name = $backend->getBackendName();
@@ -116,11 +115,10 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$migration->reorganizeFolderStructureForUser($user);
}
$offset += $limit;
- } while (count($users) >= $limit);
+ } while (\count($users) >= $limit);
}
}
$migration->finalCleanUp();
-
}
}
diff --git a/lib/Command/RecreateMasterKey.php b/lib/Command/RecreateMasterKey.php
index 23477a5c..b9890895 100644
--- a/lib/Command/RecreateMasterKey.php
+++ b/lib/Command/RecreateMasterKey.php
@@ -19,7 +19,6 @@
*
*/
-
namespace OCA\Encryption\Command;
use OC\Encryption\DecryptAll;
@@ -129,7 +128,6 @@ public function __construct(IUserManager $userManager, View $rootView, KeyManage
IAppManager $appManager, IAppConfig $appConfig, IConfig $config, ISession $session,
Manager $encryptionManager, QuestionHelper $questionHelper, Setup $userSetup, IMailer $mailer,
ISecureRandom $secureRandom, IL10N $l, ILogger $logger) {
-
parent::__construct();
$this->userManager = $userManager;
$this->rootView = $rootView;
@@ -172,7 +170,6 @@ protected function execute(InputInterface $input, OutputInterface $output) {
'Warning: In order to re-create master key, the entire ownCloud filesystem will be decrypted and then encrypted using new master key.'
. ' Do you want to continue? (y/n)', false);
if ($yes || $this->questionHelper->ask($input, $output, $question)) {
-
$output->writeln("Decryption started\n");
$progress = new ProgressBar($output);
$progress->start();
@@ -183,7 +180,6 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$progress->finish();
if (empty($this->failed)) {
-
$this->appManager->disableApp('encryption');
//Delete the files_encryption dir
@@ -200,7 +196,6 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$this->appConfig->deleteKey('encryption', 'recoveryKeyId');
$this->appConfig->deleteKey('encryption', 'publicShareKeyId');
$this->appConfig->deleteKey('files_encryption', 'installed_version');
-
}
$output->writeln("\nDecryption completed\n");
@@ -241,7 +236,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
protected function decryptAllUsers(InputInterface $input, OutputInterface $output) {
$this->decryptAll = new DecryptAll($this->encryptionManager, $this->userManager, $this->rootView, $this->logger);
- $this->decryptAll->decryptAll($input,$output);
+ $this->decryptAll->decryptAll($input, $output);
}
protected function encryptAllUsers(InputInterface $input, OutputInterface $output) {
@@ -260,4 +255,3 @@ protected function encryptAllUsers(InputInterface $input, OutputInterface $outpu
$this->encryptAll->encryptAll($input, $output);
}
}
-
diff --git a/lib/Command/SelectEncryptionType.php b/lib/Command/SelectEncryptionType.php
index c72ca641..3dcffc1f 100644
--- a/lib/Command/SelectEncryptionType.php
+++ b/lib/Command/SelectEncryptionType.php
@@ -19,7 +19,6 @@
*
*/
-
namespace OCA\Encryption\Command;
use OCA\Encryption\Util;
@@ -51,7 +50,6 @@ class SelectEncryptionType extends Command {
public function __construct(Util $util,
IConfig $config,
QuestionHelper $questionHelper) {
-
$this->util = $util;
$this->config = $config;
$this->questionHelper = $questionHelper;
@@ -120,7 +118,5 @@ protected function execute(InputInterface $input, OutputInterface $output) {
} else {
$output->writeln("The option provided for encryption-type " . $encryptionType . " is not valid. The available options are: 'masterkey' or 'user-keys'");
}
-
}
}
-
diff --git a/lib/Controller/RecoveryController.php b/lib/Controller/RecoveryController.php
index 45dd74e2..987f45a9 100644
--- a/lib/Controller/RecoveryController.php
+++ b/lib/Controller/RecoveryController.php
@@ -23,7 +23,6 @@
namespace OCA\Encryption\Controller;
-
use OCA\Encryption\Recovery;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
@@ -160,7 +159,6 @@ public function changeRecoveryPassword($newPassword, $oldPassword, $confirmPassw
*/
public function userSetRecovery($userEnableRecovery) {
if ($userEnableRecovery === '0' || $userEnableRecovery === '1') {
-
$result = $this->recovery->setRecoveryForUser($userEnableRecovery);
if ($result) {
@@ -179,7 +177,6 @@ public function userSetRecovery($userEnableRecovery) {
]
);
}
-
}
return new DataResponse(
[
@@ -188,5 +185,4 @@ public function userSetRecovery($userEnableRecovery) {
]
], Http::STATUS_BAD_REQUEST);
}
-
}
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index 098c8b32..7674262b 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -95,7 +95,6 @@ public function __construct($AppName,
$this->util = $util;
}
-
/**
* @NoAdminRequired
* @UseSession
@@ -149,7 +148,6 @@ public function updatePrivateKeyPassword($oldPassword, $newPassword) {
Http::STATUS_BAD_REQUEST
);
}
-
}
/**
diff --git a/lib/Controller/StatusController.php b/lib/Controller/StatusController.php
index bd518c08..cd992212 100644
--- a/lib/Controller/StatusController.php
+++ b/lib/Controller/StatusController.php
@@ -20,10 +20,8 @@
*
*/
-
namespace OCA\Encryption\Controller;
-
use OCA\Encryption\Session;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
@@ -59,7 +57,6 @@ public function __construct($AppName,
* @return DataResponse
*/
public function getStatus() {
-
$status = 'error';
$message = 'no valid init status';
switch ($this->session->getStatus()) {
@@ -94,5 +91,4 @@ public function getStatus() {
]
);
}
-
}
diff --git a/lib/Crypto/Crypt.php b/lib/Crypto/Crypt.php
index d99a45f6..daf7b0bd 100644
--- a/lib/Crypto/Crypt.php
+++ b/lib/Crypto/Crypt.php
@@ -25,7 +25,6 @@
namespace OCA\Encryption\Crypto;
-
use OC\Encryption\Exceptions\DecryptionFailedException;
use OC\Encryption\Exceptions\EncryptionFailedException;
use OC\HintException;
@@ -52,7 +51,6 @@
* @package OCA\Encryption\Crypto
*/
class Crypt {
-
const DEFAULT_CIPHER = 'AES-256-CTR';
// default cipher from old ownCloud versions
const LEGACY_CIPHER = 'AES-128-CFB';
@@ -107,7 +105,6 @@ public function __construct(ILogger $logger, IUserSession $userSession, IConfig
* @return array|bool
*/
public function createKeyPair() {
-
$log = $this->logger;
$res = $this->getOpenSSLPKey();
@@ -115,15 +112,15 @@ public function createKeyPair() {
$log->error("Encryption Library couldn't generate users key-pair for {$this->user}",
['app' => 'encryption']);
- if (openssl_error_string()) {
- $log->error('Encryption library openssl_pkey_new() fails: ' . openssl_error_string(),
+ if (\openssl_error_string()) {
+ $log->error('Encryption library openssl_pkey_new() fails: ' . \openssl_error_string(),
['app' => 'encryption']);
}
- } elseif (openssl_pkey_export($res,
+ } elseif (\openssl_pkey_export($res,
$privateKey,
null,
$this->getOpenSSLConfig())) {
- $keyDetails = openssl_pkey_get_details($res);
+ $keyDetails = \openssl_pkey_get_details($res);
$publicKey = $keyDetails['key'];
return [
@@ -133,8 +130,8 @@ public function createKeyPair() {
}
$log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user,
['app' => 'encryption']);
- if (openssl_error_string()) {
- $log->error('Encryption Library:' . openssl_error_string(),
+ if (\openssl_error_string()) {
+ $log->error('Encryption Library:' . \openssl_error_string(),
['app' => 'encryption']);
}
@@ -148,7 +145,7 @@ public function createKeyPair() {
*/
public function getOpenSSLPKey() {
$config = $this->getOpenSSLConfig();
- return openssl_pkey_new($config);
+ return \openssl_pkey_new($config);
}
/**
@@ -158,7 +155,7 @@ public function getOpenSSLPKey() {
*/
private function getOpenSSLConfig() {
$config = ['private_key_bits' => 4096];
- $config = array_merge(
+ $config = \array_merge(
$config,
$this->config->getSystemValue('openssl', [])
);
@@ -174,7 +171,6 @@ private function getOpenSSLConfig() {
* @throws EncryptionFailedException
*/
public function symmetricEncryptFileContent($plainContent, $passPhrase, $version, $position) {
-
if (!$plainContent) {
$this->logger->error('Encryption Library, symmetrical encryption failed no content given',
['app' => 'encryption']);
@@ -207,8 +203,7 @@ public function symmetricEncryptFileContent($plainContent, $passPhrase, $version
* @throws \InvalidArgumentException
*/
public function generateHeader($keyFormat = 'hash') {
-
- if (in_array($keyFormat, $this->supportedKeyFormats, true) === false) {
+ if (\in_array($keyFormat, $this->supportedKeyFormats, true) === false) {
throw new \InvalidArgumentException('key format "' . $keyFormat . '" is not supported');
}
@@ -231,7 +226,7 @@ public function generateHeader($keyFormat = 'hash') {
* @throws EncryptionFailedException
*/
private function encrypt($plainContent, $iv, $passPhrase = '', $cipher = self::DEFAULT_CIPHER) {
- $encryptedContent = openssl_encrypt($plainContent,
+ $encryptedContent = \openssl_encrypt($plainContent,
$cipher,
$passPhrase,
false,
@@ -239,7 +234,7 @@ private function encrypt($plainContent, $iv, $passPhrase = '', $cipher = self::D
if (!$encryptedContent) {
$error = 'Encryption (symmetric) of content failed';
- $this->logger->error($error . openssl_error_string(),
+ $this->logger->error($error . \openssl_error_string(),
['app' => 'encryption']);
throw new EncryptionFailedException($error);
}
@@ -257,7 +252,7 @@ public function getCipher() {
$cipher = $this->config->getSystemValue('cipher', self::DEFAULT_CIPHER);
if (!isset($this->supportedCiphersAndKeySize[$cipher])) {
$this->logger->warning(
- sprintf(
+ \sprintf(
'Unsupported cipher (%s) defined in config.php supported. Falling back to %s',
$cipher,
self::DEFAULT_CIPHER
@@ -289,7 +284,7 @@ protected function getKeySize($cipher) {
}
throw new \InvalidArgumentException(
- sprintf(
+ \sprintf(
'Unsupported cipher (%s) defined.',
$cipher
)
@@ -346,10 +341,10 @@ private function addPadding($data) {
protected function generatePasswordHash($password, $cipher, $uid = '') {
$instanceId = $this->config->getSystemValue('instanceid');
$instanceSecret = $this->config->getSystemValue('secret');
- $salt = hash('sha256', $uid . $instanceId . $instanceSecret, true);
+ $salt = \hash('sha256', $uid . $instanceId . $instanceSecret, true);
$keySize = $this->getKeySize($cipher);
- $hash = hash_pbkdf2(
+ $hash = \hash_pbkdf2(
'sha256',
$password,
$salt,
@@ -389,7 +384,6 @@ public function encryptPrivateKey($privateKey, $password, $uid = '') {
* @return false|string
*/
public function decryptPrivateKey($privateKey, $password = '', $uid = '') {
-
$header = $this->parseHeader($privateKey);
if (isset($header['cipher'])) {
@@ -410,9 +404,9 @@ public function decryptPrivateKey($privateKey, $password = '', $uid = '') {
// If we found a header we need to remove it from the key we want to decrypt
if (!empty($header)) {
- $privateKey = substr($privateKey,
- strpos($privateKey,
- self::HEADER_END) + strlen(self::HEADER_END));
+ $privateKey = \substr($privateKey,
+ \strpos($privateKey,
+ self::HEADER_END) + \strlen(self::HEADER_END));
}
$plainKey = $this->symmetricDecryptFileContent(
@@ -436,9 +430,9 @@ public function decryptPrivateKey($privateKey, $password = '', $uid = '') {
* @return bool
*/
protected function isValidPrivateKey($plainKey) {
- $res = openssl_get_privatekey($plainKey);
- if (is_resource($res)) {
- $sslInfo = openssl_pkey_get_details($res);
+ $res = \openssl_get_privatekey($plainKey);
+ if (\is_resource($res)) {
+ $sslInfo = \openssl_pkey_get_details($res);
if (isset($sslInfo['key'])) {
return true;
}
@@ -479,7 +473,7 @@ public function symmetricDecryptFileContent($keyFileContents, $passPhrase, $ciph
*/
private function checkSignature($data, $passPhrase, $expectedSignature) {
$signature = $this->createSignature($data, $passPhrase);
- if (!hash_equals($expectedSignature, $signature)) {
+ if (!\hash_equals($expectedSignature, $signature)) {
throw new HintException('Bad Signature', $this->l->t('Bad Signature'));
}
}
@@ -492,12 +486,11 @@ private function checkSignature($data, $passPhrase, $expectedSignature) {
* @return string
*/
private function createSignature($data, $passPhrase) {
- $passPhrase = hash('sha512', $passPhrase . 'a', true);
- $signature = hash_hmac('sha256', $data, $passPhrase);
+ $passPhrase = \hash('sha512', $passPhrase . 'a', true);
+ $signature = \hash_hmac('sha256', $data, $passPhrase);
return $signature;
}
-
/**
* remove padding
*
@@ -506,10 +499,10 @@ private function createSignature($data, $passPhrase) {
* @return string|false
*/
private function removePadding($padded, $hasSignature = false) {
- if ($hasSignature === false && substr($padded, -2) === 'xx') {
- return substr($padded, 0, -2);
- } elseif ($hasSignature === true && substr($padded, -3) === 'xxx') {
- return substr($padded, 0, -3);
+ if ($hasSignature === false && \substr($padded, -2) === 'xx') {
+ return \substr($padded, 0, -2);
+ } elseif ($hasSignature === true && \substr($padded, -3) === 'xxx') {
+ return \substr($padded, 0, -3);
}
return false;
}
@@ -526,16 +519,16 @@ private function removePadding($padded, $hasSignature = false) {
private function splitMetaData($catFile, $cipher) {
if ($this->hasSignature($catFile, $cipher)) {
$catFile = $this->removePadding($catFile, true);
- $meta = substr($catFile, -93);
- $iv = substr($meta, strlen('00iv00'), 16);
- $sig = substr($meta, 22 + strlen('00sig00'));
- $encrypted = substr($catFile, 0, -93);
+ $meta = \substr($catFile, -93);
+ $iv = \substr($meta, \strlen('00iv00'), 16);
+ $sig = \substr($meta, 22 + \strlen('00sig00'));
+ $encrypted = \substr($catFile, 0, -93);
} else {
$catFile = $this->removePadding($catFile);
- $meta = substr($catFile, -22);
- $iv = substr($meta, -16);
+ $meta = \substr($catFile, -22);
+ $iv = \substr($meta, -16);
$sig = false;
- $encrypted = substr($catFile, 0, -22);
+ $encrypted = \substr($catFile, 0, -22);
}
return [
@@ -554,18 +547,17 @@ private function splitMetaData($catFile, $cipher) {
* @throws HintException
*/
private function hasSignature($catFile, $cipher) {
- $meta = substr($catFile, -93);
- $signaturePosition = strpos($meta, '00sig00');
+ $meta = \substr($catFile, -93);
+ $signaturePosition = \strpos($meta, '00sig00');
// enforce signature for the new 'CTR' ciphers
- if ($signaturePosition === false && strpos(strtolower($cipher), 'ctr') !== false) {
+ if ($signaturePosition === false && \strpos(\strtolower($cipher), 'ctr') !== false) {
throw new HintException('Missing Signature', $this->l->t('Missing Signature'));
}
return ($signaturePosition !== false);
}
-
/**
* @param string $encryptedContent
* @param string $iv
@@ -575,7 +567,7 @@ private function hasSignature($catFile, $cipher) {
* @throws DecryptionFailedException
*/
private function decrypt($encryptedContent, $iv, $passPhrase = '', $cipher = self::DEFAULT_CIPHER) {
- $plainContent = openssl_decrypt($encryptedContent,
+ $plainContent = \openssl_decrypt($encryptedContent,
$cipher,
$passPhrase,
false,
@@ -584,7 +576,7 @@ private function decrypt($encryptedContent, $iv, $passPhrase = '', $cipher = sel
if ($plainContent) {
return $plainContent;
} else {
- throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: ' . openssl_error_string());
+ throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: ' . \openssl_error_string());
}
}
@@ -595,19 +587,19 @@ private function decrypt($encryptedContent, $iv, $passPhrase = '', $cipher = sel
protected function parseHeader($data) {
$result = [];
- if (substr($data, 0, strlen(self::HEADER_START)) === self::HEADER_START) {
- $endAt = strpos($data, self::HEADER_END);
- $header = substr($data, 0, $endAt + strlen(self::HEADER_END));
+ if (\substr($data, 0, \strlen(self::HEADER_START)) === self::HEADER_START) {
+ $endAt = \strpos($data, self::HEADER_END);
+ $header = \substr($data, 0, $endAt + \strlen(self::HEADER_END));
// +1 not to start with an ':' which would result in empty element at the beginning
- $exploded = explode(':',
- substr($header, strlen(self::HEADER_START) + 1));
+ $exploded = \explode(':',
+ \substr($header, \strlen(self::HEADER_START) + 1));
- $element = array_shift($exploded);
+ $element = \array_shift($exploded);
while ($element != self::HEADER_END) {
- $result[$element] = array_shift($exploded);
- $element = array_shift($exploded);
+ $result[$element] = \array_shift($exploded);
+ $element = \array_shift($exploded);
}
}
@@ -621,7 +613,7 @@ protected function parseHeader($data) {
* @throws GenericEncryptionException
*/
private function generateIv() {
- return random_bytes(16);
+ return \random_bytes(16);
}
/**
@@ -632,7 +624,7 @@ private function generateIv() {
* @throws \Exception
*/
public function generateFileKey() {
- return random_bytes(32);
+ return \random_bytes(32);
}
/**
@@ -647,10 +639,10 @@ public function multiKeyDecrypt($encKeyFile, $shareKey, $privateKey) {
throw new MultiKeyDecryptException('Cannot multikey decrypt empty plain content');
}
- if (openssl_open($encKeyFile, $plainContent, $shareKey, $privateKey)) {
+ if (\openssl_open($encKeyFile, $plainContent, $shareKey, $privateKey)) {
return $plainContent;
} else {
- throw new MultiKeyDecryptException('multikeydecrypt with share key failed:' . openssl_error_string());
+ throw new MultiKeyDecryptException('multikeydecrypt with share key failed:' . \openssl_error_string());
}
}
@@ -672,7 +664,7 @@ public function multiKeyEncrypt($plainContent, array $keyFiles) {
$shareKeys = [];
$mappedShareKeys = [];
- if (openssl_seal($plainContent, $sealed, $shareKeys, $keyFiles)) {
+ if (\openssl_seal($plainContent, $sealed, $shareKeys, $keyFiles)) {
$i = 0;
// Ensure each shareKey is labelled with its corresponding key id
@@ -686,8 +678,7 @@ public function multiKeyEncrypt($plainContent, array $keyFiles) {
'data' => $sealed
];
} else {
- throw new MultiKeyEncryptException('multikeyencryption failed ' . openssl_error_string());
+ throw new MultiKeyEncryptException('multikeyencryption failed ' . \openssl_error_string());
}
}
}
-
diff --git a/lib/Crypto/DecryptAll.php b/lib/Crypto/DecryptAll.php
index 34e562b9..426bd601 100644
--- a/lib/Crypto/DecryptAll.php
+++ b/lib/Crypto/DecryptAll.php
@@ -19,10 +19,8 @@
*
*/
-
namespace OCA\Encryption\Crypto;
-
use OC\Helper\EnvironmentHelper;
use OC\User\LoginException;
use OCA\Encryption\KeyManager;
@@ -132,7 +130,7 @@ public function prepare(InputInterface $input, OutputInterface $output, $user) {
// Must either be using recovery keys, or just decrypting one user and know their password
// Check a method has been passed
- if(!$input->hasOption('method') && !in_array($input->getOption('method'),['recovery', 'password'])) {
+ if (!$input->hasOption('method') && !\in_array($input->getOption('method'), ['recovery', 'password'])) {
$output->writeln('A method must be supplied when decrypting from user-key state');
return false;
}
@@ -199,8 +197,7 @@ public function prepare(InputInterface $input, OutputInterface $output, $user) {
$output->writeln('OC password not set in the envrironment');
$throwLoginException = true;
}
- }
-
+ }
}
}
diff --git a/lib/Crypto/EncryptAll.php b/lib/Crypto/EncryptAll.php
index 601ff178..78de757a 100644
--- a/lib/Crypto/EncryptAll.php
+++ b/lib/Crypto/EncryptAll.php
@@ -21,7 +21,6 @@
*
*/
-
namespace OCA\Encryption\Crypto;
use OC\Encryption\Exceptions\DecryptionFailedException;
@@ -127,14 +126,13 @@ public function __construct(
* @param OutputInterface $output
*/
public function encryptAll(InputInterface $input, OutputInterface $output) {
-
$this->input = $input;
$this->output = $output;
$headline = 'Encrypt all files with the ' . Encryption::DISPLAY_NAME;
$this->output->writeln("\n");
$this->output->writeln($headline);
- $this->output->writeln(str_pad('', strlen($headline), '='));
+ $this->output->writeln(\str_pad('', \strlen($headline), '='));
$this->output->writeln("\n");
if ($this->util->isMasterKeyEnabled()) {
@@ -196,7 +194,7 @@ protected function createKeyPairs() {
}
}
$offset += $limit;
- } while (count($users) >= $limit);
+ } while (\count($users) >= $limit);
}
$progress->setMessage('Key-pair created for all users');
@@ -211,7 +209,7 @@ protected function encryptAllUsersFiles() {
$progress = new ProgressBar($this->output);
$progress->setFormat(" %message% \n [%bar%]");
$progress->start();
- $numberOfUsers = count($this->userPasswords);
+ $numberOfUsers = \count($this->userPasswords);
$userNo = 1;
if ($this->util->isMasterKeyEnabled()) {
$this->encryptAllUserFilesWithMasterKey($progress);
@@ -224,7 +222,6 @@ protected function encryptAllUsersFiles() {
}
$progress->setMessage("all files encrypted");
$progress->finish();
-
}
/**
@@ -245,7 +242,7 @@ protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) {
$userNo++;
}
$offset += $limit;
- } while (count($users) >= $limit);
+ } while (\count($users) >= $limit);
}
}
@@ -257,12 +254,11 @@ protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) {
* @param string $userCount
*/
protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) {
-
$this->setupUserFS($uid);
$directories = [];
$directories[] = '/' . $uid . '/files';
- while ($root = array_pop($directories)) {
+ while ($root = \array_pop($directories)) {
$content = $this->rootView->getDirectoryContent($root);
foreach ($content as $file) {
// only encrypt files owned by the user, exclude incoming local shares, and incoming federated shares
@@ -292,9 +288,8 @@ protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) {
* @return bool
*/
protected function encryptFile($path) {
-
$source = $path;
- $target = $path . '.encrypted.' . time() . '.part';
+ $target = $path . '.encrypted.' . \time() . '.part';
try {
$version = $this->keyManager->getVersion($source, $this->rootView);
@@ -363,9 +358,9 @@ protected function outputPasswords() {
protected function writePasswordsToFile(array $passwords) {
$fp = $this->rootView->fopen('oneTimeEncryptionPasswords.csv', 'w');
foreach ($passwords as $pwd) {
- fputcsv($fp, $pwd);
+ \fputcsv($fp, $pwd);
}
- fclose($fp);
+ \fclose($fp);
$this->output->writeln("\n");
$this->output->writeln('A list of all newly created passwords was written to data/oneTimeEncryptionPasswords.csv');
$this->output->writeln('');
@@ -405,7 +400,7 @@ protected function sendPasswordsByMail() {
$noMail = [];
$this->output->writeln('');
- $progress = new ProgressBar($this->output, count($this->userPasswords));
+ $progress = new ProgressBar($this->output, \count($this->userPasswords));
$progress->start();
foreach ($this->userPasswords as $uid => $password) {
@@ -456,7 +451,6 @@ protected function sendPasswordsByMail() {
$table->setRows($rows);
$table->render();
}
-
}
/**
@@ -466,7 +460,6 @@ protected function sendPasswordsByMail() {
* @return array an array of the html mail body and the plain text mail body
*/
protected function createMailBody($password) {
-
$html = new \OC_Template("encryption", "mail", "");
$html->assign('password', $password);
$htmlMail = $html->fetchPage();
@@ -477,5 +470,4 @@ protected function createMailBody($password) {
return [$htmlMail, $plainTextMail];
}
-
}
diff --git a/lib/Crypto/Encryption.php b/lib/Crypto/Encryption.php
index 1bb6dbe7..a56d38e7 100644
--- a/lib/Crypto/Encryption.php
+++ b/lib/Crypto/Encryption.php
@@ -26,7 +26,6 @@
namespace OCA\Encryption\Crypto;
-
use OC\Encryption\Exceptions\DecryptionFailedException;
use OC\Files\Cache\Scanner;
use OC\Files\View;
@@ -41,7 +40,6 @@
use Symfony\Component\Console\Output\OutputInterface;
class Encryption implements IEncryptionModule {
-
const ID = 'OC_DEFAULT_MODULE';
const DISPLAY_NAME = 'Default encryption module';
@@ -107,7 +105,6 @@ class Encryption implements IEncryptionModule {
/** @var array remember encryption signature version */
private static $rememberVersion = [];
-
/**
*
* @param Crypt $crypt
@@ -197,7 +194,6 @@ public function begin($path, $user, $mode, array $header, array $accessList, $so
$this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View());
}
-
if (
$mode === 'w'
|| $mode === 'w+'
@@ -303,16 +299,15 @@ public function encrypt($data, $position = 0) {
// Clear the write cache, ready for reuse - it has been
// flushed and its old contents processed
$this->writeCache = '';
-
}
$encrypted = '';
// While there still remains some data to be processed & written
- while (strlen($data) > 0) {
+ while (\strlen($data) > 0) {
// Remaining length for this iteration, not of the
// entire file (may be greater than 8192 bytes)
- $remainingLength = strlen($data);
+ $remainingLength = \strlen($data);
// If data remaining to be written is less than the
// size of 1 6126 byte block
@@ -330,21 +325,18 @@ public function encrypt($data, $position = 0) {
// Clear $data ready for next round
$data = '';
-
} else {
// Read the chunk from the start of $data
- $chunk = substr($data, 0, $this->unencryptedBlockSizeSigned);
+ $chunk = \substr($data, 0, $this->unencryptedBlockSizeSigned);
$encrypted .= $this->crypt->symmetricEncryptFileContent($chunk, $this->fileKey, $this->version + 1, $position);
// Remove the chunk we just processed from
// $data, leaving only unprocessed data in $data
// var, for handling on the next round
- $data = substr($data, $this->unencryptedBlockSizeSigned);
-
+ $data = \substr($data, $this->unencryptedBlockSizeSigned);
}
-
}
return $encrypted;
@@ -379,7 +371,6 @@ public function decrypt($data, $position = 0) {
* @return boolean
*/
public function update($path, $uid, array $accessList) {
-
if (empty($accessList)) {
if (isset(self::$rememberVersion[$path])) {
$this->keyManager->setVersion($path, self::$rememberVersion[$path], new View());
@@ -391,7 +382,6 @@ public function update($path, $uid, array $accessList) {
$fileKey = $this->keyManager->getFileKey($path, $uid);
if (!empty($fileKey)) {
-
$publicKeys = [];
if ($this->useMasterPassword === true) {
$publicKeys[$this->keyManager->getMasterKeyId()] = $this->keyManager->getPublicMasterKey();
@@ -412,7 +402,6 @@ public function update($path, $uid, array $accessList) {
$this->keyManager->deleteAllFileKeys($path);
$this->keyManager->setAllFileKeys($path, $encryptedFileKey);
-
} else {
$this->logger->debug('no file key found, we assume that the file "{file}" is not encrypted',
['file' => $path, 'app' => 'encryption']);
@@ -436,8 +425,8 @@ public function shouldEncrypt($path) {
return false;
}
}
- $parts = explode('/', $path);
- if (count($parts) < 4) {
+ $parts = \explode('/', $path);
+ if (\count($parts) < 4) {
return false;
}
@@ -521,18 +510,17 @@ public function prepareDecryptAll(InputInterface $input, OutputInterface $output
return $this->decryptAll->prepare($input, $output, $user);
}
-
/**
* @param string $path
* @return string
*/
protected function getPathToRealFile($path) {
$realPath = $path;
- $parts = explode('/', $path);
+ $parts = \explode('/', $path);
if ($parts[2] === 'files_versions') {
- $realPath = '/' . $parts[1] . '/files/' . implode('/', array_slice($parts, 3));
- $length = strrpos($realPath, '.');
- $realPath = substr($realPath, 0, $length);
+ $realPath = '/' . $parts[1] . '/files/' . \implode('/', \array_slice($parts, 3));
+ $length = \strrpos($realPath, '.');
+ $realPath = \substr($realPath, 0, $length);
}
return $realPath;
@@ -546,9 +534,9 @@ protected function getPathToRealFile($path) {
* @return string
*/
protected function stripPartFileExtension($path) {
- if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
- $pos = strrpos($path, '.', -6);
- $path = substr($path, 0, $pos);
+ if (\pathinfo($path, PATHINFO_EXTENSION) === 'part') {
+ $pos = \strrpos($path, '.', -6);
+ $path = \substr($path, 0, $pos);
}
return $path;
diff --git a/lib/Exceptions/MultiKeyDecryptException.php b/lib/Exceptions/MultiKeyDecryptException.php
index e308451f..4032c56a 100644
--- a/lib/Exceptions/MultiKeyDecryptException.php
+++ b/lib/Exceptions/MultiKeyDecryptException.php
@@ -23,5 +23,4 @@
use OCP\Encryption\Exceptions\GenericEncryptionException;
class MultiKeyDecryptException extends GenericEncryptionException {
-
}
diff --git a/lib/Exceptions/MultiKeyEncryptException.php b/lib/Exceptions/MultiKeyEncryptException.php
index 525ecfbd..6752c5ee 100644
--- a/lib/Exceptions/MultiKeyEncryptException.php
+++ b/lib/Exceptions/MultiKeyEncryptException.php
@@ -23,5 +23,4 @@
use OCP\Encryption\Exceptions\GenericEncryptionException;
class MultiKeyEncryptException extends GenericEncryptionException {
-
}
diff --git a/lib/Exceptions/PrivateKeyMissingException.php b/lib/Exceptions/PrivateKeyMissingException.php
index 8316372d..4f3e9271 100644
--- a/lib/Exceptions/PrivateKeyMissingException.php
+++ b/lib/Exceptions/PrivateKeyMissingException.php
@@ -36,5 +36,4 @@ public function __construct($userId) {
}
parent::__construct("Private Key missing for user: $userId");
}
-
}
diff --git a/lib/Exceptions/PublicKeyMissingException.php b/lib/Exceptions/PublicKeyMissingException.php
index 2443d832..949fab0f 100644
--- a/lib/Exceptions/PublicKeyMissingException.php
+++ b/lib/Exceptions/PublicKeyMissingException.php
@@ -33,5 +33,4 @@ public function __construct($userId) {
}
parent::__construct("Public Key missing for user: $userId");
}
-
}
diff --git a/lib/HookManager.php b/lib/HookManager.php
index 9491ed7e..2ecb529d 100644
--- a/lib/HookManager.php
+++ b/lib/HookManager.php
@@ -22,11 +22,9 @@
namespace OCA\Encryption;
-
use OCA\Encryption\Hooks\Contracts\IHook;
class HookManager {
-
private $hookInstances = [];
/**
@@ -35,14 +33,13 @@ class HookManager {
* @return bool
*/
public function registerHook($instances) {
- if (is_array($instances)) {
+ if (\is_array($instances)) {
foreach ($instances as $instance) {
if (!$instance instanceof IHook) {
return false;
}
$this->hookInstances[] = $instance;
}
-
} elseif ($instances instanceof IHook) {
$this->hookInstances[] = $instances;
}
@@ -58,7 +55,5 @@ public function fireHooks() {
*/
$instance->addHooks();
}
-
}
-
}
diff --git a/lib/Hooks/Contracts/IHook.php b/lib/Hooks/Contracts/IHook.php
index 2093a5fe..ffd1bc35 100644
--- a/lib/Hooks/Contracts/IHook.php
+++ b/lib/Hooks/Contracts/IHook.php
@@ -21,7 +21,6 @@
namespace OCA\Encryption\Hooks\Contracts;
-
interface IHook {
/**
* Connects Hooks
diff --git a/lib/Hooks/UserHooks.php b/lib/Hooks/UserHooks.php
index 0a06ad67..8f312ec9 100644
--- a/lib/Hooks/UserHooks.php
+++ b/lib/Hooks/UserHooks.php
@@ -24,7 +24,6 @@
namespace OCA\Encryption\Hooks;
-
use OC\Files\Filesystem;
use OCP\IConfig;
use OCP\IUserManager;
@@ -105,7 +104,6 @@ public function __construct(KeyManager $keyManager,
Session $session,
Crypt $crypt,
Recovery $recovery, IConfig $config) {
-
$this->keyManager = $keyManager;
$this->userManager = $userManager;
$this->logger = $logger;
@@ -151,7 +149,6 @@ public function addHooks() {
}
}
-
/**
* Startup encryption backend upon user login
*
@@ -160,7 +157,6 @@ public function addHooks() {
* @return boolean|null
*/
public function login($params) {
-
if (!App::isEnabled('encryption')) {
return true;
}
@@ -195,7 +191,6 @@ public function logout() {
* @param array $params
*/
public function postCreateUser($params) {
-
if (App::isEnabled('encryption')) {
$this->userSetup->setupUser($params['uid'], $params['password']);
}
@@ -208,18 +203,16 @@ public function postCreateUser($params) {
* @note This method should never be called for users using client side encryption
*/
public function postDeleteUser($params) {
-
if (App::isEnabled('encryption')) {
/**
* Adding a safe condition to make sure the uid is not
* empty or null.
*/
- if (!is_null($params['uid']) && ($params['uid'] !== '')) {
+ if (($params['uid'] !== null) && ($params['uid'] !== '')) {
$this->keyManager->deletePublicKey($params['uid']);
\OC::$server->getEncryptionKeyStorage()->deleteAltUserStorageKeys($params['uid']);
}
}
-
}
/**
@@ -230,7 +223,6 @@ public function postDeleteUser($params) {
*/
public function preSetPassphrase($params) {
if (App::isEnabled('encryption')) {
-
$user = $this->userManager->get($params['uid']);
if ($user && !$user->canChangePassword()) {
@@ -323,7 +315,6 @@ protected function initMountPoints($user) {
Filesystem::initMountPoints($user);
}
-
/**
* after password reset we create a new key pair for the user
*
diff --git a/lib/KeyManager.php b/lib/KeyManager.php
index 8c23a0a3..4d341103 100644
--- a/lib/KeyManager.php
+++ b/lib/KeyManager.php
@@ -115,7 +115,6 @@ public function __construct(
ILogger $log,
Util $util
) {
-
$this->util = $util;
$this->session = $session;
$this->keyStorage = $keyStorage;
@@ -126,7 +125,7 @@ public function __construct(
$this->recoveryKeyId = $this->config->getAppValue('encryption',
'recoveryKeyId');
if (empty($this->recoveryKeyId)) {
- $this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8);
+ $this->recoveryKeyId = 'recoveryKey_' . \substr(\md5(\time()), 0, 8);
$this->config->setAppValue('encryption',
'recoveryKeyId',
$this->recoveryKeyId);
@@ -162,7 +161,6 @@ public function validateShareKey() {
* check if a key pair for the master key exists, if not we create one
*/
public function validateMasterKey() {
-
if ($this->util->isMasterKeyEnabled() === false) {
return;
}
@@ -332,7 +330,6 @@ public function setShareKey($path, $uid, $key) {
* @return boolean
*/
public function init($uid, $passPhrase) {
-
$this->session->setStatus(Session::INIT_EXECUTED);
try {
@@ -375,7 +372,7 @@ public function getPrivateKey($userId) {
$privateKey = $this->keyStorage->getUserKey($userId,
$this->privateKeyId, Encryption::ID);
- if (strlen($privateKey) !== 0) {
+ if (\strlen($privateKey) !== 0) {
return $privateKey;
}
throw new PrivateKeyMissingException($userId);
@@ -390,7 +387,7 @@ public function getFileKey($path, $uid) {
if ($uid === '') {
$uid = null;
}
- $publicAccess = is_null($uid);
+ $publicAccess = ($uid === null);
$encryptedFileKey = $this->keyStorage->getFileKey($path, $this->fileKeyId, Encryption::ID);
if (empty($encryptedFileKey)) {
@@ -407,7 +404,7 @@ public function getFileKey($path, $uid) {
// when logged in, the master key is already decrypted in the session
$privateKey = $this->session->getPrivateKey();
}
- } else if ($publicAccess) {
+ } elseif ($publicAccess) {
// use public share key for public links
$uid = $this->getPublicShareKeyId();
$shareKey = $this->getShareKey($path, $uid);
@@ -485,7 +482,6 @@ public function deleteShareKey($path, $keyId) {
Encryption::ID);
}
-
/**
* @param $path
* @param $uid
@@ -538,7 +534,7 @@ public function userHasKeys($userId) {
public function getPublicKey($userId) {
$publicKey = $this->keyStorage->getUserKey($userId, $this->publicKeyId, Encryption::ID);
- if (strlen($publicKey) !== 0) {
+ if (\strlen($publicKey) !== 0) {
return $publicKey;
}
throw new PublicKeyMissingException($userId);
@@ -618,7 +614,6 @@ public function getPublicKeys(array $userIds) {
}
return $keys;
-
}
/**
@@ -661,7 +656,6 @@ public function addSystemKeys(array $accessList, array $publicKeys, $uid) {
if ($this->recoveryKeyExists() &&
$this->util->isRecoveryEnabledForUser($uid)) {
-
$publicKeys[$this->getRecoveryKeyId()] = $this->getRecoveryKey();
}
@@ -689,7 +683,7 @@ public function getMasterKeyPassword() {
* @return string
*/
public function getMasterKeyId() {
- if($this->config->getAppValue('encryption', 'masterKeyId') !== $this->masterKeyId) {
+ if ($this->config->getAppValue('encryption', 'masterKeyId') !== $this->masterKeyId) {
$this->masterKeyId = $this->config->getAppValue('encryption', 'masterKeyId');
}
return $this->masterKeyId;
@@ -710,15 +704,15 @@ public function getPublicMasterKey() {
public function setPublicShareKeyIDAndMasterKeyId() {
$this->publicShareKeyId = $this->config->getAppValue('encryption',
'publicShareKeyId');
- if (is_null($this->publicShareKeyId) || ($this->publicShareKeyId === '')) {
- $this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
+ if (($this->publicShareKeyId === null) || ($this->publicShareKeyId === '')) {
+ $this->publicShareKeyId = 'pubShare_' . \substr(\md5(\time()), 0, 8);
$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
}
$this->masterKeyId = $this->config->getAppValue('encryption',
'masterKeyId');
- if (is_null($this->masterKeyId) || ($this->masterKeyId === '')) {
- $this->masterKeyId = 'master_' . substr(md5(time()), 0, 8);
+ if (($this->masterKeyId === null) || ($this->masterKeyId === '')) {
+ $this->masterKeyId = 'master_' . \substr(\md5(\time()), 0, 8);
$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId);
}
}
diff --git a/lib/Migration.php b/lib/Migration.php
index 59c872ba..a22c71f6 100644
--- a/lib/Migration.php
+++ b/lib/Migration.php
@@ -24,14 +24,12 @@
namespace OCA\Encryption;
-
use OC\Files\View;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\ILogger;
class Migration {
-
private $moduleId;
/** @var \OC\Files\View */
private $view;
@@ -91,19 +89,18 @@ public function reorganizeFolderStructure() {
$limit = 500;
$offset = 0;
do {
- $users = \OC::$server->getUserManager()->search('', $limit, $offset);
+ $users = \OC::$server->getUserManager()->search('', $limit, $offset);
foreach ($users as $user) {
$this->reorganizeFolderStructureForUser($user->getUID());
}
$offset += $limit;
- } while (count($users) >= $limit);
+ } while (\count($users) >= $limit);
}
/**
* reorganize system wide folder structure
*/
public function reorganizeSystemFolderStructure() {
-
$this->createPathForKeys('/files_encryption');
// backup system wide folders
@@ -119,7 +116,6 @@ public function reorganizeSystemFolderStructure() {
$storage->getScanner()->scan('files_encryption');
}
-
/**
* reorganize folder structure for user
*
@@ -195,7 +191,7 @@ public function updateDB() {
* create backup of system-wide keys
*/
private function backupSystemWideKeys() {
- $backupDir = 'encryption_migration_backup_' . date("Y-m-d_H-i-s");
+ $backupDir = 'encryption_migration_backup_' . \date("Y-m-d_H-i-s");
$this->view->mkdir($backupDir);
$this->view->copy('files_encryption', $backupDir . '/files_encryption');
}
@@ -209,7 +205,7 @@ private function backupSystemWideKeys() {
private function backupUserKeys($user) {
$encryptionDir = $user . '/files_encryption';
if ($this->view->is_dir($encryptionDir)) {
- $backupDir = $user . '/encryption_migration_backup_' . date("Y-m-d_H-i-s");
+ $backupDir = $user . '/encryption_migration_backup_' . \date("Y-m-d_H-i-s");
$this->view->mkdir($backupDir);
$this->view->copy($encryptionDir, $backupDir);
return true;
@@ -223,8 +219,8 @@ private function backupUserKeys($user) {
private function renameSystemPrivateKeys() {
$dh = $this->view->opendir('files_encryption');
$this->createPathForKeys('/files_encryption/' . $this->moduleId);
- if (is_resource($dh)) {
- while (($privateKey = readdir($dh)) !== false) {
+ if (\is_resource($dh)) {
+ while (($privateKey = \readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($privateKey)) {
if (!$this->view->is_dir('/files_encryption/' . $privateKey)) {
$this->view->rename('files_encryption/' . $privateKey, 'files_encryption/' . $this->moduleId . '/' . $privateKey);
@@ -232,7 +228,7 @@ private function renameSystemPrivateKeys() {
}
}
}
- closedir($dh);
+ \closedir($dh);
}
}
@@ -242,7 +238,7 @@ private function renameSystemPrivateKeys() {
* @param string $privateKey private key for which we want to rename the corresponding public key
*/
private function renameSystemPublicKey($privateKey) {
- $publicKey = substr($privateKey, 0, strrpos($privateKey, '.privateKey')) . '.publicKey';
+ $publicKey = \substr($privateKey, 0, \strrpos($privateKey, '.privateKey')) . '.publicKey';
$this->view->rename('files_encryption/public_keys/' . $publicKey, 'files_encryption/' . $this->moduleId . '/' . $publicKey);
}
@@ -255,7 +251,7 @@ private function renameUsersPrivateKey($user) {
$oldPrivateKey = $user . '/files_encryption/' . $user . '.privateKey';
$newPrivateKey = $user . '/files_encryption/' . $this->moduleId . '/' . $user . '.privateKey';
if ($this->view->file_exists($oldPrivateKey)) {
- $this->createPathForKeys(dirname($newPrivateKey));
+ $this->createPathForKeys(\dirname($newPrivateKey));
$this->view->rename($oldPrivateKey, $newPrivateKey);
}
}
@@ -269,7 +265,7 @@ private function renameUsersPublicKey($user) {
$oldPublicKey = '/files_encryption/public_keys/' . $user . '.publicKey';
$newPublicKey = $user . '/files_encryption/' . $this->moduleId . '/' . $user . '.publicKey';
if ($this->view->file_exists($oldPublicKey)) {
- $this->createPathForKeys(dirname($newPublicKey));
+ $this->createPathForKeys(\dirname($newPublicKey));
$this->view->rename($oldPublicKey, $newPublicKey);
}
}
@@ -282,7 +278,6 @@ private function renameUsersPublicKey($user) {
* @param bool $trash
*/
private function renameFileKeys($user, $path, $trash = false) {
-
if ($this->view->is_dir($user . '/' . $path) === false) {
$this->logger->info('Skip dir /' . $user . '/' . $path . ': does not exist');
return;
@@ -290,15 +285,15 @@ private function renameFileKeys($user, $path, $trash = false) {
$dh = $this->view->opendir($user . '/' . $path);
- if (is_resource($dh)) {
- while (($file = readdir($dh)) !== false) {
+ if (\is_resource($dh)) {
+ while (($file = \readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
if ($this->view->is_dir($user . '/' . $path . '/' . $file)) {
$this->renameFileKeys($user, $path . '/' . $file, $trash);
} else {
$target = $this->getTargetDir($user, $path, $file, $trash);
if ($target !== false) {
- $this->createPathForKeys(dirname($target));
+ $this->createPathForKeys(\dirname($target));
$this->view->rename($user . '/' . $path . '/' . $file, $target);
} else {
$this->logger->warning(
@@ -309,7 +304,7 @@ private function renameFileKeys($user, $path, $trash = false) {
}
}
}
- closedir($dh);
+ \closedir($dh);
}
}
@@ -335,10 +330,10 @@ protected function getSystemMountPoints() {
*/
private function getTargetDir($user, $keyPath, $filename, $trash) {
if ($trash) {
- $filePath = substr($keyPath, strlen('/files_trashbin/keys/'));
+ $filePath = \substr($keyPath, \strlen('/files_trashbin/keys/'));
$targetDir = $user . '/files_encryption/keys/files_trashbin/' . $filePath . '/' . $this->moduleId . '/' . $filename;
} else {
- $filePath = substr($keyPath, strlen('/files_encryption/keys/'));
+ $filePath = \substr($keyPath, \strlen('/files_encryption/keys/'));
$targetDir = $user . '/files_encryption/keys/files/' . $filePath . '/' . $this->moduleId . '/' . $filename;
}
@@ -348,15 +343,15 @@ private function getTargetDir($user, $keyPath, $filename, $trash) {
$systemMountPoints = $this->getSystemMountPoints();
foreach ($systemMountPoints as $mountPoint) {
$normalizedMountPoint = \OC\Files\Filesystem::normalizePath($mountPoint['mountpoint']) . '/';
- if (strpos($normalized, $normalizedMountPoint) === 0) {
- return $targetDir;
+ if (\strpos($normalized, $normalizedMountPoint) === 0) {
+ return $targetDir;
}
}
- } else if ($trash === false && $this->view->file_exists('/' . $user . '/files/' . $filePath)) {
+ } elseif ($trash === false && $this->view->file_exists('/' . $user . '/files/' . $filePath)) {
return $targetDir;
- } else if ($trash === true && $this->view->file_exists('/' . $user . '/files_trashbin/' . $filePath)) {
- return $targetDir;
- }
+ } elseif ($trash === true && $this->view->file_exists('/' . $user . '/files_trashbin/' . $filePath)) {
+ return $targetDir;
+ }
return false;
}
@@ -378,7 +373,7 @@ private function deleteOldKeys($user) {
*/
private function createPathForKeys($path) {
if (!$this->view->file_exists($path)) {
- $sub_dirs = explode('/', $path);
+ $sub_dirs = \explode('/', $path);
$dir = '';
foreach ($sub_dirs as $sub_dir) {
$dir .= '/' . $sub_dir;
diff --git a/lib/Panels/Admin.php b/lib/Panels/Admin.php
index 6125dc5a..5f341ddb 100644
--- a/lib/Panels/Admin.php
+++ b/lib/Panels/Admin.php
@@ -95,4 +95,4 @@ public function getPanel() {
$tmpl->assign('masterKeyEnabled', $util->isMasterKeyEnabled());
return $tmpl;
}
-}
\ No newline at end of file
+}
diff --git a/lib/Panels/Personal.php b/lib/Panels/Personal.php
index 99fea72b..39dcc532 100644
--- a/lib/Panels/Personal.php
+++ b/lib/Panels/Personal.php
@@ -105,4 +105,4 @@ public function getPanel() {
}
return null;
}
-}
\ No newline at end of file
+}
diff --git a/lib/Recovery.php b/lib/Recovery.php
index 9ce4c7ab..f628be19 100644
--- a/lib/Recovery.php
+++ b/lib/Recovery.php
@@ -24,7 +24,6 @@
namespace OCA\Encryption;
-
use OCA\Encryption\Crypto\Crypt;
use OCP\Encryption\Keys\IStorage;
use OCP\IConfig;
@@ -37,7 +36,6 @@
class Recovery {
-
/**
* @var null|IUser
*/
@@ -109,7 +107,7 @@ public function enableAdminRecovery($password) {
if (!$keyManager->recoveryKeyExists()) {
$keyPair = $this->crypt->createKeyPair();
- if (!is_array($keyPair)) {
+ if (!\is_array($keyPair)) {
return false;
}
@@ -194,7 +192,6 @@ public function isRecoveryKeyEnabled() {
* @return bool
*/
public function setRecoveryForUser($value) {
-
try {
$this->config->setUserValue($this->user->getUID(),
'encryption',
@@ -291,7 +288,6 @@ private function recoverAllFiles($path, $privateKey, $uid) {
$this->recoverFile($filePath, $privateKey, $uid);
}
}
-
}
/**
@@ -323,8 +319,5 @@ private function recoverFile($path, $privateKey, $uid) {
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
$this->keyManager->setAllFileKeys($path, $encryptedKeyfiles);
}
-
}
-
-
}
diff --git a/lib/Session.php b/lib/Session.php
index 33241a7a..08541699 100644
--- a/lib/Session.php
+++ b/lib/Session.php
@@ -59,7 +59,7 @@ public function setStatus($status) {
*/
public function getStatus() {
$status = $this->session->get('encryptionInitialized');
- if (is_null($status)) {
+ if ($status === null) {
if (\OC::$server->getAppConfig()->getValue('encryption', 'useMasterKey', '0') !== '0'
or \OC::$server->getAppConfig()->getValue('encryption', 'userSpecificKey', '') !== '') {
$status = self::NOT_INITIALIZED;
@@ -77,7 +77,7 @@ public function getStatus() {
*/
public function getPrivateKey() {
$key = $this->session->get('privateKey');
- if (is_null($key)) {
+ if ($key === null) {
throw new Exceptions\PrivateKeyMissingException('please try to log-out and log-in again', 0);
}
return $key;
@@ -90,7 +90,7 @@ public function getPrivateKey() {
*/
public function isPrivateKeySet() {
$key = $this->session->get('privateKey');
- if (is_null($key)) {
+ if ($key === null) {
return false;
}
@@ -138,9 +138,9 @@ public function decryptAllModeActivated() {
*/
public function getDecryptAllUid() {
$uid = $this->session->get('decryptAllUid');
- if (is_null($uid) && $this->decryptAllModeActivated()) {
+ if (($uid === null) && $this->decryptAllModeActivated()) {
throw new \Exception('No uid found while in decrypt all mode');
- } elseif (is_null($uid)) {
+ } elseif ($uid === null) {
throw new \Exception('Please activate decrypt all mode first');
}
@@ -155,9 +155,9 @@ public function getDecryptAllUid() {
*/
public function getDecryptAllKey() {
$privateKey = $this->session->get('decryptAllKey');
- if (is_null($privateKey) && $this->decryptAllModeActivated()) {
+ if (($privateKey === null) && $this->decryptAllModeActivated()) {
throw new PrivateKeyMissingException('No private key found while in decrypt all mode');
- } elseif (is_null($privateKey)) {
+ } elseif ($privateKey === null) {
throw new PrivateKeyMissingException('Please activate decrypt all mode first');
}
@@ -175,5 +175,4 @@ public function clear() {
$this->session->remove('decryptAllKey');
$this->session->remove('decryptAllUid');
}
-
}
diff --git a/lib/Users/Setup.php b/lib/Users/Setup.php
index 4c365e41..c831b263 100644
--- a/lib/Users/Setup.php
+++ b/lib/Users/Setup.php
@@ -24,7 +24,6 @@
namespace OCA\Encryption\Users;
-
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\KeyManager;
use OCP\ILogger;
@@ -48,7 +47,6 @@ class Setup {
*/
private $user;
-
/**
* @param ILogger $logger
* @param IUserSession $userSession
@@ -63,7 +61,7 @@ public function __construct(ILogger $logger,
$this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->crypt = $crypt;
$this->keyManager = $keyManager;
- }
+ }
/**
* @param string $uid user id
diff --git a/lib/Util.php b/lib/Util.php
index e0853dc2..98b37966 100644
--- a/lib/Util.php
+++ b/lib/Util.php
@@ -21,10 +21,8 @@
*
*/
-
namespace OCA\Encryption;
-
use OC\Files\View;
use OCA\Encryption\Crypto\Crypt;
use OCP\IConfig;
@@ -174,14 +172,13 @@ public function userHasFiles($uid) {
*/
public function getOwner($path) {
$owner = '';
- $parts = explode('/', $path, 3);
- if (count($parts) > 1) {
+ $parts = \explode('/', $path, 3);
+ if (\count($parts) > 1) {
$owner = $parts[1];
if ($this->userManager->userExists($owner) === false) {
throw new \BadMethodCallException('Unknown user: ' .
'method expects path to a user folder relative to the data folder');
}
-
}
return $owner;
@@ -197,5 +194,4 @@ public function getStorage($path) {
$storage = $this->files->getMount($path)->getStorage();
return $storage;
}
-
}
diff --git a/templates/settings-admin.php b/templates/settings-admin.php
index 56cd4113..4c9a660c 100644
--- a/templates/settings-admin.php
+++ b/templates/settings-admin.php
@@ -38,7 +38,9 @@
/>
+ value="1" />
t("Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted")); ?>