Giter Site home page Giter Site logo

italia / spid-sp-test Goto Github PK

View Code? Open in Web Editor NEW
37.0 5.0 17.0 13.45 MB

SAML2 SPID/CIE Service Provider validation tool

License: European Union Public License 1.2

Python 83.50% Shell 0.06% HTML 16.21% Dockerfile 0.19% Makefile 0.04%
python saml2 spid cie hacktoberfest

spid-sp-test's Introduction

spid-sp-test

CI build pypi License Python version Downloads Downloads

spid-sp-test is a SAML2 SPID/CIE Service Provider validation tool that can be executed from the command line. This tool was born by separating the test library already present in spid-saml-check.

Summary

Features

spid-sp-test can:

  • test a SAML2 SPID/CIE Metadata file or http url
  • test a SAML2 SPID/CIE AuthnRequest file or or http url
  • test a SAML2 eIDAS FICEP SP Metadata file or http url
  • test many kinds of SPID SP, see Profiles
  • test ACS behaviour, how a SP replies to a SAML2 Response
  • dump the responses sent to an ACS and the HTML of the SP response
  • handle Attributes to send in Responses or test configurations of the Responses via json configuration files
  • configure response template with Jinja2
  • get new test-suite via multiple json files
  • fully integrable in CI
  • export a detailed report in json format, in stdout or in a file

Generally it's:

  • extremely faster in execution time than spid-saml-check
  • extremely easy to setup

Check metadata

Command line with metadata checking

Authentication requests, JSON output

Command line with more flag demoed

Full test set with metadata, authn request and responses

Command line with test responses

Profiles

Each profile loads a set of test. Use --profile $profile-name with one of the following profile name:

  • saml2-sp: Pure SAML2 SP with some best practises
  • spid-sp-public: Public Spid SP
  • spid-sp-private: Private Spid SP
  • spid-sp-ag-public-full: Public Spid SP Aggregatore Full
  • spid-sp-ag-public-lite: Public Spid SP Aggregatore Lite
  • spid-sp-ag-private-full: Private Spid SP Aggregatore Full
  • spid-sp-ag-private-lite: Private Spid SP Aggregatore Lite
  • spid-sp-op-public-full: Public Spid SP Gestore Full
  • spid-sp-op-public-lite: Public Spid SP Gestore Lite
  • cie-sp-public: Public CIE SP
  • cie-sp-private: Private CIE SP
  • ficep-eidas-sp: eIDAS FICEP SP

Warning: the support for Aggregatore and Gestore doesn't cover the x.509 certificates. Spid-sp-test uses spid-compliant-certificates-python for the validation of the certificates.

Setup

Prerequisite

  • LibXML2
  • xmlsec with openssl engine support
  • python3
  • pip for automated installation with Python packages manager

Setup in Debian like distro with virtual env

# install prerequisite
apt install libxml2-dev libxmlsec1-dev libxmlsec1-openssl xmlsec1 python3-pip python3-virtualenv
# initialize virtual env
virtualenv -p python3 env
source env/bin/activate

# install spid-sp-test 
pip install spid-sp-test --upgrade --no-cache

Overview

spid-sp-test can test a SP metadata file, you just have to give the Metadata URL, if http/http or file, eg: file://path/to/metadata.xml. At the same way it can test an Authentication Request.

In a different manner spid-sp-test can send a huge numer of fake SAML Response, for each of them it needs to trigger a real Authentication Request to the target SP.

If you want to test also the Response, you must give the spid-sp-test fake idp metadata xml file to the target SP. Get fake IdP metadata (--idp-metadata) and copy it to your SP metadatastore folder.

spid_sp_test --idp-metadata > /path/to/spid-django/example/spid_config/metadata/spid-sp-test.xml

To get spid-sp-test in a CI you have to:

  • configure an example project in your application
  • register the spid-sp-test fake idp metadata in your SP and execute the example project, with its development server in background
  • launch the spid-sp-test commands

An example of CI is here

Examples

Run spid_sp_test -h for inline documentation.

