italia / spid-saml-check

Tool di verifica implementazione SPID SAML
European Union Public License 1.2
71 stars 59 forks source link

Request : check strict error #197

Closed BrunoValenti80 closed 2 years ago

BrunoValenti80 commented 2 years ago

Spid-validator versione:1.8.2

la verifica del metadata è ok ma quando faccio la check strinct o la check extra mi da l'errore; Error while loading report: Traceback (most recent call last): File "/usr/local/bin/spid_sp_test", line 303, in metadata_check = _cls(**data_md) File "/usr/local/lib/python3.7/dist-packages/spid_sp_test/metadata.py", line 46, in init self.metadata = self.get(metadata_url) File "/usr/local/lib/python3.7/dist-packages/spid_sp_test/metadata.py", line 64, in get return open(metadata_url[7:], "rb").read() FileNotFoundError: [Errno 2] No such file or directory: '../data/https___infostudente_iuav_it/sp-metadata.xml'

Stesso problema su versioni precedenti: 1.8.1 e 1.8.0

Il mio metadata è all'indirizzo: https://infostudente.iuav.it/metadata/sp_metadata.xml

checkstricterror

etruriapa commented 2 years ago

Credo di avere lo stesso problema con la 1.8.2:

>>> ERR /api/request/check/:test
"Traceback (most recent call last):\n  File \"/usr/local/bin/spid_sp_test\", line 311, in <module>\n    metadata_check = _cls(**data_md)\n  File \"/usr/local/lib/python3.9/dist-packages/spid_sp_test/metadata.py\", line 48, in __init__\n    self.metadata = self.get(metadata_url)\n  File \"/usr/local/lib/python3.9/dist-packages/spid_sp_test/metadata.py\", line 66, in get\n    return open(metadata_url[7:], \"rb\").read()\nFileNotFoundError: [Errno 2] No such file or directory: '../data/https___localhost_shibboleth/sp-metadata.xml'\n"

Ho installato da https://hub.docker.com/r/italia/spid-saml-check e avvio con docker run -t -i -p 8443:8443 spid-saml-check

Ho notato che dentro la cartella /data ho due cartelle: /https___localhost_shibboleth e /http___nome_entityid_nel_metadata

Nel mio caso, il file viene cercato in https___localhost mentre si trova nell'altra cartella. Dopo aver copiato il contenuto da una cartella all'altra, il test parte ma non arriva alla fine per un errore non gestito in una promise. Probabilmente tutto dipende dal fatto che è sbagliato il metadata.

>>> 2022-03-18 17:42:21 - GET [] /api/request/check/strict

>>> env IDP_ENTITYID="https://localhost:8443"  spid_sp_test  --metadata-url file://../data/https___localhost_shibboleth/sp-metadata.xml  --authn-url file://../data/https___localhost_shibboleth/authn-request.dump  --debug ERROR -rf json -o ../data/https___localhost_shibboleth/sp-authn-request-strict.json
[ERR] Error: Command failed: env IDP_ENTITYID="https://localhost:8443"  spid_sp_test  --metadata-url file://../data/https___localhost_shibboleth/sp-metadata.xml  --authn-url file://../data/https___localhost_shibboleth/authn-request.dump  --debug ERROR -rf json -o ../data/https___localhost_shibboleth/sp-authn-request-strict.json
ERROR:spid_sp_test.authn_request:SpidSpAuthnReqCheck.test_Issuer: The Issuer's value MUST be equal to entityID
ERROR:spid_sp_test.authn_request:The Issuer's value MUST be equal to entityID

[STDOUT] Spid QA: executed 196 tests, 1 failed. 0 warnings.

[STDERR] ERROR:spid_sp_test.authn_request:SpidSpAuthnReqCheck.test_Issuer: The Issuer's value MUST be equal to entityID
ERROR:spid_sp_test.authn_request:The Issuer's value MUST be equal to entityID

{
  test_id: '',
  result: 'failure',
  test: "The Issuer's value MUST be equal to entityID",
  value: 'https://localhost/shibboleth',
  references: [],
  method: ''
}

>>> DATABASE : QUERY
"SELECT store, type FROM store WHERE user='validator' AND entity_id='https://localhost/shibboleth'  AND type='main'"

>>> DATABASE : QUERY
"SELECT organization FROM store WHERE user='validator' AND entity_id='https://localhost/shibboleth' AND type='main'"

>>> DATABASE : QUERY
"SELECT store, type FROM store WHERE user='validator' AND entity_id='https://localhost/shibboleth'  AND type='main'"

>>> DATABASE EXCEPTION (saveStore)
"TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined"

>>> DATABASE EXCEPTION (setMetadataValidation)
"TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined"
(node:26) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at Function.from (buffer.js:330:9)
    at Function.btoa (/spid-saml-check/spid-validator/server/lib/utils.js:166:23)
    at Database.saveStore (/spid-saml-check/spid-validator/server/lib/database.js:101:45)
    at Database.setRequestValidation (/spid-saml-check/spid-validator/server/lib/database.js:441:18)
    at /spid-saml-check/spid-validator/server/api/request.js:127:34
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
etruriapa commented 2 years ago

Dopo aver corretto il NameQualifier di Issuer nella configurazione di shibboleth (shibboleth2.xml) l'errore sopra non si presenta più.