Skip to content

Commit 22e343a

Browse files
authored
Merge pull request #143 from nextcloud/fix/142/dont-log-sensitive-args
prevent the Logger from writing sensitive values
2 parents e794bc7 + eb70b4a commit 22e343a

File tree

9 files changed

+2666
-1
lines changed

9 files changed

+2666
-1
lines changed

.github/workflows/integration.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Integration
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/integration.yml'
7+
- 'appinfo/**'
8+
- 'lib/**'
9+
- 'tests/**'
10+
11+
push:
12+
branches:
13+
- master
14+
- stable*
15+
16+
env:
17+
APP_NAME: sharepoint
18+
19+
jobs:
20+
sqlite:
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
# do not stop on another job's failure
25+
fail-fast: false
26+
matrix:
27+
php-versions: ['7.4', '8.0', '8.1']
28+
databases: ['sqlite']
29+
server-versions: ['master']
30+
31+
name: integration-php${{ matrix.php-versions }}-${{ matrix.databases }}
32+
33+
steps:
34+
- name: Checkout server
35+
uses: actions/checkout@v2
36+
with:
37+
repository: nextcloud/server
38+
ref: ${{ matrix.server-versions }}
39+
40+
- name: Checkout submodules
41+
shell: bash
42+
run: |
43+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
44+
git submodule sync --recursive
45+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
46+
- name: Checkout app
47+
uses: actions/checkout@v2
48+
with:
49+
path: apps/${{ env.APP_NAME }}
50+
51+
- name: Set up php ${{ matrix.php-versions }}
52+
uses: shivammathur/setup-php@v2
53+
with:
54+
php-version: ${{ matrix.php-versions }}
55+
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
56+
ini-values: zend.exception_ignore_args=Off
57+
coverage: none
58+
59+
- name: Install app dependencies
60+
working-directory: apps/${{ env.APP_NAME }}
61+
run: composer i
62+
63+
- name: Install test dependencies
64+
working-directory: apps/${{ env.APP_NAME }}/tests/Integration
65+
run: composer i
66+
67+
- name: Set up Nextcloud
68+
env:
69+
DB_PORT: 4444
70+
run: |
71+
mkdir data
72+
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
73+
php -f index.php
74+
./occ app:enable files_external
75+
./occ app:enable --force ${{ env.APP_NAME }}
76+
php -S localhost:8080 &
77+
- name: Integration
78+
working-directory: apps/${{ env.APP_NAME }}/tests/Integration
79+
run: bash run.sh

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
composer.phar
2-
/vendor/
2+
vendor/

lib/AppInfo/Application.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@
3030
use OCP\AppFramework\Bootstrap\IBootContext;
3131
use OCP\AppFramework\Bootstrap\IBootstrap;
3232
use OCP\AppFramework\Bootstrap\IRegistrationContext;
33+
use Office365\Runtime\Auth\AuthenticationContext;
34+
use Office365\Runtime\Auth\SamlTokenProvider;
3335

3436
class Application extends App implements IBootstrap {
3537
public function __construct() {
3638
parent::__construct('sharepoint');
3739
}
3840

3941
public function register(IRegistrationContext $context): void {
42+
$context->registerSensitiveMethods(SamlTokenProvider::class, ['acquireSecurityToken']);
43+
$context->registerSensitiveMethods(AuthenticationContext::class, ['acquireToken', 'acquireTokenForUser']);
4044
$context->registerEventListener('OCA\\Files_External::loadAdditionalBackends', ExternalStoragesRegistrationListener::class);
4145
}
4246

tests/Integration/composer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"config": {
3+
"platform": {
4+
"php": "7.4"
5+
}
6+
},
7+
"require-dev": {
8+
"behat/behat": "^3.11",
9+
"jarnaiz/behat-junit-formatter": "^1.3",
10+
"guzzlehttp/guzzle": "^7.4"
11+
}
12+
}

0 commit comments

Comments
 (0)