usage: spid_sp_test [-h] [--metadata-url METADATA_URL] [--idp-metadata] [-l [LIST [LIST ...]]] [--extra] [--authn-url AUTHN_URL] [-tr] [-nsr] [-tp TEMPLATE_PATH] [-tn [TEST_NAMES [TEST_NAMES ...]]]
                    [-tj [TEST_JSONS [TEST_JSONS ...]]] [-aj ATTR_JSON] [-o REPORT_OUTPUT_FILE] [-rf {json,html}] [-d {CRITICAL,ERROR,WARNING,INFO,DEBUG}] [-xp XMLSEC_PATH] [--production]
                    [--response-html-dumps RESPONSE_HTML_DUMPS] [--exit-zero]
                    [-pr {saml2-sp,spid-sp-public,spid-sp-private,spid-sp-ag-public-full,spid-sp-ag-public-lite,spid-sp-op-public-full,spid-sp-op-public-lite,cie-sp-public,cie-sp-private,ficep-eidas-sp}]
                    [-ap AUTHN_PLUGIN] [-rm REQUEST_METHOD] [-rb REQUEST_BODY] [-rct REQUEST_CONTENT_TYPE] [-prs] [-pas] [--xsds-files-path XSDS_FILES_PATH] [-v]


src/spid_sp_test/spid_sp_test -h for help

Test metadata passing a file

spid_sp_test --metadata-url file://metadata.xml

Test metadata from a URL

spid_sp_test --metadata-url http://localhost:8000/spid/metadata

A quite standard test

spid_sp_test --metadata-url http://localhost:8000/spid/metadata --authn-url http://localhost:8000/spid/login/?idp=http://localhost:8088 --extra

Print only ERRORs

spid_sp_test --metadata-url http://localhost:8000/spid/metadata --authn-url http://localhost:8000/spid/login/?idp=https://localhost:8080 --extra --debug ERROR

JSON report, add -o filename.json to write to a file, -rf html -o html_report/ to export to a HTML page

spid_sp_test --metadata-url http://localhost:8000/spid/metadata --authn-url http://localhost:8000/spid/login/?idp=https://localhost:8080 --extra -rf json

Given a metadata file and a authn file (see tests/metadata and tests/authn for example) export all the test response without sending them to SP:

spid_sp_test --metadata-url file://tests/metadata/spid-django-other.xml --authn-url file://tests/authn/spid_django_post.html --extra --debug ERROR -tr -nsr

Get the response (test 1) that would have to be sent to a SP with a custom set of attributes, without sending it for real. It will just print it to stdout

spid_sp_test --metadata-url file://tests/metadata/spid-django-other.xml --authn-url file://tests/authn/spid_django_post.html --extra --debug ERROR -tr -nsr -tn 1 -aj tests/example.attributes.json

Common usages

Test a Shibboleth SP with a SAMLDS (DiscoveryService). In this example target points to the target service and entityID is the selected IdP. This example works also a Shibboleth IdP-SP proxy/gateway.

spid_sp_test --metadata-url https://sp.testunical.it/pymetadata_signed.xml --authn-url "https://sp.testunical.it/Shibboleth.sso/Login?target=https://sp.testunical.it/secure/index.php&entityID=https://localhost:8080" --debug ERROR --extra -tr

Test Satosa-Saml2Spid using its authn plugin and a SP that supports idp hinting

spid_sp_test --metadata-url https://localhost:10000/spidSaml2/metadata --authn-url "http://localhost:8000/saml2/login/?idp=https://localhost:10000/Saml2IDP/metadata&next=/saml2/echo_attributes&idphint=https%253A%252F%252Flocalhost%253A8080" -ap spid_sp_test.plugins.authn_request.SatosaSaml2Spid --extra -tr

Test Responses and html dumps

By enabling the response dump with the --response-html-dumps HTML_PATH option, you will get N html files (page of your SP) as follows:

  • test description, commented
  • SAML Response sent, commented
  • SP html page, with absolute src and href (god bless lxml)

Here an example of 1_True.html, where 1 is the test name and True is the status.

Extending the tests

