Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Warning: Undefined array key 1 in \Leuchtfeuer\SecureDownloads\Middleware\FileDeliveryMiddleware #217

Open
serens opened this issue Nov 8, 2024 · 1 comment
Labels

Comments

@serens
Copy link

serens commented Nov 8, 2024

Describe the bug
If the URLs are not composed correctly, a PHP warning may occur. The URLs were generated by a security scan.

PHP Warning: Undefined array key 1 in /var/www/html/vendor/leuchtfeuer/secure-downloads/Classes/Middleware/FileDeliveryMiddleware.php line 54

Line 54: [$jwt, $basePath] = explode('/', $cleanPath);

We fixed this by only using $jwt (key 0) due to $basePath not being used in the code.

To Reproduce
Steps to reproduce the behavior:

  1. Configure \Leuchtfeuer\SecureDownloads\Middleware\FileDeliveryMiddleware->assetPrefix to "/securedl/sdl-"
  2. GET /securedl/sdl-eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MzAzMDI5NDQsImV4cCI6MTczMjk4NDk0NCwidXNlciI6MCwiZ3JvdXBzIjpbMCwtMV0sImZpbGUiOiJ0eXBvM3RlbXAvYXNzZXRzL19wcm9jZXNzZWRfL2MvNy9jc21fVE9QLTIwMjJfNjJiMzhkMTkwYi5wbmciLCJwYWdlIjo5MDZ9.mAKvqPEVwcb00uofSE8vN2pOJpC6_ijfHasYWlFe7Gw

Expected behavior
Statuscode 404

Environment (please complete the following information):

  • Extension Version: 6.0.4
  • TYPO3 Version: 12.4.22
  • Browser: Chrome
  • Web Server: apache-fpm
  • PHP Version: 8.3.12
@balasch balasch added the bug label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants
@serens @balasch and others