Skip to content

Commit 8a0dc9f

Browse files
committed
Merge remote-tracking branch 'phpbb-security/master'
2 parents 3842644 + b6e0404 commit 8a0dc9f

327 files changed

Lines changed: 10910 additions & 13235 deletions

File tree

Some content is hidden

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

.github/check-js.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ npm ci > /dev/null
1616
set -x
1717
node_modules/eslint/bin/eslint.js "phpBB/**/*.js" --ignore-pattern "phpBB/ext/"
1818
node_modules/eslint/bin/eslint.js "phpBB/**/*.js.twig" --ignore-pattern "phpBB/ext/"
19-
node_modules/eslint/bin/eslint.js "gulpfile.js"

.github/phpunit-psql-windows-github.xml

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,47 @@
77
bootstrap="../tests/bootstrap.php"
88
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
99
cacheDirectory=".phpunit.cache"
10-
backupStaticProperties="false">
11-
<testsuites>
12-
<testsuite name="phpBB Test Suite">
13-
<directory suffix="_test.php">../tests</directory>
14-
<exclude>../tests/functional</exclude>
15-
<exclude>../tests/lint_test.php</exclude>
16-
</testsuite>
17-
<testsuite name="phpBB Functional Tests">
18-
<directory suffix="_test.php">../tests/functional</directory>
19-
</testsuite>
20-
</testsuites>
21-
<groups>
22-
<exclude>
23-
<group>slow</group>
24-
</exclude>
25-
</groups>
26-
<source restrictDeprecations="true">
27-
<include>
28-
<directory suffix=".php">../phpBB/</directory>
29-
<directory suffix=".php">../tests/</directory>
30-
</include>
31-
<exclude>
32-
<directory suffix=".php">../phpBB/vendor/</directory>
33-
<directory suffix=".php">../phpBB/cache/</directory>
34-
<directory suffix=".php">../phpBB/develop/</directory>
35-
<directory suffix=".php">../phpBB/store/</directory>
36-
</exclude>
37-
</source>
38-
<php>
39-
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
40-
<server name="PHPBB_TEST_DBHOST" value="localhost"/>
41-
<server name="PHPBB_TEST_DBPORT" value="5432"/>
42-
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
43-
<server name="PHPBB_TEST_DBUSER" value="postgres"/>
44-
<server name="PHPBB_TEST_DBPASSWD" value="root"/>
45-
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
46-
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
47-
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
48-
<server name="PHPBB_FUNCTIONAL_URL" value="http://phpbb.test/"/>
49-
</php>
10+
backupStaticProperties="false"
11+
timeoutForSmallTests="60"
12+
timeoutForMediumTests="300"
13+
timeoutForLargeTests="600">
14+
<testsuites>
15+
<testsuite name="phpBB Test Suite">
16+
<directory suffix="_test.php">../tests</directory>
17+
<exclude>../tests/functional</exclude>
18+
<exclude>../tests/lint_test.php</exclude>
19+
</testsuite>
20+
<testsuite name="phpBB Functional Tests">
21+
<directory suffix="_test.php">../tests/functional</directory>
22+
</testsuite>
23+
</testsuites>
24+
<groups>
25+
<exclude>
26+
<group>slow</group>
27+
</exclude>
28+
</groups>
29+
<source restrictDeprecations="true">
30+
<include>
31+
<directory suffix=".php">../phpBB/</directory>
32+
<directory suffix=".php">../tests/</directory>
33+
</include>
34+
<exclude>
35+
<directory suffix=".php">../phpBB/vendor/</directory>
36+
<directory suffix=".php">../phpBB/cache/</directory>
37+
<directory suffix=".php">../phpBB/develop/</directory>
38+
<directory suffix=".php">../phpBB/store/</directory>
39+
</exclude>
40+
</source>
41+
<php>
42+
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
43+
<server name="PHPBB_TEST_DBHOST" value="localhost"/>
44+
<server name="PHPBB_TEST_DBPORT" value="5432"/>
45+
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
46+
<server name="PHPBB_TEST_DBUSER" value="postgres"/>
47+
<server name="PHPBB_TEST_DBPASSWD" value="root"/>
48+
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
49+
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
50+
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
51+
<server name="PHPBB_FUNCTIONAL_URL" value="http://phpbb.test/"/>
52+
</php>
5053
</phpunit>

.github/workflows/tests.yml

Lines changed: 84 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
matrix:
2323
include:
2424
- db: 'none'
25-
php: '8.1'
25+
php: '8.2'
2626
NOTESTS: 1
2727

2828
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
@@ -105,50 +105,42 @@ jobs:
105105
strategy:
106106
matrix:
107107
include:
108-
- php: '8.1'
108+
- php: '8.2'
109109
db: "mariadb:10.2"
110-
- php: '8.1'
110+
- php: '8.2'
111111
db: "mariadb:10.3"
112-
- php: '8.1'
112+
- php: '8.2'
113113
db: "mariadb:10.4"
114-
- php: '8.1'
114+
- php: '8.2'
115115
db: "mariadb:10.6"
116-
- php: '8.1'
116+
- php: '8.2'
117117
db: "mariadb:10.9"
118-
- php: '8.1'
118+
- php: '8.2'
119119
db: "mariadb:10.10"
120-
- php: '8.1'
120+
- php: '8.2'
121121
db: "mariadb:10.11"
122-
- php: '8.1'
123-
db: "mysql:5.7"
122+
- php: '8.2'
123+
db: "mysql:8.0"
124124
db_alias: "MySQL Slow Tests"
125125
SLOWTESTS: 1
126-
- php: '8.1'
127-
db: "mysql:5.7"
126+
- php: '8.2'
127+
db: "mysql:8.0"
128128
db_alias: "MyISAM Tests"
129129
MYISAM: 1
130-
- php: '8.1'
131-
db: "mysql:5.7"
132-
- php: '8.1'
133-
db: "mysql:8.0"
134-
- php: '8.1'
135-
db: "mysql:8.1"
136130
- php: '8.2'
137131
db: "mysql:8.0"
138132
- php: '8.2'
139-
db: "mariadb:10.2"
140-
- php: '8.3'
141-
db: "mysql:5.7"
133+
db: "mysql:8.4"
134+
- php: '8.2'
135+
db: "mysql:9.4"
142136
- php: '8.3'
143-
db: "mariadb:10.2"
144-
- php: '8.4'
145137
db: "mysql:8.0"
146138
- php: '8.4'
147-
db: "mariadb:10.3"
139+
db: "mysql:8.4"
148140
- php: '8.5'
149-
db: "mysql:8.0"
141+
db: "mysql:8.4"
150142
- php: '8.5'
151-
db: "mariadb:10.3"
143+
db: "mysql:9.4"
152144

153145
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
154146

@@ -234,7 +226,7 @@ jobs:
234226
.github/setup-ldap.sh
235227
236228
- name: Setup node
237-
uses: actions/setup-node@v4
229+
uses: actions/setup-node@v6
238230
with:
239231
node-version: 20
240232
- name: Setup node dependencies
@@ -268,24 +260,22 @@ jobs:
268260
strategy:
269261
matrix:
270262
include:
271-
- php: '8.1'
263+
- php: '8.2'
272264
db: "postgres:9.5"
273-
- php: '8.1'
265+
- php: '8.2'
274266
db: "postgres:9.6"
275-
- php: '8.1'
267+
- php: '8.2'
276268
db: "postgres:10"
277-
- php: '8.1'
269+
- php: '8.2'
278270
db: "postgres:11"
279-
- php: '8.1'
271+
- php: '8.2'
280272
db: "postgres:12"
281-
- php: '8.1'
273+
- php: '8.2'
282274
db: "postgres:13"
283-
- php: '8.1'
275+
- php: '8.2'
284276
db: "postgres:14"
285-
- php: '8.1'
286-
db: "postgres:15"
287277
- php: '8.2'
288-
db: "postgres:9.5"
278+
db: "postgres:15"
289279
- php: '8.3'
290280
db: "postgres:9.5"
291281
- php: '8.4'
@@ -374,7 +364,7 @@ jobs:
374364
.github/setup-database.sh $DB $MYISAM
375365
376366
- name: Setup node
377-
uses: actions/setup-node@v4
367+
uses: actions/setup-node@v6
378368
with:
379369
node-version: 20
380370
- name: Setup node dependencies
@@ -392,12 +382,12 @@ jobs:
392382
strategy:
393383
matrix:
394384
include:
395-
- php: '8.1'
385+
- php: '8.2'
396386
db: "sqlite3"
397-
- php: '8.1'
387+
- php: '8.2'
398388
db: "mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04"
399389
db_alias: 'MSSQL 2019'
400-
- php: '8.1'
390+
- php: '8.2'
401391
db: "mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04"
402392
db_alias: 'MSSQL 2022'
403393

@@ -487,7 +477,7 @@ jobs:
487477
.github/setup-database.sh $DB $MYISAM
488478
489479
- name: Setup node
490-
uses: actions/setup-node@v4
480+
uses: actions/setup-node@v6
491481
with:
492482
node-version: 20
493483
- name: Setup node dependencies
@@ -504,11 +494,10 @@ jobs:
504494
runs-on: windows-2025
505495
strategy:
506496
matrix:
507-
type: ['unit', 'functional']
508-
php: ['8.4']
497+
php: ['8.2', '8.3', '8.4', '8.5']
509498
db: ['postgres']
510499

511-
name: Windows - ${{ matrix.type }} - PHP ${{ matrix.php }} - ${{ matrix.db }}
500+
name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }}
512501