spid-sp-test offers the possibility to extend and configure new response tests to be performed. The user can:

  • customize the test suite to run by configuring a json file similar to tests/example.test-suite.json and passing this as an argument with --test-jsons option. More than one json file can be entered by separating it by a space

  • customize the attributes to be returned by configuring these in a json file similar to example/example.attributes.json and passing this with the --attr-json option

  • customize xml templates to be used in tests, indicating them in each test entry in the configuration file configured via --test-jsons and also the templates directory with the option --template-path. The templates are Jinja2 powered, so it's possible to extend src/spid_sp_test/responses/templates/base.xml with our preferred values

  • customize the way to get the SAML2 Authn Request, using plugins wrote by your own. If you're using a IAM Proxy with some OAuth2/OIDC frontends of a custom API, you can write your plugin and use it in the cli arguments, eg: spid_sp_test --metadata-url https://localhost:8000/spid/metadata --extra --authn-url https://localhost:8000/spid/login/?idp=https://localhost:8080 --debug INFO -tr --authn-plugin spid_sp_test.plugins.authn_request.Dummy

  • customize entityid and certificates path runtime, using ENV variables. The files MUST be named private.key and public.cert:

    IDP_ENTITYID=https://your.idp.eid/ IDP_CERT_PATH=../spid-django/example/certificates spid_sp_test --idp-metadata
    

Looking at src/spid_sp_test/responses/settings.py or tests/example.test-suite.json we found that every test have a response attribute. Each element configured in would overload the value that will be rendered in the template. Each template can load these variable from its template context or use which ones was statically defined in it.

Finally you have batteries included and some options as well, at your taste.

Docker

Before starting you have to obtain the italia/spid-sp-test image. You can pull it from Docker Hub

$ docker pull ghcr.io/italia/spid-sp-test:latest

or build locally

$ docker build --tag italia/spid-sp-test:latest .

The container working directory is set to /spid therefore, local files should be mounted relatively to /spid path.

$ docker run -ti --rm \
    -v "$(pwd)/tests/metadata:/spid/mymetadata:ro" \
    -v "$(pwd)/tests/metadata:/spid/dumps:rw" \
    italia/spid-sp-test:v1.1.5 --metadata-url file://mymetadata/spid-django-other.xml

Unit tests

That's for developers.

pip install requirements-dev.txt
pytest -v --cov=spid_sp_test --cov-report term  tests/

If you need a docker, you can do:

  1. create the developer image
docker build -f Dockerfile-devenv --no-cache . --tag italia/spid-sp-test-devenv
  1. run coverage tests on the development image
docker run italia/spid-sp-test-devenv
  1. if you need to use the image as a developer machine or inspect the enviroment, you can access in it with
docker run -it --entrypoint /bin/bash italia/spid-sp-test-devenv
  1. The final step is a live coding from your host machine and the development docker instance, using volumes
docker run -it -v $(pwd):/tmp/src --entrypoint /bin/bash italia/spid-sp-test-devenv

Authors

References

TLS/SSL tests

spid-sp-test's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

spid-sp-test's Issues

Profiles management

spid-sp-test should handle different profiles where every profile contains some tests.
Same unique test can be used into more different profiles.
Profiles could be defined into configuration files as for Response Test Suite.
A single profile can be executed as follow, for example:

spid_sp_test --metadata-url http://localhost:8000/spid/metadata --profile spid-sp-metadata-public

Check for IPA code in ContactPerson for aggregated

As for Avviso SPID n.19 v4,
the element ContactPerson where contactType is "other" and entityType is "aggregated" must contain the element IPACode, if the element contains the attribute Public or PublicOperator. The element IPACode, if present, can not be empty and must be a valid code on IPA

check Destination value on AuthnRequest

The Destination attribute SHOULD be the address to which the request has been sent but can also be the EnityID of IdP (Av. SPID n.11).
[SPID-QAD-Request-Extra]

Version output

I've installed spid_sp_test command but I'm not sure about its version.
There's no --version command line switch and -h does not output any version string.
I think it would be a useful addition.

(yes, I know I can ask pip meanwhile)

Follow redirects while testing AuthnRequests

Hi, I was fiddling with Keycloak to see if I could use spid-sp-test to test the SPID Keycloak provider, and it seems like Keycloak emits some redirects before sending an AuthnRequest with HTTP status code 303 See Other (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303).

