vaizard / glued-skeleton-modular

Web application skeleton that uses the Slim4 Framework, PHP-DI, Nyholm PSR7 and Twig.
MIT License
1 stars 4 forks source link

Undefined index _GLUED on test server #203

Open zelitomas opened 3 years ago

zelitomas commented 3 years ago

Stack trace:

  1. Whoops\Exception\ErrorException->() /var/www/html/glued-skeleton/glued/Stor/Controllers/StorControllerApiV1.php:37
  2. Whoops\Run->handleError() /var/www/html/glued-skeleton/glued/Stor/Controllers/StorControllerApiV1.php:37
  3. Glued\Stor\Controllers\StorControllerApiV1->uploaderApiSave() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php:43
  4. Slim\Handlers\Strategies\RequestResponse->__invoke() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Routing/Route.php:384
  5. Slim\Routing\Route->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:81
  6. Slim\MiddlewareDispatcher->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:81
  7. Slim\MiddlewareDispatcher->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Routing/Route.php:341
  8. Slim\Routing\Route->run() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Routing/RouteRunner.php:84
  9. Slim\Routing\RouteRunner->handle() /var/www/html/glued-skeleton/vendor/slim/twig-view/src/TwigMiddleware.php:125
    1. Slim\Views\TwigMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    2. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/TranslatorMiddleware.php:53
    3. Glued\Core\Middleware\TranslatorMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:209
    4. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:167$138->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/LocaleSessionMiddleware.php:26
    5. Glued\Core\Middleware\LocaleSessionMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:209
    6. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:167$138->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/Timer.php:15
    7. Glued\Core\Middleware\Timer->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:209
    8. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:167$138->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Middleware/BodyParsingMiddleware.php:68
    9. Slim\Middleware\BodyParsingMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    10. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:59
    11. Slim\Middleware\RoutingMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    12. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/vendor/middlewares/trailing-slash/src/TrailingSlash.php:57
    13. Middlewares\TrailingSlash->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    14. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/ValidationFormsMiddleware.php:26
    15. Glued\Core\Middleware\ValidationFormsMiddleware->__invoke() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:209
    16. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:167$138->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/TwigFlashMiddleware.php:17
    17. Glued\Core\Middleware\TwigFlashMiddleware->__invoke() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:313
    18. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:294$139->handle() /var/www/html/glued-skeleton/vendor/middlewares/csp/src/Csp.php:53
    19. Middlewares\Csp->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    20. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/TwigCspMiddleware.php:28
    21. Glued\Core\Middleware\TwigCspMiddleware->__invoke() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:313
    22. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:294$139->handle() /var/www/html/glued-skeleton/vendor/tuupola/cors-middleware/src/CorsMiddleware.php:124
    23. Tuupola\Middleware\CorsMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    24. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/HeadersMiddleware.php:24
    25. Glued\Core\Middleware\HeadersMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    26. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/AuthorizationMiddleware.php:123
    27. Glued\Core\Middleware\AuthorizationMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    28. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/glued/Core/Middleware/SessionMiddleware.php:57
    29. Glued\Core\Middleware\SessionMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    30. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/vendor/tuupola/slim-jwt-auth/src/JwtAuthentication.php:178
    31. Tuupola\Middleware\JwtAuthentication->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    32. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/Middleware/MethodOverrideMiddleware.php:46
    33. Slim\Middleware\MethodOverrideMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    34. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/vendor/zeuxisoo/slim-whoops/src/Zeuxisoo/Whoops/Slim/WhoopsMiddleware.php:40
    35. Zeuxisoo\Whoops\Slim\WhoopsMiddleware->process() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:147
    36. class@anonymous/var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:128$137->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/MiddlewareDispatcher.php:81
    37. Slim\MiddlewareDispatcher->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/App.php:215
    38. Slim\App->handle() /var/www/html/glued-skeleton/vendor/slim/slim/Slim/App.php:199
    39. Slim\App->run() /var/www/html/glued-skeleton/glued/bootstrap.php:33
    40. require_once() /var/www/html/glued-skeleton/public/index.php:3
