Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Impedire il caricamento di due metadata SP con uguale entityID #205

Open
alranel opened this issue Dec 2, 2018 · 8 comments · Fixed by #279
Open

Impedire il caricamento di due metadata SP con uguale entityID #205

alranel opened this issue Dec 2, 2018 · 8 comments · Fixed by #279
Assignees
Labels
bug Something isn't working closing

Comments

@alranel
Copy link
Member

alranel commented Dec 2, 2018

Se si configurano due metadata SP con lo stesso entityID, l'accettazione della AuthnRequest restituisce un errore.

Bisogna impedire che l'utente possa confondersi, e quindi bisogna prevenire questa situazione restituendo un errore all'avvio del testenv.

@alranel alranel added the bug Something isn't working label Dec 2, 2018
@fmarco
Copy link
Member

fmarco commented Dec 4, 2018

@alranel l'errore è bloccante o solo informativo? Potremmo gestirlo come gli altri errori eventuali all'avvio dell'applicazione, ovvero:

  1. carichiamo il metadata corrispondente alla prima occorrenza valida dato un entity id X.
  2. le successive n occorrenze di metadata con entity id uguale ad X verranno scartate e l'applicazione ritornerà un errore di qualche tipo

Cosa ne pensi?

@fmarco fmarco self-assigned this Dec 10, 2018
@alranel
Copy link
Member Author

alranel commented Dec 21, 2018

Se possibile impedirei l'avviamento del testenv, che direi sia la cosa più semplice anche da implementare e il modo più immediato per far correggere il problema

@bfabio
Copy link
Member

bfabio commented Nov 25, 2019

@fmarco Are you still working on this? If not, do you mind if I do?

@fmarco
Copy link
Member

fmarco commented Nov 27, 2019

@bfabio Feel free to work on it 👍

@bfabio
Copy link
Member

bfabio commented Nov 27, 2019

Thanks @fmarco

bfabio added a commit to bfabio/spid-testenv2 that referenced this issue Dec 5, 2019
The SP metadata get loaded once at the start from all sources to
index the entities ids and where the come from.

Upon every request from an SP, the metadata of that SP gets reloaded
from the last known source: if it's not there anymore the server
tries to look in all known sources again.

Protip! Using:
```
metadata:
    local:
        - conf/*.xml
```

Allows to drop config files to the directory at runtime and have their
configuration picked up without restarting the server.

Other goodies:
* Invalid SP metadata are logged and discarded, but no longer prevent
  the rest of metadata from loading. (Fix italia#210)
* Duplicate entityIds are discarded with precedence given to local
  sources (local > db > remote) (Fix italia#205).
* Display the source of the SP metadata in the UI
bfabio added a commit to bfabio/spid-testenv2 that referenced this issue Dec 5, 2019
The SP metadata get loaded once at the start from all sources to
index the entities ids and where the come from.

Upon every request from an SP, the metadata of that SP gets reloaded
from the last known source: if it's not there anymore the server
tries to look in all known sources again.

Protip! Using:
```
metadata:
    local:
        - conf/*.xml
```

Allows to drop config files to the directory at runtime and have their
configuration picked up without restarting the server.

Other goodies:
* Invalid SP metadata are logged and discarded, but no longer prevent
  the rest of metadata from loading. (Fix italia#210)
* Duplicate entityIds are discarded with precedence given to local
  sources (local > db > remote) (Fix italia#205).
* Display the source of the SP metadata in the UI
bfabio added a commit to bfabio/spid-testenv2 that referenced this issue Dec 29, 2020
The SP metadata get loaded once at the start from all sources to
index the entities ids and where the come from.

Upon every request from an SP, the metadata of that SP gets reloaded
from the last known source: if it's not there anymore the server
tries to look in all known sources again.

Protip! Using:
```
metadata:
    local:
        - conf/*.xml
```

Allows to drop config files to the directory at runtime and have their
configuration picked up without restarting the server.

Other goodies:
* Invalid SP metadata are logged and discarded, but no longer prevent
  the rest of metadata from loading. (Fix italia#210)
* Duplicate entityIds are discarded with precedence given to local
  sources (local > db > remote) (Fix italia#205).
* Display the source of the SP metadata in the UI
bfabio added a commit to bfabio/spid-testenv2 that referenced this issue Jan 14, 2021
The SP metadata get loaded once at the start from all sources to
index the entities ids and where the come from.

Upon every request from an SP, the metadata of that SP gets reloaded
from the last known source: if it's not there anymore the server
tries to look in all known sources again.

Protip! Using:
```
metadata:
    local:
        - conf/*.xml
```

Allows to drop config files to the directory at runtime and have their
configuration picked up without restarting the server.

Other goodies:
* Invalid SP metadata are logged and discarded, but no longer prevent
  the rest of metadata from loading. (Fix italia#210)
* Duplicate entityIds are discarded with precedence given to local
  sources (local > db > remote) (Fix italia#205).
* Display the source of the SP metadata in the UI
@bfabio
Copy link
Member

bfabio commented Feb 17, 2021

Reopening after the revert in #320.

@bfabio bfabio reopened this Feb 17, 2021
@peppelinux
Copy link
Member

peppelinux commented Feb 17, 2021

qui

entity_id = Column(String, primary_key=True, nullable=False)

si potrebbe fare anche uno unique preventivo in caso di db
https://docs.sqlalchemy.org/en/14/core/constraints.html#unique-constraint

... nada, è già primary key!

Ma magari dato che ci siamo invece di body di tipo String facciamo di tipo Text
https://docs.sqlalchemy.org/en/13/core/type_basics.html#generic-types

@peppelinux
Copy link
Member

Complessivamente questo comportamento non è ad oggi riscontrabile quando spid-testenv2 carica i metadata da RDBMS, perché entityID è primarykey e quindi unique.

Per quanto riguarda i metadata da file o da locazione remota e considerando il comportamento di altri prodotti SP/IDP SAML2, vedi shibboleth, pysaml2 e altri, questo problema è abbastanza tipico.

I metadata crescono nel tempo e fare controlli di questo genere produrrebbe pericolosi rallentamenti della piattaforma.

Nel caso in cui i metadata crescessero sarebbe consigliabile adottare RDBMS o MDQ, con il primo otteniamo la certezza dell'unicità della chiave primaria, con il secondo la sicurezza del processo di batch di aggregazione.

metadata con entityID uguali producono che alla prima occorrenza riscontrata avviene il break del loop di ricerca, così è su tante altre piattaforme, la validazione basata su file andrebbe condotta da un operatore con una procedura totalmente out-of-band.

Di certo RDBMS e MDQ sono soluzioni generali e ineludibili quando le dimensioni della federazione crescono nel tempo

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working closing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants