pdsinterop / php-solid-server

Standalone Solid Server written in PHP by PDS Interop
https://pdsinterop.org/php-solid-server/
MIT License
46 stars 7 forks source link

[WiP] Test Suite Fixes #67

Open michielbdejong opened 1 year ago

michielbdejong commented 1 year ago

Will hopefully fix #52 First step: use updated dependencies Next step: digging into

Create non-container › in an existing container › using PATCH › creates the resource
"PATCH /storage/solid-crud-tests-1693553898252/exists/new.ttl HTTP/1.1" 400 1299 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"

It's apparently not accepting the new text/n3 patch format yet, even though solid-nextcloud is.

michielbdejong commented 1 year ago
 => ERROR [stage-0 11/12] RUN composer install --no-dev --prefer-dist                                                                                                                                                                           1.3s
------                                                                                                                                                                                                                                               
 > [stage-0 11/12] RUN composer install --no-dev --prefer-dist:                                                                                                                                                                                      
0.755 Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.                                                                         
0.755 Do not run Composer as root/super user! See https://getcomposer.org/root for details                                                                                                                                                           
0.841 No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.                                                                                 
0.841 Loading composer repositories with package information
0.923 Info from https://repo.packagist.org: #StandWithUkraine
1.288 Updating dependencies
1.302 Your requirements could not be resolved to an installable set of packages.
1.302 
1.302   Problem 1
1.302     - Root composer.json requires pdsinterop/solid-auth ^0.10.1 -> satisfiable by pdsinterop/solid-auth[v0.10.1, v0.10.2].
1.302     - pdsinterop/solid-auth[v0.10.1, ..., v0.10.2] require php ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
1.302   Problem 2
1.302     - Root composer.json requires pdsinterop/solid-crud ^0.7.1 -> satisfiable by pdsinterop/solid-crud[v0.7.1, v0.7.2].
1.302     - pdsinterop/solid-crud[v0.7.1, ..., v0.7.2] require php ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
1.302 
1.302 Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
------
Dockerfile:49
--------------------
  47 |     COPY "${PROJECT_PATH}" /app/
  48 |     
  49 | >>> RUN composer install --no-dev --prefer-dist
  50 |     RUN chown -R www-data:www-data /app
  51 |     # ==============================================================================
--------------------
ERROR: failed to solve: process "/bin/bash -o pipefail -c composer install --no-dev --prefer-dist" did not complete successfully: exit code: 2
michielbdejong commented 1 year ago

Ah! :) https://github.com/pdsinterop/solid-nextcloud/commit/6ab8d7b46d8e38aa8aeb34ca0e7fe11cae4b473a

michielbdejong commented 1 year ago

New error:

172.24.0.5 - - [01/Sep/2023:10:22:47 +0000] "GET /authorize?response_type=id_token%20code&redirect_uri=https%3A%2F%2Ftester&scope=openid%20profile%20offline_access&client_id=f5d1278e8109edd94e1e4197e04873b9&code_challenge_method=S256&code_challenge=RmpFc2r0cRS_7UQewxp99ZeKIaMXuBdkB06jGquDouA&state=global HTTP/1.1" 500 1253 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
michielbdejong commented 1 year ago

new error:

root@f7f44f9cea6e:/app# ./node_modules/.bin/jest test/surface/create-non-container.test.ts 
  SolidAuthFetcher Ready to roll +0ms
  SolidAuthFetcher curl -v  https://server/.well-known/openid-configuration +376ms
(node:898) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
  SolidAuthFetcher curl -v -X 'POST' -d '{"application_type":"web","redirect_uris":["https://tester"],"subject_type":"pairwise","token_endpoint_auth_method":"client_secret_basic","code_challenge_method":"S256"} -H 'Content-Type: application/json' https://server/register +102ms
 FAIL  test/surface/create-non-container.test.ts
  ● Create non-container › in an existing container › using PATCH › creates the resource

    Please make sure the cookie is valid, and add "https://tester" as a trusted app!

      at Object.getAuthFetcher (node_modules/solid-auth-fetcher/src/obtainAuthHeaders.ts:51:13)

I'll try to make this error more informative

michielbdejong commented 1 year ago

Added console.log(`curl -ik -H 'cookie: ${oidcProviderCookie}' "${redirectedTo}"`); on line 20 of node_modules/solid-auth-fetcher/dist/obtainAuthHeaders.js This reveals the server-side error:


 curl -ik -H 'cookie: PHPSESSID=32a70fd220cbad3884a24afdc6b97412; path=/' "https://server/authorize?response_type=id_token%20code&redirect_uri=https%3A%2F%2Ftester&scope=openid%20profile%20offline_access&client_id=f5d1278e8109edd94e1e4197e04873b9&code_challenge_method=S256&code_challenge=yJhII4ORVMz3lNWnTgA-sSI5BJ0mf9koh1KToq6CsPo&state=global"
HTTP/1.1 200 OK
Date: Sat, 02 Sep 2023 06:31:04 GMT
Server: Apache/2.4.56 (Debian)
X-Powered-By: PHP/8.0.30
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Vary: Accept-Encoding
Access-Control-Allow-Origin: 
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: authorization, content-type, dpop
Access-Control-Allow-Methods: GET, PUT, POST, OPTIONS, DELETE, PATCH
Accept-Patch: application/sparql-update
Access-Control-Expose-Headers: Accept-Patch
Content-Length: 950
Content-Type: text/html; charset=UTF-8

<br />
<b>Warning</b>:  Undefined array key "request" in <b>/app/src/Controller/AuthorizeController.php</b> on line <b>31</b><br />
<br />
<b>Fatal error</b>:  Uncaught Laminas\HttpHandlerRunner\Exception\EmitterException: Unable to emit response; headers already sent in /app/vendor/laminas/laminas-httphandlerrunner/src/Exception/EmitterException.php:19
Stack trace:
#0 /app/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitterTrait.php(36): Laminas\HttpHandlerRunner\Exception\EmitterException::forHeadersSent()
#1 /app/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(27): Laminas\HttpHandlerRunner\Emitter\SapiEmitter-&gt;assertNoPreviousOutput()
#2 /app/web/index.php(253): Laminas\HttpHandlerRunner\Emitter\SapiEmitter-&gt;emit(Object(Laminas\Diactoros\Response\HtmlResponse))
#3 {main}
  thrown in <b>/app/vendor/laminas/laminas-httphandlerrunner/src/Exception/EmitterException.php</b> on line <b>19</b><br />
michielbdejong commented 1 year ago

Running the same test against solid-nextcloud, I see:

root@7c94a0713647:/app# ./node_modules/.bin/jest test/surface/create-non-container.test.ts 
  SolidAuthFetcher Ready to roll +0ms
  SolidAuthFetcher curl -v  https://server/.well-known/openid-configuration +895ms
(node:220) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
  SolidAuthFetcher curl -v -X 'POST' -d '{"application_type":"web","redirect_uris":["https://tester"],"subject_type":"pairwise","token_endpoint_auth_method":"client_secret_basic","code_challenge_method":"S256"} -H 'Content-Type: application/json' https://server/apps/solid/register +213ms
  SolidAuthFetcher curl -v  https://server/.well-known/openid-configuration +654ms
  SolidAuthFetcher curl -v -X 'POST' -d 'grant_type=authorization_code&code_verifier=zLPpI4AUIqWlPONHDWUPjLr4J6t0BKUVgzNCNvmyLW1yQVc1bq&code=... -H 'DPoP: eyJhbGciOiJSUzI1NiIsInR5cCI6ImRwb3Arand0IiwiandrIjp7Imt0eSI6IlJTQSIsImtpZCI6IjQxMmJZVU5ybkFBMUFRMzgzTVF5NFo3VVJybWtpcVZkV1lweFptNXl5WlkiLCJ1c2UiOiJzaWciLCJhbGciOiJSUzI1NiIsImUiOiJBUUFCIiwibiI6Im1odURCY2stbnVRY1BBWWNjTE5haTF4VWdkQkFFWk93eEJpT2d6TDlRMUptX2dlZmxoLWhXNnJCd2RsMWYyS2R4cEhqQU5sNWJUaUJoeEo4U0FwdFZGLXRqR3plVnROdmJHbzdnR2lieV9ld18ydFlyLXNmYlNpYnBMZVFMb2tvd1hnLXJObEM2bmFVWGpjeUMxLXhvSjNoZmVNdUlHU212UFhxYWQtR25CQmhON3dkNy1XcUM0REt6U2dYNFdQUng3eGliOWxLbnlLX0N3SWNHSnY0WHRZSWZSWV9nUU9JejAwdTFpRFkxdEhpVm1aWUFVeV9OazNTZENFTk9vTHoxaktsRnpaN1FYNWl2UUNsekVsOFBybzQ2dUpqdDR4dWpEYWRwUUVqRklrVlp6aTZCNmJva3UtRE9xaEkyTkVNZHExMHlNUVZZcFN6TXhmakNnbzB3dyJ9fQ.eyJodHUiOiJodHRwczovL3NlcnZlci9hcHBzL3NvbGlkL3Rva2VuIiwiaHRtIjoiUE9TVCIsImp0aSI6ImZiMzVjMTNmLWNkNDQtNGRkMi1iYjQ4LTg3ZmI2M2E5MTJlOSIsImlhdCI6MTY5MzY0MjQyNCwiZXhwIjoxNjkzNjQ2MDI0fQ.BrKNiPnAS4cIbA1hxnFkr3YxraIFM76xn-oCemakfsTy1Ga4HftDFTPUiAMEBKSU-eVbczQpp_B9e9BHai3lfA6Q-_TCqDNgGJYUIS3N7U3_y_mofKO089lH5Nqjbgda2TjCvYY1GAs2qmtkXak_GvfGAsoZpZpWvNVKrJ0bVCF1LBzTY4KxnMPOs4jyw7wl-OXO6e7mq6TFbIg9it2liz97I1u71k6KfyW2UUYUXYw1OYw-XCyksgnDxuasDaQuLMNkl1pHVCfAgVNA9o5TbjDgfrusSsuSZsMpVw3RcG_pPcEbge8iSgu31Ejy88r04EZuwxHh1HoDCwgi9al-kA' -H 'content-type: application/x-www-form-urlencoded' https://server/apps/solid/token +88ms
  SolidAuthFetcher curl -v -X 'PUT' -d '<#hello> <#linked> <#world> . -H 'Content-Type: text/turtle' -H 'authorization: DPoP eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NlcnZlciIsImF1ZCI6IjJlNWNkZGNmMGY2NjM1NDRlOTg5ODI5MzFlNmNjNWE2IiwiaWF0IjoxNjkzNjQyNDI1LjAwNDMwNSwibmJmIjoxNjkzNjQyNDI0LjAwNDMwNSwiZXhwIjoxNjkzNjQzMDI1LjAwNDMwNSwiYXpwIjoiMmU1Y2RkY2YwZjY2MzU0NGU5ODk4MjkzMWU2Y2M1YTYiLCJzdWIiOi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