513502
steps:
514503
- name: Prepare git for Windows
@@ -544,6 +533,9 @@ jobs:
544533
GITHUB_WORKSPACE: ${{ github.workspace }}
545534
TEMP_DIR: ${{ runner.temp }}
546535
run: |
536+
# Disable Windows Defender real-time monitoring early to improve performance
537+
Set-MpPreference -DisableRealtimeMonitoring $true
538+
547539
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
548540
Set-Service wuauserv -StartupType Manual
549541
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("<configuration>", "<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
@@ -564,16 +556,38 @@ jobs:
564556
New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
565557
iisreset
566558
NET START W3SVC
567-
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\test"
568-
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\installer"
569-
icacls "${env:GITHUB_WORKSPACE}\phpBB\cache" /grant Users:F /T
570-
icacls "${env:GITHUB_WORKSPACE}\phpBB\files" /grant Users:F /T
571-
icacls "${env:GITHUB_WORKSPACE}\phpBB\store" /grant Users:F /T
572-
icacls "${env:GITHUB_WORKSPACE}\phpBB\ext" /grant Users:F /T
573-
icacls "${env:GITHUB_WORKSPACE}\phpBB\vendor-ext" /grant Users:F /T
574-
icacls "${env:GITHUB_WORKSPACE}\phpBB\composer-ext.json" /grant Users:F /T
575-
icacls "${env:GITHUB_WORKSPACE}\phpBB\composer-ext.lock" /grant Users:F /T
576-
icacls "${env:GITHUB_WORKSPACE}\phpBB\images\avatars\upload" /grant Users:F /T
559+
560+
# Wait for IIS to be ready and test connectivity
561+
Start-Sleep -Seconds 10
562+
try {
563+
$response = Invoke-WebRequest -Uri "http://phpbb.test/" -UseBasicParsing -TimeoutSec 30
564+
Write-Host "Web server is responding: $($response.StatusCode)"
565+
} catch {
566+
Write-Host "Web server test failed: $_"
567+
}
568+
569+
# Create directories and set permissions more efficiently
570+
$dirs = @("cache\test", "cache\installer")
571+
foreach ($dir in $dirs) {
572+
New-Item -Path "${env:GITHUB_WORKSPACE}\phpBB\$dir" -ItemType Directory -Force
573+
}
574+
575+
# Set permissions in batch for better performance
576+
$paths = @("cache", "files", "store", "ext", "vendor-ext", "images\avatars\upload")
577+
foreach ($path in $paths) {
578+
if (Test-Path "${env:GITHUB_WORKSPACE}\phpBB\$path") {
579+
icacls "${env:GITHUB_WORKSPACE}\phpBB\$path" /grant Users:F /T /Q
580+
}
581+
}
582+
583+
# Set permissions for specific files
584+
$files = @("composer-ext.json", "composer-ext.lock")
585+
foreach ($file in $files) {
586+
if (Test-Path "${env:GITHUB_WORKSPACE}\phpBB\$file") {
587+
icacls "${env:GITHUB_WORKSPACE}\phpBB\$file" /grant Users:F /Q
588+
}
589+
}
590+
577591
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
578592
$acl = Get-ACL "${env:TEMP_DIR}"
579593
$acl.AddAccessRule($accessRule)
@@ -586,7 +600,7 @@ jobs:
586600
$postgreSqlSvc = Get-Service "postgresql*"
587601
Set-Service $postgreSqlSvc.Name -StartupType manual
588602
$runningStatus = [System.ServiceProcess.ServiceControllerStatus]::Running
589-
$maxStartTimeout = New-TimeSpan -Seconds 30
603+
$maxStartTimeout = New-TimeSpan -Seconds 120
590604
try {
591605
$postgreSqlSvc.Start()
592606
$postgreSqlSvc.WaitForStatus($runningStatus, $maxStartTimeout)
@@ -595,25 +609,28 @@ jobs:
595609
}
596610
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}")
597611
$env:PGPASSWORD = 'root'
598-
psql -c 'ALTER SYSTEM SET hot_standby = on;' -U postgres
599-
psql -c 'ALTER SYSTEM SET wal_level = minimal;' -U postgres
612+
613+
# Optimize PostgreSQL for testing performance
614+
psql -c "ALTER SYSTEM SET fsync = off;" -U postgres
615+
psql -c "ALTER SYSTEM SET synchronous_commit = off;" -U postgres
616+
psql -c "ALTER SYSTEM SET checkpoint_completion_target = 0.9;" -U postgres
617+
psql -c "ALTER SYSTEM SET wal_buffers = '16MB';" -U postgres
618+
psql -c "ALTER SYSTEM SET shared_buffers = '128MB';" -U postgres
600619
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
601620
psql -c 'create database phpbb_tests;' -U postgres
621+
602622
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
603-
Set-MpPreference -DisableRealtimeMonitoring $true
604623
605624
- name: Setup node
606-
uses: actions/setup-node@v4
625+
uses: actions/setup-node@v6
607626
with:
608627
node-version: 20
609628
- name: Setup node dependencies
610629
run: npm ci
611630

612631
- name: Run unit tests
613-
if: ${{ matrix.type == 'unit' }}
614-
run: |
615-
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow
616-
- name: Run functional tests
617-
if: ${{ matrix.type == 'functional' }}
618-
run: |
619-
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --group functional
632+
uses: nick-fields/retry@v3
633+
with:
634+
timeout_minutes: 15
635+
max_attempts: 3
636+
command: phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
/tests/tmp/*
4949
/tests/vendor
5050
/vagrant/phpbb-install-config.yml
51-
.vagrant
51+
/vagrant/.vagrant
52+
/vagrant/composer.lock
53+
/vagrant/vendor
5254
node_modules
5355
/build/package_signature
5456

@@ -57,3 +59,4 @@ node_modules
5759
.idea
5860
*.DS_Store*
5961
/.vscode
62+
/.phpunit.result.cache

0 commit comments

Comments
 (0)