This is the commandline I am using (please ignore OIDC attributes for now):

luca@luca-VirtualBox:~$ spid_sp_test 
  --metadata-url https://login.domain.com:8443/auth/realms/spid/spid-sp-metadata 
  --authn-url "https://login.domain.com:8443/auth/realms/spid/protocol/openid-connect/auth?scope=openid+email+profile+phone+address&state=3bd6JHYXE2br8A0xFNl3DbBJS5xRIqpeRuRRH-6NSRE.11FO_fAw98M.account-console&response_type=code&client_id=keycloak_public&redirect_uri=https%3A%2F%2Flogin.domain.com%3A8443%2Fauth%2Frealms%2Fpublic%2Fbroker%2Fspid%2Fendpoint&ui_locales=en&nonce=CfaxQp3-axms2xe9aoU6xA&kc_idp_hint=spid-sp-test" --extra -tr

The process starts and successfully tests the metadata document. Right after that, it fails with the following message:

Traceback (most recent call last):
  File "/home/luca/.local/bin/spid_sp_test", line 291, in <module>
    authn_check = SpidSpAuthnReqCheck(**data_ac)
  File "/home/luca/.local/lib/python3.9/site-packages/spid_sp_test/authn_request.py", line 204, in __init__
    self.authn_request = get_authn_request(
  File "/home/luca/.local/lib/python3.9/site-packages/spid_sp_test/authn_request.py", line 155, in get_authn_request
    raise Exception(

Exception: Authn Request page returns a HTML error code: 303

Would it be possible and correct to let it automatically follow redirects?

Error in running spid-sp-test as Docker container on Windows 10

I was tying to setup a test environment on my host as a Docker container. I started cloning the repo locally. Then, I built the image typing docker build -t italia/spid-sp-test:0.5.6 ., as reported in doc, and the image was successfully built. Then, I tried to run the image in a local container, but this is the output:

$> docker run -it --name idptest-agid-local italia/spid-sp-test:0.5.6 
/usr/bin/env: 'python3\r': No such file or directory

I am working on a Windows 10 host. It seems like something goes wrong when interpeting the CRLF or the EoL chars in general.

NORMATIVE statements in messages

example:

one Organization element can be preset should be one Organization element MUST be present

Every message MUST adopt normative language

Separate tests for production systems

SSL tests (to be implemented), metadata tests and authn request MUST separate https checks in a additional profile called "prod".
this will prevent that a dev CI SHOULD have https url

Possibility to test SAML2 and OIDC Proxy

an additional option, like --proxy saml2|oidc|oauth2 would load a specialized authnrequest loader, for each kind of proxy type.
This will follow the requests if they are saml2 redirect or post or oidc/oauth2 auth code flow.

This is a approach that would be experimental, each tested proxy as working would be referenced in a dedicated section in the README.

the proxy that would drive the first tests are:

SATOSA-Saml2SPID
AgID Login (oidc auth code flow)

Method, content type and body not used to retrieve AuthnRequest when executing Response tests

Follow-up to #62.

When I test my SP using POST requests to obtain the AuthnRequest, although the AuthRequest checks are executing successfully, adding -tr to perform the response tests causes spid_sp_test to fail with:

Traceback (most recent call last):
  File "/home/mauro/workspace/python-env/spid_sp_test/bin/spid_sp_test", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/mauro/git/spid-sp-test/src/spid_sp_test/spid_sp_test", line 317, in <module>
    selective_run(response_check, profile, args.list)
  File "/home/mauro/git/spid-sp-test/src/spid_sp_test/spid_sp_test", line 31, in selective_run
    method()
  File "/home/mauro/git/spid-sp-test/src/spid_sp_test/../spid_sp_test/response.py", line 320, in test_profile_spid_sp
    self.do_authnrequest()
  File "/home/mauro/git/spid-sp-test/src/spid_sp_test/../spid_sp_test/response.py", line 156, in do_authnrequest
    self.authn_request_data = get_authn_request(
  File "/home/mauro/git/spid-sp-test/src/spid_sp_test/../spid_sp_test/authn_request.py", line 155, in get_authn_request
    raise Exception(
Exception: Authn Request page returns a HTML error code: 405

Example invocation:

spid_sp_test --metadata-url http://mysp.com:8110/path/to/metadata.xml --authn-url http://mysp.com:8110/path/to/login -rm POST -rct data -rb '{"authId": "test", "serviceProviderId": "mysp", "myacs": "cdd", "identityProviderEntityId": "https://localhost:8080"}' --extra -report -o spid -rf html -tr

The Destination attribute must be a valid HTTPS url

Buonasera. Sto effettuando i test di validazione col tool spid-saml-check e sono arrivato alla sezione Request->CheckStrict.
Il campo Destination della mia request è "http://localhost:8080" e questo genera l'errore "The Destination attribute must be a valid HTTPS url". Il problema è che l'url contiene una richiesta HTTP e non HTTPS (e quindi devo permettere anche richieste HTTPS a localhost) o l'errore è altrove?
Eventualmente sapreste dirmi a che punto dell'installazione di spid-saml-check viene effettuata l'assegnazione all'attributo Destination o come modificarlo?

Company for ContactPerson billing

See the example:

<md:ContactPerson contactType="billing">
     <md:Extensions xmlns:fpa="https://spid.gov.it/invoicing-extensions">
          <fpa:CessionarioCommittente>
               ...
          </fpa:CessionarioCommittente>
     </md:Extensions>
     <md:Company>Destinatario_Fatturazione</md:Company>
     <md:EmailAddress>[email protected]</md:EmailAddress>
     <md:TelephoneNumber>telefono_fatture</md:TelephoneNumber>
</md:ContactPerson>

Improve install instructions for python newbies

I'm not a python expert. I tried to install spid_sp_test on a Kubuntu 20.04.
First problem: pip install spid_sp_tests fails with:

ERROR: pyopenssl 20.0.1 has requirement cryptography>=3.2, but you'll have cryptography 2.8 which is incompatible

Uninstalling the apt package for python3-requests (in order to reinstall it later with PIP) is a no go: critical s.o. base packages depend on python3-requests.

So, the way to go is using venv (thanks Giuseppe for the tip).

apt install python3-venv
# let myWorkingDir be a folder where you can place python virtual environments
cd myWorkingDir
mkdir spid_sp_test
python3 -m venv spid_sp_test
source spid_sp_test/bin/activate
# important: wheel is needed to install spid_sp_test
pip install wheel
pip install spid_sp_test
# use spid_sp_test as needed...
# ... when you've done, exit the virtual environment with:
deactivate

Then, whenever you need to use spid_sp_test:

cd myWorkingDir
source spid_sp_test/bin/activate
# use spid_sp_test as needed...
# ... when you've done, exit the virtual environment with:
deactivate

Probably obvius steps for a python dev, not for me :-)

SeleniumHQ addon

Actually we're using python requests to push the SAM2 response to the SP ACS service.
This means that js won't be executed and also that the dumps of the SP HTML response will be stored as raw html.

Even more, authn request url would be handled as a single shot http request to a pure SAML2 SP, in the case which the SP is behind a IAM proxy this feature won't work and, even more, also the response mechanism would be faulty.

For these cases an integration with a test IDP (spid-testenv2 or spid-saml-check) is needed and these should have to adopt spid-sp-test.

Anyway, the possibility to handle these case of IAM proxy or other strange behaviour is the adoption of a real web browser, like the selenium hq webdriver does.

This should be only an option, as an addons, because it would be impossibile to handle that in a CI, it's only for human interaction

Add support for POST AuthnRequest initialisation requests

Right now, with:

spid_sp_test --metadata-url http://localhost:8000/spid/metadata --authn-url http://localhost:8000/spid/login/?idp=https://localhost:8080

I'm telling spid_sp_test to make a GET request to http://localhost:8000/spid/login/?idp=https://localhost:8080 in order to simulate the user browser and get the AuthnRequest aimed to be forwarded to the IdP.

In my environment this request should be made in POST instead. After all, the https://github.com/italia/spid-sp-access-button is offered in two different flavours, GET and POST. So I'm requesting whether this scenario could also be supported in spid-sp-test.

The most straightforward solution that comes into my mind: add two parameters like these:

spid_sp_test --metadata-url http://localhost:8000/spid/metadata --authn-url http://localhost:8000/spid/login 
             --authn-method=POST --authn-body="idp=https%3A%2F%2Flocalhost%3A8080&foo=bar"

That is: add a command line parameter to specify the request type (POST/GET... possibly even PUT?) and another parameter to specify the request body as a string (in this case I'm using a application/x-www-form-urlencoded body, but I could write a JSON string or whatever...).
As a plus, perhaps having also a --authn-body-file=path/to/some/file that reads the body contents from a file instead of from the CLI would be nice to have.

Separate SAML2 compliance test from SPID compliance tests

I think this project can be useful for purposes not strictly related to SPID. Probably the possibility of dividing pure SAML2 tests from SPID ones could materialize and it should be managed with separate classes.

I think it is convenient to be able to specify which test classes to use, so as to make the SPID class as a child that inherits the SAML2 one, and consider this as a command line option.

The Destination attribute must be a valid HTTPS url

Buonasera. Sto effettuando i test di validazione col tool spid-saml-check e sono arrivato alla sezione Request->CheckStrict.
Il campo Destination della mia request è "http://localhost:8080" e questo genera l'errore "The Destination attribute must be a valid HTTPS url". Il problema è che l'url contiene una richiesta HTTP e non HTTPS (e quindi devo permettere anche richieste HTTPS a localhost) o l'errore è altrove?
Eventualmente sapreste dirmi a che punto dell'installazione di spid-saml-check viene effettuata l'assegnazione all'attributo Destination o come modificarlo?

adopt spid-saml-check metadata

it would be better to have the same metadata for spid-sp-test and spid-saml-check, so that a SP shouldn't deploy two metadata but simply rely on a single, unified, metadata, for both the platforms

NameID format check

spid-saml-check and consequently spid-sp-test validate the nameid format within the metadata, example

<md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>

spid-saml-check updates

these issues must be checked also in spid-sp-test

  • italia/spid-saml-check#32
  • sign_Response and sign_assertion must be response parameters in settings.RESPONSE_TESTS
  • entityID must be customized via spid_sp_test paramenter

Responses dumps

Each response must produce a folder with the HTML dump and the SAML2 Response.
this is needed for human check.

We need a configurable response dumps path, where to create a folder and all the output of the tests in

the metadata signature MUST be valid

A lavoro stiamo cercando di imparere a usare SPID e poterlo integrare su un sito.
Io utilizzo un pc Asus che in origine aveva windows e ci ho installato Ubuntu 20.04.2 LTS.

Ho generato i metadata utilizzando spid-php https://github.com/italia/spid-php

Ho effettuato la validazione utilzzando spid-sp-test e ho incontrato qualche problema con la validazione della signature.

Ho utilizzato spid-sp-test installandolo con pip seguendo le istruzioni nel README
Non risucivo a passare il test sulla validità della signature sui metadata.

Chiedendo aiuto sulla comunity slack developer-italia(grazie dell'aiuto) sono stato prontamente aiutato e mi è stato detto che il file xml che stavo testando era valido ma che sulla mia macchina la validazione falliva probabilmente a causa della versione di xmlsec installata.

Come da suggerimento ho riprovato spid-sp-test però utilizzando l'immagine docker e in questo caso sono stato in grado di verificare la validità dei metadata compresa la signature.

Sono state avanzate due ipotesi:

  • fallisce su windows a causa della versione di xmlsec
  • fallisce su ubuntu > 18 per una delle dipendenze di xmlsec

Check EntityID

L'EntityID dichiarato nel metadata deve essere una URL, preferibilmente https, e deve corrispondere al dominio indicato nel parametro --metadata-url, quando questo è specificato come http o https.

Nel caso in cui non sia https o non corrisponda al dominio sul quale è pubblicato il metadata, il test deve fornire un warning (non errore)

Rif. italia/spid-saml-check#114

Docker image

TODO

a Docker iamge and an example command to build and run the tests, using a volume path to collect html dumps and json report

Error during installation

Following the instruction and launching the command:

sudo pip install spid-sp-test --upgrade --no-cache

I get the following error:

Collecting spid-sp-test
  Downloading https://files.pythonhosted.org/packages/f2/92/4947c4b88ab7aa5fc1974082d7a5b9c2a7b5488ab2706146083aba443456/spid_sp_test-0.5.0.tar.gz (55kB)
    100% |████████████████████████████████| 61kB 4.1MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-TqWLIA/spid-sp-test/setup.py", line 25
        packages=[f"{_pkg_name}"],
                               ^
    SyntaxError: invalid syntax
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-TqWLIA/spid-sp-test/

Tested on elementary OS 5.1.7 Hera (based on Ubuntu 18.04 LTS)

eIDAS node compatibility

If AuthnContextClassRef of AuthnRequest is SpidL2 or SpidL3, and the related SP metadata id for public organization (spid:Public/) the SP metadata should be checked for the presence of eIDAS-specific AttributeConsumingServices (index 99 and 100)

Invalid check on private service provider

Referring to https://www.agid.gov.it/sites/default/files/repository_files/spid-avviso-n29v3-specifiche_sp_pubblici_e_privati.pdf
there are two checks for --profile spid-sp-private that are not correct.

on page 6 of the linked pdf, there is the same structure reported on https://docs.italia.it/italia/spid/spid-regole-tecniche/it/stabile/metadata.html#esempio-contatti-metadata-sp-per-fatturazione that has EmailAddress and TelephoneNumber out of Extensions node:

   <md:ContactPerson contactType="other">
        <md:Extensions>
            <spid:VATNumber>IT12345678901</spid:VATNumber>
            <spid:FiscalCode>XYZABCAAMGGJ000W</spid:FiscalCode>
            <spid:Private/>
        </md:Extensions>
        <md:EmailAddress>[email protected]</md:EmailAddress>
        <md:TelephoneNumber>+390123456789</md:TelephoneNumber>
    </md:ContactPerson>
    <md:ContactPerson contactType="billing">
        <md:Extensions 
               xmlns:fpa="https://spid.gov.it/invoicing-extensions">
            <fpa:CessionarioCommittente>
                <fpa:DatiAnagrafici>
                    <fpa:IdFiscaleIVA>
                        <fpa:IdPaese>IT</fpa:IdPaese>
                        <fpa:IdCodice>02468135791</fpa:IdCodice>
                    </fpa:IdFiscaleIVA>
                    <fpa:Anagrafica>
			           <fpa:Denominazione>
                            Destinatario_Fatturazione
			           </fpa:Denominazione> 
                    </fpa:Anagrafica>
                </fpa:DatiAnagrafici>
                <fpa:Sede>
		             <fpa:Indirizzo>via [...]</fpa:Indirizzo>
		             <fpa:NumeroCivico>99</fpa:NumeroCivico>
		             <fpa:CAP>12345</ fpa:CAP>
		             <fpa:Comune>nome_citta</fpa:Comune>
		             <fpa:Provincia>XY</fpa:Provincia>
                    <fpa:Nazione>IT</fpa:Nazione>
                </fpa:Sede>
            </fpa:CessionarioCommittente>
        </md:Extensions>
        <md:Company>Destinatario_Fatturazione</md:Company>
        <md:EmailAddress>[email protected]</md:EmailAddress>
        <md:TelephoneNumber>telefono_fatture</md:TelephoneNumber>
    </md:ContactPerson>

Inside spid-sp-test/src/spid_sp_test/metadata_private.py there is the check that validate the EmailAddress as child of Extensions as reported into my test run:

INFO:spid_sp_test.metadata:SpidSpMetadataCheckExtra.test_extentions_public
ERROR:spid_sp_test.metadata:The //ContactPerson/Extensions/CessionarioCommittente/EmailAddress element MUST be present

This is not correct like reported into the documentation.

for private service provider there is:

INFO:spid_sp_test.metadata:SpidSpMetadataCheckExtra.test_Contacts_PubPriv
ERROR:spid_sp_test.metadata:Only one Extensions element inside ContactPerson element MUST be present

but probably, having two nodes ContactPerson (other and billing), this test count two times the Extensions and this is not correct.

HTML report

Actually report have a json format, there would be the need to have also HTML

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.