killua-eu commented 3 years ago

What uri produces this? $_GLUED is set by the auth middlewares and consumed onwards thougout glued. So this is some auth related issue. Obviously the problem falls to the uploaderApiSave() function in stor. What was the curl command?

zelitomas commented 3 years ago

Extracted from browser inspector:

Fetch:

fetch("https://japex01.vaizard.xyz/api/stor/v1/upload", {"credentials":"include","headers":{"authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJqYXBleDAxLnZhaXphcmQueHl6IiwiaWF0IjoxNjEzMTI1NjE2LCJleHAiOjE2MTMxMjc0MTYsImp0aSI6IjYwMjY1N2YwZTg5MzIiLCJzdWIiOiJnbHVlZEB0b21hc3plbGluYS5jeiIsImdfdWlkIjozLCJnX2FpZCI6M30.EKkqDMyNtMo5vEHULd7ysHHJNCFuGmirWpkrevLhPe5xc-jSOJC-jiQpX99S85F8Oj14I94WuUUHwXto0M285A","content-type":"multipart/form-data; boundary=----WebKitFormBoundarylxK0analU1htLC2q","sec-fetch-dest":"empty"},"referrerPolicy":"no-referrer-when-downgrade","body":"------WebKitFormBoundarylxK0analU1htLC2q\r\nContent-Disposition: form-data; name=\"file[0]\"\r\n\r\nundefined\r\n------WebKitFormBoundarylxK0analU1htLC2q\r\nContent-Disposition: form-data; name=\"upload_type\"\r\n\r\ngeneral\r\n------WebKitFormBoundarylxK0analU1htLC2q\r\nContent-Disposition: form-data; name=\"actual_dir\"\r\n\r\nfin_costs/\r\n------WebKitFormBoundarylxK0analU1htLC2q--\r\n","method":"POST","mode":"cors"});

CURL:

curl 'https://japex01.vaizard.xyz/api/stor/v1/upload' -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJqYXBleDAxLnZhaXphcmQueHl6IiwiaWF0IjoxNjEzMTI1NjE2LCJleHAiOjE2MTMxMjc0MTYsImp0aSI6IjYwMjY1N2YwZTg5MzIiLCJzdWIiOiJnbHVlZEB0b21hc3plbGluYS5jeiIsImdfdWlkIjozLCJnX2FpZCI6M30.EKkqDMyNtMo5vEHULd7ysHHJNCFuGmirWpkrevLhPe5xc-jSOJC-jiQpX99S85F8Oj14I94WuUUHwXto0M285A' -H 'Origin: file://' -H 'Sec-Fetch-Dest: empty' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ReactNativeDebugger/0.11.7 Chrome/80.0.3987.165 Electron/8.5.2 Safari/537.36' -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundarylxK0analU1htLC2q' --data-binary $'------WebKitFormBoundarylxK0analU1htLC2q\r\nContent-Disposition: form-data; name="file[0]"\r\n\r\nundefined\r\n------WebKitFormBoundarylxK0analU1htLC2q\r\nContent-Disposition: form-data; name="upload_type"\r\n\r\ngeneral\r\n------WebKitFormBoundarylxK0analU1htLC2q\r\nContent-Disposition: form-data; name="actual_dir"\r\n\r\nfin_costs/\r\n------WebKitFormBoundarylxK0analU1htLC2q--\r\n' --compressed
killua-eu commented 3 years ago

Using your curl example yields

{"api":"stor\/upload","version":1,"response_ts":1613240298,"response_id":"602817ea76c55","status":"Internal server error","code":500,"data":[],"message":"Expected file(s), got none."}

no files were sent even if files were expected. I can't replicate a stack trace with the undefiend index. What exactly were you doing to achieve the undefined index?