Compare commits

...
7 Commits
Author SHA1 Message Date
fromme 3f4586ce06 feat: harden the myep oauth2 client 2026-09-23 16:06:25 +02:00
frommeandClaude Opus 5 2a8649fc6d chore: run MariaDB 11.8 in ddev to match production
Development ran MySQL 8.4 while production runs MariaDB, so nothing engine-specific
was ever exercised on the engine it ships on.

DATABASE_URL carries serverVersion=mariadb-* now, which is what makes DBAL pick its
MariaDB platform. This matters most for the test environment: it reads DATABASE_URL
from the committed .env and not from .env.dev.local, so a MySQL version there had the
suite running on MySQL84Platform against a MariaDB server - and schema:validate
reporting every nullable and every json column as drift. With the platform right, a
db_test built from the mapping is in sync.

The post-start hooks create db_test and grant the db user, which ddev does not do on
its own, and sync the schema from the entity mapping. Without them the first test run
after a fresh start fails on the missing database.

The remaining changes in config.yaml are ddev's own regeneration of the commented
reference section.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-23 09:02:56 +02:00
fromme 161cfb9e62 chore: exclude secrets file from repository 2026-09-23 08:06:45 +02:00
fromme eac125517f fix: use a SortDirection instance for the availabilities ordering 2026-09-21 12:20:55 +02:00
fromme af46c57bd1 feat: normalize email addresses to lowercase on write 2026-09-21 12:20:55 +02:00
fromme d6327f033e fix: stagger cron triggered tasks between prod and staging 2026-09-20 13:32:48 +02:00
fromme 752db081b3 chore: update project dependencies 2026-09-20 13:32:23 +02:00
20 changed files with 537 additions and 110 deletions

No files matched your search

+50 -29
View File
@@ -1,3 +1,4 @@
name: myep-team
type: php
docroot: public
php_version: "8.4"
@@ -6,8 +7,20 @@ xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
type: mysql
version: "8.4"
type: mariadb
version: "11.8"
hooks:
# The agent hooks in config.codex-claude.yaml are merged with these, not replaced by them.
post-start:
# ddev creates "db" alone, so the test database has to be created and granted here.
# Without it the first test run after a fresh start fails with "Access denied for user
# 'db'@'%' to database 'db_test'".
- exec: mysql -uroot -proot -hdb -e "CREATE DATABASE IF NOT EXISTS db_test CHARACTER SET utf8mb4; GRANT ALL ON db_test.* TO 'db'@'%';"
# Schema from the entity mapping, never from the migrations: the squashed history is not
# replayable from an empty database (Version20260824124850 alters a table that
# Version20260901090029 only creates later). No fixtures - a test persists its own rows.
- exec: php bin/console doctrine:schema:update --force --env=test --no-interaction
omit_containers: [ddev-ssh-agent]
use_dns_when_possible: true
timezone: Europe/Berlin
composer_version: "2"
@@ -15,8 +28,6 @@ web_environment: []
nodejs_version: "18"
corepack_enable: false
disable_upload_dirs_warning: true
omit_containers: [ddev-ssh-agent]
xhgui_https_port: "8142"
xhgui_http_port: "8143"
@@ -27,16 +38,16 @@ xhgui_http_port: "8143"
# If the name is omitted, the project will take the name of the enclosing directory,
# which is useful if you want to have a copy of the project side by side with this one.
# type: <projecttype> # backdrop, cakephp, craftcms, drupal, drupal6, drupal7, drupal8, drupal9, drupal10, drupal11, generic, laravel, magento, magento2, php, shopware6, silverstripe, symfony, typo3, wordpress
# type: <projecttype> # asterios, backdrop, cakephp, codeigniter, craftcms, drupal, drupal6, drupal7, drupal8, drupal9, drupal10, drupal11, drupal12, generic, joomla, laravel, magento, magento2, maho, modx, php, shopware6, silverstripe, symfony, typo3, wordpress, wp-bedrock
# See https://docs.ddev.com/en/stable/users/quickstart/ for more
# information on the different project types
# docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "8.3" # PHP version to use, "5.6" through "8.5"
# php_version: "8.4" # PHP version to use, "5.6" through "8.5"
# You can explicitly specify the webimage but this
# is not recommended, as the images are often closely tied to DDEV's' behavior,
# is not recommended, as the images are often closely tied to DDEV's behavior,
# so this can break upgrades.
# webimage: <docker_image>
@@ -46,10 +57,18 @@ xhgui_http_port: "8143"
# database:
# type: <dbtype> # mysql, mariadb, postgres
# version: <version> # database version, like "10.11" or "8.0"
# MariaDB versions can be 5.5-10.8, 10.11, 11.4, 11.8
# MySQL versions can be 5.5-8.0, 8.4
# MariaDB versions can be 5.5-10.8, 10.11, 11.4, 11.8, 12.3
# MySQL versions can be 5.5-8.0, 8.4, 9.7
# PostgreSQL versions can be 9-18
# You can explicitly specify the dbimage but this
# is not recommended, as the images are often closely tied to DDEV's behavior,
# so this can break upgrades.
# dbimage: <docker_image>
# It’s unusual to change this option, and we don’t recommend it without Docker experience and a good reason.
# Typically, this means additions to the existing db image using a .ddev/db-build/Dockerfile.*
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
@@ -69,8 +88,7 @@ xhgui_http_port: "8143"
# bind_all_ports is used (normally with router disabled)
# xhprof_mode: [prepend|xhgui|global]
# Set to "xhgui" to enable XHGui features
# "xhgui" will become default in a future major release
# Default is "xhgui"
# webserver_type: nginx-fpm, apache-fpm, generic
@@ -88,22 +106,24 @@ xhgui_http_port: "8143"
# commands are executed.
# composer_version: "2"
# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1
# You can set it to "" or "2" (default) for Composer v2
# to use the latest major version available at the time your container is built.
# It is also possible to use each other Composer version channel. This includes:
# It is also possible to use any other Composer version channel. This includes:
# - 2.2 (latest Composer LTS version)
# - stable
# - preview
# - snapshot
# Alternatively, an explicit Composer version may be specified, for example "2.2.18".
# To reinstall Composer after the image was built, run "ddev debug rebuild".
# To reinstall Composer after the image was built, run "ddev utility rebuild".
# nodejs_version: "22"
# nodejs_root: <relative_path>
# Relative path to the directory containing the Node.js version file from the
# project root. Only used with "nodejs_version: auto" or "nodejs_version: engine".
# nodejs_version: "24"
# change from the default system Node.js version to any other version.
# See https://docs.ddev.com/en/stable/users/configuration/config/#nodejs_version for more information
# and https://www.npmjs.com/package/n#specifying-nodejs-versions for the full documentation,
# Note that using of 'ddev nvm' is discouraged because "nodejs_version" is much easier to use,
# can specify any version, and is more robust than using 'nvm'.
# and https://www.npmjs.com/package/n#specifying-nodejs-versions for the full documentation.
# corepack_enable: false
# Change to 'true' to 'corepack enable' and gain access to latest versions of yarn/pnpm
@@ -163,9 +183,7 @@ xhgui_http_port: "8143"
# - "global": uses the value from the global config.
# - "none": disables performance optimization for this project.
# - "mutagen": enables Mutagen for this project.
# - "nfs": enables NFS for this project.
#
# See https://docs.ddev.com/en/stable/users/install/performance/#nfs
# See https://docs.ddev.com/en/stable/users/install/performance/#mutagen
# fail_on_hook_fail: False
@@ -195,10 +213,10 @@ xhgui_http_port: "8143"
# The mailpit port is not normally bound on the host at all, instead being routed
# through ddev-router, but it can be bound directly to localhost if specified here.
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
# webimage_extra_packages: ['php${DDEV_PHP_VERSION}-tidy', 'php${DDEV_PHP_VERSION}-yac']
# Extra Debian packages that are needed in the webimage can be added here
# dbimage_extra_packages: [telnet,netcat]
# dbimage_extra_packages: [netcat, telnet, sudo]
# Extra Debian packages that are needed in the dbimage can be added here
# use_dns_when_possible: true
@@ -210,12 +228,15 @@ xhgui_http_port: "8143"
# project_tld: ddev.site
# The top-level domain used for project URLs
# The default "ddev.site" allows DNS lookup via a wildcard
# If you prefer you can change this to "ddev.local" to preserve
# pre-v1.9 behavior.
# ngrok_args: --basic-auth username:pass1234
# Provide extra flags to the "ngrok http" command, see
# https://ngrok.com/docs/agent/config/v3/#agent-configuration or run "ngrok http -h"
# share_default_provider: ngrok
# The default share provider to use for "ddev share"
# Defaults to global configuration, usually "ngrok"
# Can be "ngrok" or "cloudflared" or the name of a custom provider from .ddev/share-providers/
# share_provider_args: --basic-auth username:pass1234
# Provide extra flags to the share provider script
# See https://docs.ddev.com/en/stable/users/configuration/config/#share_provider_args
# disable_settings_management: false
# If true, DDEV will not create CMS-specific settings files like
@@ -277,7 +298,7 @@ xhgui_http_port: "8143"
# override_config: false
# By default, config.*.yaml files are *merged* into the configuration
# But this means that some things can't be overridden
# For example, if you have 'use_dns_when_possible: true'' you can't override it with a merge
# For example, if you have 'use_dns_when_possible: true' you can't override it with a merge
# and you can't erase existing hooks or all environment variables.
# However, with "override_config: true" in a particular config.*.yaml file,
# 'use_dns_when_possible: false' can override the existing values, and
@@ -287,7 +308,7 @@ xhgui_http_port: "8143"
# web_environment: []
# or
# additional_hostnames: []
# can have their intended affect. 'override_config' affects only behavior of the
# can have their intended effect. 'override_config' affects only behavior of the
# config.*.yaml file it exists in.
# Many DDEV commands can be extended to run tasks before or after the
+9 -1
View File
@@ -27,7 +27,10 @@ APP_SECRET=b3cb0285aea14bbffb57df0cc3aa84f4
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=15&charset=utf8"
DATABASE_URL="mysql://db:db@db:3306/db?serverVersion=8.4.5&charset=utf8mb4"
# ddev runs MariaDB to match production. The serverVersion is what makes DBAL pick its
# MariaDB platform - left at a MySQL version it speaks MySQL to a MariaDB server, and the
# test suite then runs against a different platform than production.
DATABASE_URL="mysql://db:db@db:3306/db?serverVersion=mariadb-11.8.9&charset=utf8mb4"
###< doctrine/doctrine-bundle ###
###> symfony/messenger ###
@@ -46,6 +49,11 @@ MAILING_MAILER_DSN=null://null
APP_BASE_URI=https://myep-team.ddev.site
# Regex matched against the Host header; requests for any other host are refused. The
# OAuth2 redirect_uri is generated from the request, so this is what pins it. Production
# sets its own value outside the repository, like APP_BASE_URI above.
APP_TRUSTED_HOSTS=^myep-team\.ddev\.site$
APP_BPN_USER=
APP_BPN_PASSWORD=
APP_BPN_IP=
+2
View File
@@ -4,3 +4,5 @@ APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
# the test client requests http://localhost/
APP_TRUSTED_HOSTS='^localhost$'
+2
View File
@@ -35,3 +35,5 @@ yarn-error.log
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
/http-client.private.env.json
Generated
+50 -48
View File
@@ -4137,16 +4137,16 @@
},
{
"name": "phpoffice/phpspreadsheet",
"version": "5.9.0",
"version": "5.10.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "05e99ebf61238a70227b4d9cc02d0030d34f6339"
"reference": "eb18727acf6b1f4cc67145a52ab04f9fd4c28d53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/05e99ebf61238a70227b4d9cc02d0030d34f6339",
"reference": "05e99ebf61238a70227b4d9cc02d0030d34f6339",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/eb18727acf6b1f4cc67145a52ab04f9fd4c28d53",
"reference": "eb18727acf6b1f4cc67145a52ab04f9fd4c28d53",
"shasum": ""
},
"require": {
@@ -4175,6 +4175,7 @@
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^2.0 || ^3.0",
"ext-intl": "*",
"ext-openssl": "*",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.5",
"mpdf/mpdf": "^8.1.1",
@@ -4184,11 +4185,12 @@
"phpstan/phpstan-phpunit": "^1.0 || ^2.0",
"phpunit/phpunit": "^10.5 || ^11.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
"tecnickcom/tcpdf": ">=6.8.0 <7.0.0"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions, required for NumberFormat Wizard and StringHelper::setLocale()",
"ext-openssl": "Handline Agile-encrypted Xlsx spreadsheets",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
@@ -4240,9 +4242,9 @@
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/5.9.0"
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/5.10.0"
},
"time": "2026-07-12T19:17:39+00:00"
"time": "2026-09-17T03:54:50+00:00"
},
{
"name": "phpseclib/phpseclib",
@@ -11392,16 +11394,16 @@
},
{
"name": "symfony/webpack-encore-bundle",
"version": "v2.4.1",
"version": "2.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/webpack-encore-bundle.git",
"reference": "cac8d6c722999c8add9272f9de6e8079628df4f5"
"reference": "0cbc3485f127cd9f85e395f8177607ef00535634"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/cac8d6c722999c8add9272f9de6e8079628df4f5",
"reference": "cac8d6c722999c8add9272f9de6e8079628df4f5",
"url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/0cbc3485f127cd9f85e395f8177607ef00535634",
"reference": "0cbc3485f127cd9f85e395f8177607ef00535634",
"shasum": ""
},
"require": {
@@ -11444,7 +11446,7 @@
"description": "Integration of your Symfony app with Webpack Encore",
"support": {
"issues": "https://github.com/symfony/webpack-encore-bundle/issues",
"source": "https://github.com/symfony/webpack-encore-bundle/tree/v2.4.1"
"source": "https://github.com/symfony/webpack-encore-bundle/tree/2.4.2"
},
"funding": [
{
@@ -11464,7 +11466,7 @@
"type": "tidelift"
}
],
"time": "2026-06-24T07:21:58+00:00"
"time": "2026-09-17T12:45:02+00:00"
},
{
"name": "symfony/workflow",
@@ -11638,16 +11640,16 @@
},
{
"name": "twig/extra-bundle",
"version": "v3.24.0",
"version": "v3.29.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/twig-extra-bundle.git",
"reference": "6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9"
"reference": "aaa2993e19293a99240c4c61aa461d743b0dd569"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9",
"reference": "6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9",
"url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/aaa2993e19293a99240c4c61aa461d743b0dd569",
"reference": "aaa2993e19293a99240c4c61aa461d743b0dd569",
"shasum": ""
},
"require": {
@@ -11696,7 +11698,7 @@
"twig"
],
"support": {
"source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.24.0"
"source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.29.0"
},
"funding": [
{
@@ -11708,20 +11710,20 @@
"type": "tidelift"
}
],
"time": "2026-02-07T08:07:38+00:00"
"time": "2026-09-11T08:59:50+00:00"
},
{
"name": "twig/html-extra",
"version": "v3.28.0",
"version": "v3.29.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/html-extra.git",
"reference": "760893ed7bdd0a381e4e00004c6f6e26ad3881d7"
"reference": "7147611979df81edb78baf7d003860b72e335c3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/760893ed7bdd0a381e4e00004c6f6e26ad3881d7",
"reference": "760893ed7bdd0a381e4e00004c6f6e26ad3881d7",
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/7147611979df81edb78baf7d003860b72e335c3f",
"reference": "7147611979df81edb78baf7d003860b72e335c3f",
"shasum": ""
},
"require": {
@@ -11764,7 +11766,7 @@
"twig"
],
"support": {
"source": "https://github.com/twigphp/html-extra/tree/v3.28.0"
"source": "https://github.com/twigphp/html-extra/tree/v3.29.0"
},
"funding": [
{
@@ -11776,20 +11778,20 @@
"type": "tidelift"
}
],
"time": "2026-06-25T06:50:01+00:00"
"time": "2026-09-06T20:35:36+00:00"
},
{
"name": "twig/intl-extra",
"version": "v3.26.0",
"version": "v3.29.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/intl-extra.git",
"reference": "98f5ad5bff13230fcd2d834d9e79b50adf3ccda9"
"reference": "51c52470aca59f3a9715c88f6fe505133b88c752"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/intl-extra/zipball/98f5ad5bff13230fcd2d834d9e79b50adf3ccda9",
"reference": "98f5ad5bff13230fcd2d834d9e79b50adf3ccda9",
"url": "https://api.github.com/repos/twigphp/intl-extra/zipball/51c52470aca59f3a9715c88f6fe505133b88c752",
"reference": "51c52470aca59f3a9715c88f6fe505133b88c752",
"shasum": ""
},
"require": {
@@ -11828,7 +11830,7 @@
"twig"
],
"support": {
"source": "https://github.com/twigphp/intl-extra/tree/v3.26.0"
"source": "https://github.com/twigphp/intl-extra/tree/v3.29.0"
},
"funding": [
{
@@ -11840,7 +11842,7 @@
"type": "tidelift"
}
],
"time": "2026-05-19T20:44:48+00:00"
"time": "2026-09-06T20:35:36+00:00"
},
{
"name": "twig/string-extra",
@@ -11911,16 +11913,16 @@
},
{
"name": "twig/twig",
"version": "v3.28.0",
"version": "v3.29.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "597c12ed286fb9d1701a36684ce6e0cbe28ebc8b"
"reference": "45a3c6e9224c3377a39c7b150bb29d5d97d2c75d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/597c12ed286fb9d1701a36684ce6e0cbe28ebc8b",
"reference": "597c12ed286fb9d1701a36684ce6e0cbe28ebc8b",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/45a3c6e9224c3377a39c7b150bb29d5d97d2c75d",
"reference": "45a3c6e9224c3377a39c7b150bb29d5d97d2c75d",
"shasum": ""
},
"require": {
@@ -11975,7 +11977,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.28.0"
"source": "https://github.com/twigphp/Twig/tree/v3.29.0"
},
"funding": [
{
@@ -11987,7 +11989,7 @@
"type": "tidelift"
}
],
"time": "2026-07-03T20:44:34+00:00"
"time": "2026-09-18T09:10:14+00:00"
},
{
"name": "ua-parser/uap-php",
@@ -12706,16 +12708,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.95.25",
"version": "v3.95.26",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "2cdfc1f3daf173d83a1ebb6177949b58c95de6ff"
"reference": "11839dfaf25718e1617c522c3dde01ebf96c875f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2cdfc1f3daf173d83a1ebb6177949b58c95de6ff",
"reference": "2cdfc1f3daf173d83a1ebb6177949b58c95de6ff",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/11839dfaf25718e1617c522c3dde01ebf96c875f",
"reference": "11839dfaf25718e1617c522c3dde01ebf96c875f",
"shasum": ""
},
"require": {
@@ -12749,15 +12751,15 @@
"require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.11.0",
"infection/infection": "^0.32.7",
"justinrainbow/json-schema": "^6.10.0",
"justinrainbow/json-schema": "^6.12.0",
"keradus/cli-executor": "^2.3",
"php-coveralls/php-coveralls": "^2.9.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.8",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.8",
"phpunit/phpunit": "^9.6.35 || ^10.5.64 || ^11.5.56 || ^12.5.31 || ^13.0.6",
"symfony/polyfill-php85": "^1.38",
"symfony/var-dumper": "^5.4.48 || ^6.4.36 || ^7.4.8 || ^8.1.1",
"symfony/yaml": "^5.4.53 || ^6.4.41 || ^7.4.13 || ^8.1.1"
"phpunit/phpunit": "^9.6.36 || ^10.5.64 || ^11.5.56 || ^12.5.35 || ^13.3.3",
"symfony/polyfill-php85": "^1.41",
"symfony/var-dumper": "^5.4.48 || ^6.4.45 || ^7.4.18 || ^8.1.7",
"symfony/yaml": "^5.4.53 || ^6.4.45 || ^7.4.18 || ^8.1.6"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
@@ -12798,7 +12800,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.95.25"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.95.26"
},
"funding": [
{
@@ -12806,7 +12808,7 @@
"type": "github"
}
],
"time": "2026-09-08T11:11:37+00:00"
"time": "2026-09-19T19:04:32+00:00"
},
{
"name": "marcocesarato/php-conventional-changelog",
+5
View File
@@ -5,6 +5,11 @@ framework:
http_method_override: false
handle_all_throwables: true
# The OAuth2 redirect_uri handed to MyE&P is generated from the incoming request, so an
# unvalidated Host header would let a crafted request point the authorization code
# somewhere else. Regex patterns, matched against the host without the scheme or port.
trusted_hosts: ['%env(APP_TRUSTED_HOSTS)%']
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
+44 -16
View File
@@ -12,23 +12,51 @@ zenstruck_schedule:
enabled: true
to: [email protected]
tasks:
- task: app:bpn-import
frequency: '0 3 * * *'
description: "Imports dates, products and hotels from BusProNet"
when@prod:
zenstruck_schedule:
tasks:
- task: app:bpn-import
frequency: '0 3 * * *'
description: "Imports dates, products and hotels from BusProNet"
- task: app:cron
frequency: '0 1 * * *'
description: "Executes several tasks triggered on a daily basis"
- task: app:cron
frequency: '0 1 * * *'
description: "Executes several tasks triggered on a daily basis"
- task: app:teamer-status
frequency: '30 1 * * *'
description: "Updates status of teamers depending on their disposition"
- task: app:teamer-status
frequency: '30 1 * * *'
description: "Updates status of teamers depending on their disposition"
- task: oneup:uploader:clear-orphans
frequency: '30 * * * *'
description: "Removes orphaned uploads"
- task: oneup:uploader:clear-orphans
frequency: '30 * * * *'
description: "Removes orphaned uploads"
- task: app:cleanup:xml-dumps
frequency: "0 2 * * *"
description: "Removes outdated XML dumps of requests/responses to BPN API for debugging"
- task: app:cleanup:xml-dumps
frequency: '0 2 * * *'
description: "Removes outdated XML dumps of requests/responses to BPN API for debugging"
when@staging:
zenstruck_schedule:
mailer:
subject_prefix: "[E&P-Team STAGING]"
tasks:
- task: app:bpn-import
frequency: '30 3 * * *'
description: "Imports dates, products and hotels from BusProNet"
- task: app:cron
frequency: '30 2 * * *'
description: "Executes several tasks triggered on a daily basis"
- task: app:teamer-status
frequency: '30 1 * * *'
description: "Updates status of teamers depending on their disposition"
- task: oneup:uploader:clear-orphans
frequency: '30 * * * *'
description: "Removes orphaned uploads"
- task: app:cleanup:xml-dumps
frequency: '0 2 * * *'
description: "Removes outdated XML dumps of requests/responses to BPN API for debugging"
+3 -1
View File
@@ -39,7 +39,9 @@ class Communication
public function setEmail(?string $email): static
{
$this->email = $email;
// BusPro compares addresses case-insensitively; normalize on the way in so the DTO
// carries the same shape the entities store.
$this->email = null === $email ? null : mb_strtolower(trim($email));
return $this;
}
+3 -4
View File
@@ -22,10 +22,9 @@ class OAuth2Controller extends AbstractController
{
$this->denyUnlessFeatureIsActive();
$provider = $this->client->getProvider();
$url = $provider->getAuthorizationUrl();
$state = $provider->getState();
$request->getSession()->set('oauth2state', $state);
// the state and the PKCE verifier belong to the client, which is what consumes
// them again on the callback
$url = $this->client->createAuthorizationUrl($request);
return $this->redirect($url);
}
+1 -1
View File
@@ -75,7 +75,7 @@ class Contact
public function setEmail(string $email): static
{
$this->email = $email;
$this->email = mb_strtolower(trim($email));
return $this;
}
+1 -1
View File
@@ -108,7 +108,7 @@ class Communication
public function setEmail(?string $email): static
{
$this->email = $email;
$this->email = null === $email ? null : mb_strtolower(trim($email));
return $this;
}
+1 -1
View File
@@ -95,7 +95,7 @@ class Teamer implements TimestampableEntityInterface, SoftDeletableEntityInterfa
private ?string $remarksInternal = null;
#[ORM\ManyToMany(targetEntity: Availability::class, inversedBy: 'teamers')]
#[ORM\OrderBy(['dateFrom' => 'ASC'])]
#[ORM\OrderBy(['dateFrom' => \SortDirection::Ascending])]
private Collection $availabilities;
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: Availability::class)]
+1 -1
View File
@@ -43,7 +43,7 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
public function authenticate(Request $request): Passport
{
$email = trim($request->request->getString('_username'));
$email = mb_strtolower(trim($request->request->getString('_username')));
$passwordPlain = trim($request->request->getString('_password'));
// Very lame hashing applied here as required by BPN
+15 -1
View File
@@ -6,6 +6,7 @@ use App\BusProNet\UserDataHandler;
use App\Entity\Teamer;
use App\Entity\User;
use App\RequiredTeamerCheck\RequiredTeamerCheckRegistry;
use App\Security\OAuth2\AuthorizationDeniedException;
use App\Security\OAuth2\AuthorizationRequestException;
use App\Security\OAuth2\MyEpClient;
use Doctrine\ORM\EntityManagerInterface;
@@ -34,6 +35,12 @@ class MyEpAuthenticator extends AbstractAuthenticator
* The roles that entitle someone to log in here at all. Anything else MyE&P reports
* is dropped rather than stored, so that no role this application assigns a meaning
* to can be set from the outside.
*
* This list exists a second time on MyE&P, as the required_roles of this application's
* oauth2_client row: MyE&P refuses the authorization request outright when the account
* holds none of them, and explains why on its own page. The two are one policy written
* twice and must be changed together — widening only one either strands a user at MyE&P
* with no explanation this side can give, or lets one through to be refused here.
*/
private const ELIGIBLE_ROLES = ['ROLE_TEAM_ADMIN', 'ROLE_TEAMER', 'ROLE_MANAGER', 'ROLE_HOUSE_MANAGER'];
@@ -63,11 +70,18 @@ class MyEpAuthenticator extends AbstractAuthenticator
{
try {
$accessToken = $this->client->fetchAccessToken($request);
} catch (AuthorizationDeniedException $e) {
// MyE&P said why it sent no code, so this is not a failure to report as one
$this->logger->info('Login via MyE&P was denied', [
'error' => $e->getError(),
'error_description' => $e->getErrorDescription(),
]);
throw new CustomUserMessageAuthenticationException('Login via MyE&P wurde abgebrochen');
} catch (AuthorizationRequestException|IdentityProviderException $e) {
$this->logger->error('Login via MyE&P failed due to unobtainable access token', [
'exception' => $e,
]);
throw new CustomUserMessageAuthenticationException('Invalid token');
throw new CustomUserMessageAuthenticationException('Login via MyE&P nicht möglich');
}
try {
@@ -0,0 +1,34 @@
<?php
namespace App\Security\OAuth2;
use Symfony\Component\HttpFoundation\Request;
/**
* MyE&P redirected back with an `error` instead of a code — the person cancelled, or the
* authorization was refused.
*
* A subclass of AuthorizationRequestException so that a caller which does not care why the
* callback carried no code still catches it, and one that does can tell this apart from a
* malformed or replayed callback and say so.
*/
class AuthorizationDeniedException extends AuthorizationRequestException
{
public function __construct(
private readonly string $error,
private readonly ?string $errorDescription,
Request $request,
) {
parent::__construct(sprintf('Authorization denied: %s', $error), 400, $request);
}
public function getError(): string
{
return $this->error;
}
public function getErrorDescription(): ?string
{
return $this->errorDescription;
}
}
+73 -6
View File
@@ -13,41 +13,104 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class MyEpClient
{
private const SESSION_KEY_STATE = 'oauth2state';
private const SESSION_KEY_PKCE = 'oauth2pkce';
private array $config;
public function __construct(
private readonly UrlGeneratorInterface $urlGenerator,
private readonly LoggerInterface $logger,
// the client secret rides in here, marked sensitive so it is redacted from stack
// traces rather than printed in full on an exception page or in a log
#[\SensitiveParameter]
array $options,
) {
$this->config = $this->resolveConfig($options);
}
/**
* Starts the authorization code flow and stores what the callback has to prove.
*
* The state and the PKCE verifier are generated by getAuthorizationUrl() and are only
* readable afterwards, so both are taken from the provider rather than built here.
*/
public function createAuthorizationUrl(Request $request): string
{
$provider = $this->getProvider();
$url = $provider->getAuthorizationUrl();
$session = $request->getSession();
$session->set(self::SESSION_KEY_STATE, $provider->getState());
$session->set(self::SESSION_KEY_PKCE, $provider->getPkceCode());
return $url;
}
/**
* @throws IdentityProviderException
* @throws AuthorizationDeniedException
* @throws AuthorizationRequestException
*/
public function fetchAccessToken(Request $request): AccessTokenInterface
{
$session = $request->getSession();
// Both are single-use, so they are consumed before anything can fail: a callback
// that throws must not leave a state behind that a second attempt could replay.
$expectedState = $session->remove(self::SESSION_KEY_STATE);
$pkceCode = $session->remove(self::SESSION_KEY_PKCE);
// Before anything else: MyE&P has said why it is not sending a code, and every
// later check would report the wrong cause. The role gate renders on MyE&P rather
// than redirecting, but a cancelled or refused authorization arrives here.
$error = $request->query->get('error');
if (true === is_string($error) && '' !== $error) {
$description = $request->query->get('error_description');
$description = is_string($description) && '' !== $description ? $description : null;
$this->logger->error('OAuth2 login request denied', [
'error' => $error,
'error_description' => $description,
]);
throw new AuthorizationDeniedException($error, $description, $request);
}
if (null === $code = $request->query->get('code')) {
$this->logger->error('OAuth2 login request missing code');
throw new AuthorizationRequestException('Missing code', 400, $request);
}
$session = $request->getSession();
$state = $request->query->get('state');
// hash_equals() rather than !==, the state being the CSRF secret of the flow. The
// string checks come first: a callback with no state, or a session that never held
// one, must fail here rather than reach a comparison with null.
if (
null === $request->query->get('state')
|| $request->query->get('state') !== $session->get('oauth2state')
false === is_string($state)
|| false === is_string($expectedState)
|| false === hash_equals($expectedState, $state)
) {
$session->remove('oauth2state');
$this->logger->error('OAuth2 login request missing state or mismatch');
throw new AuthorizationRequestException('Missing state or mismatch', 400, $request);
}
$session->remove('oauth2state');
// A challenge went out with the authorization request, so MyE&P rejects an exchange
// without the verifier. Refused here instead, where the reason is still known — the
// usual cause is a session replaced between the two legs of the flow.
if (false === is_string($pkceCode) || '' === $pkceCode) {
$this->logger->error('OAuth2 login request without the PKCE verifier of its session');
throw new AuthorizationRequestException('Missing PKCE verifier', 400, $request);
}
return $this->getProvider()->getAccessToken('authorization_code', [
$provider = $this->getProvider();
// replays the verifier whose challenge was sent with the authorization request
$provider->setPkceCode($pkceCode);
return $provider->getAccessToken('authorization_code', [
'code' => $code,
]);
}
@@ -68,6 +131,10 @@ class MyEpClient
'urlResourceOwnerDetails' => $this->config['myep_oauth2_url_resource_owner_details'],
'scopes' => $this->config['myep_oauth2_scopes'],
'scopeSeparator' => ' ',
// The redirect URI above is generated from the incoming request, so it is only
// as trustworthy as the Host header. PKCE binds the authorization code to this
// flow by a second, header-independent means.
'pkceMethod' => AbstractProvider::PKCE_METHOD_S256,
]);
}
+31
View File
@@ -200,6 +200,37 @@ class UserDataHandlerTest extends TestCase
$this->assertSame(['team' => ['selected' => true]], $teamer->getCrmSelections());
}
/**
* BusPro compares addresses case-insensitively and MyE&P lowercases them on login, so a
* mixed-case address coming back from the API must land lowercased on both the user and
* the teamer - otherwise the login identity and the mailing address drift apart.
*/
public function testUpdateLocalUserNormalizesTheAddressBusProReports(): void
{
$user = (new User())
->setFirstName('Old')
->setLastName('Name')
->setEmail('[email protected]')
->setBusProAddressId(1)
->setBusProPersonId(2)
;
$teamer = (new Teamer())
->setCommunication((new Communication())->setEmail('[email protected]'))
;
$user->setTeamer($teamer);
$profileResponse = $this->createProfileResponse()
->setCommunication((new BusProCommunication())->setEmail('[email protected]'))
;
$handler = new UserDataHandler($this->entityManager, $this->logger);
$handler->updateLocalUser($user, $profileResponse, true, [], ['ROLE_TEAMER'], []);
$this->assertSame('[email protected]', $user->getEmail());
$this->assertSame('[email protected]', $teamer->getCommunication()?->getEmail());
}
/**
* @dataProvider pendingRolesProvider
*/
+22
View File
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Tests\Entity;
use App\Entity\Contact;
use PHPUnit\Framework\TestCase;
class ContactTest extends TestCase
{
/**
* Office contacts are normalized the same way User::setEmail() normalizes, so that every
* stored address has one shape regardless of which form wrote it.
*/
public function testSetEmailNormalizesCaseAndSurroundingWhitespace(): void
{
$contact = (new Contact())->setEmail(' [email protected] ');
$this->assertSame('[email protected]', $contact->getEmail());
}
}
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace App\Tests\Entity\Embeddable;
use App\Entity\Embeddable\Communication;
use PHPUnit\Framework\TestCase;
/**
* Pins the lowercasing of the teamer's contact address. This is the address the profile form
* writes and the one toPayload() pushes back to BusPro, so a mixed-case value entered here
* would otherwise diverge from the login identity stored in User::email.
*/
class CommunicationTest extends TestCase
{
public function testSetEmailNormalizesCaseAndSurroundingWhitespace(): void
{
$communication = (new Communication())->setEmail(' [email protected] ');
$this->assertSame('[email protected]', $communication->getEmail());
}
public function testSetEmailKeepsNull(): void
{
$communication = (new Communication())->setEmail(null);
$this->assertNull($communication->getEmail());
}
/**
* The outbound BusPro payload must carry the normalized form, not the raw input.
*/
public function testPayloadCarriesTheNormalizedAddress(): void
{
$communication = (new Communication())
->setEmail('[email protected]')
->setMobile('0170 1234567')
;
$this->assertSame('[email protected]', $communication->toPayload()['email']);
}
}
+147
View File
@@ -0,0 +1,147 @@
<?php
namespace App\Tests\Security\OAuth2;
use App\Security\OAuth2\AuthorizationDeniedException;
use App\Security\OAuth2\AuthorizationRequestException;
use App\Security\OAuth2\MyEpClient;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class MyEpClientTest extends TestCase
{
public function testAuthorizationUrlCarriesAnS256ChallengeAndStoresItsVerifier(): void
{
$request = $this->createRequest();
$url = $this->createClient()->createAuthorizationUrl($request);
parse_str((string) parse_url($url, \PHP_URL_QUERY), $query);
$this->assertSame('S256', $query['code_challenge_method']);
$session = $request->getSession();
$verifier = $session->get('oauth2pkce');
$this->assertIsString($verifier);
$this->assertSame($session->get('oauth2state'), $query['state']);
// the challenge is what MyE&P stores; the verifier replayed on the token request
// has to hash to it, or the exchange is refused
$expectedChallenge = trim(strtr(base64_encode(hash('sha256', $verifier, true)), '+/', '-_'), '=');
$this->assertSame($expectedChallenge, $query['code_challenge']);
}
public function testDeniedCallbackIsReportedAsADenialAndConsumesTheStoredState(): void
{
$request = $this->createRequest([
'state' => 'expected-state',
'error' => 'access_denied',
'error_description' => 'The user denied the request',
]);
$request->getSession()->set('oauth2state', 'expected-state');
$request->getSession()->set('oauth2pkce', 'verifier');
try {
$this->createClient()->fetchAccessToken($request);
$this->fail('Expected an AuthorizationDeniedException');
} catch (AuthorizationDeniedException $e) {
// MyE&P has named the cause; reporting this as a missing code would not
$this->assertSame('access_denied', $e->getError());
$this->assertSame('The user denied the request', $e->getErrorDescription());
}
$this->assertFalse($request->getSession()->has('oauth2state'));
$this->assertFalse($request->getSession()->has('oauth2pkce'));
}
public function testCallbackIsRefusedWhenTheSessionHoldsNoVerifier(): void
{
$request = $this->createRequest(['code' => 'a-code', 'state' => 'expected-state']);
$request->getSession()->set('oauth2state', 'expected-state');
$this->expectException(AuthorizationRequestException::class);
$this->expectExceptionMessage('Missing PKCE verifier');
$this->createClient()->fetchAccessToken($request);
}
public function testCallbackWithoutCodeConsumesTheStoredState(): void
{
$request = $this->createRequest(['state' => 'expected-state']);
$request->getSession()->set('oauth2state', 'expected-state');
$request->getSession()->set('oauth2pkce', 'verifier');
try {
$this->createClient()->fetchAccessToken($request);
$this->fail('Expected an AuthorizationRequestException');
} catch (AuthorizationRequestException $e) {
$this->assertSame('Missing code', $e->getMessage());
}
// the state is single-use: a callback that fails must not leave one behind that a
// later attempt could still replay
$this->assertFalse($request->getSession()->has('oauth2state'));
$this->assertFalse($request->getSession()->has('oauth2pkce'));
}
public function testCallbackWithAMismatchedStateConsumesTheStoredState(): void
{
$request = $this->createRequest(['code' => 'a-code', 'state' => 'other-state']);
$request->getSession()->set('oauth2state', 'expected-state');
$request->getSession()->set('oauth2pkce', 'verifier');
$this->expectException(AuthorizationRequestException::class);
$this->expectExceptionMessage('Missing state or mismatch');
try {
$this->createClient()->fetchAccessToken($request);
} finally {
$this->assertFalse($request->getSession()->has('oauth2state'));
$this->assertFalse($request->getSession()->has('oauth2pkce'));
}
}
public function testCallbackIsRefusedWhenTheSessionHoldsNoState(): void
{
$request = $this->createRequest(['code' => 'a-code', 'state' => 'any-state']);
$this->expectException(AuthorizationRequestException::class);
$this->expectExceptionMessage('Missing state or mismatch');
$this->createClient()->fetchAccessToken($request);
}
private function createClient(): MyEpClient
{
$urlGenerator = $this->createMock(UrlGeneratorInterface::class);
$urlGenerator
->method('generate')
->willReturn('https://myep-team.example.org/myep-auth/check')
;
return new MyEpClient($urlGenerator, $this->createMock(LoggerInterface::class), [
'myep_oauth2_client_id' => 'client-id',
'myep_oauth2_client_secret' => 'client-secret',
'myep_oauth2_url_authorize' => 'https://my.example.org/authorize',
'myep_oauth2_url_access_token' => 'https://my.example.org/token',
'myep_oauth2_url_resource_owner_details' => 'https://my.example.org/api/userinfo',
'myep_oauth2_scopes' => ['email', 'id', 'roles', 'profile'],
]);
}
/**
* @param array<string, string> $query
*/
private function createRequest(array $query = []): Request
{
$request = new Request($query);
$request->setSession(new Session(new MockArraySessionStorage()));
return $request;
}
}