telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://fiware-orion.rtfd.io/
GNU Affero General Public License v3.0
212 stars 264 forks source link

Cope with not id compliant information in the NGSIv2 retrieve operations #1733

Closed fgalan closed 1 year ago

fgalan commented 8 years ago

Edited issue text (30/11/2016):

Orion restrict id fields (in NGSIv2 and NGSIv1 with -strictNgsiv1Ids) at the input requests. However, it could happen that some field exist in DB with an invalid id due to:

The are 3 strategies to cope with this situation:


Original issue text:

(Spin-off of #1601)

Orion restrict id fields (in NGSIv2 and NGSIv1 with -strictNgsiv1Ids) at the input requests. However, it could happen that some field exist in DB with an invalid id due to it came from an older Orion version, Orion is running without -strictNgsiv1Ids and the entity was created using NGISv1 but retrieved using NGSIv2, etc.

Thus, we need to apply some "neutralization" strategy in NGSIv2 and NGSIv1 with -strictNgsiv1Ids for these cases. In particular:

Currently, we are applying a similar procedure to neutralize forbidden characters ("<", etc.) but I'm not sure if it is directly applicable here (that procedure process all the output, while here we have to be selective and neutralize only on id fields).

Efort: 2 man day

fgalan commented 8 years ago

Additional "rule", taking into account https://github.com/telefonicaid/fiware-orion/issues/1836:

(In some sense, PR https://github.com/telefonicaid/fiware-orion/pull/1835 is addresing that for entity/attribute/metadata types, but entity id and attribute/metadata name should be also taken into account).

kzangeli commented 7 years ago

It seems to me that what we need here is a migration script, not part of the broker implementation.

If done inside the broker, imagine we have an entity with Id you&me in mongo (& is a forbidden char, right?). We find it and returns it with id you_me but in mongo it keeps having the id you&me ... I find this pretty strange. I think the db should be migrated and no change be made to the broker. Probably not possible, but if the GET is done with you&me and we return an entity with you_me ... that would be almost crazy ...

fgalan commented 7 years ago

It cannot be solved with a migration script as the problem can happen in runtime. Consider the following example:

kzangeli commented 7 years ago

That is TRUE. Didn't think about that :-). Pity. So what to do? An entity with id you&me enters via APIv1, and we store it exactly like that in the database. Then a GET /v2/entities will receive the entity but with ID you_me. A little sad but OK I guess. Documentation necessary, of course. Perhaps we should even add an HTTP header to the response:

X-FIWARE-WARNING: Entity Ids modified
fgalan commented 1 year ago

strictNgsiv1Ids is deprecated functionality (see https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/deprecated.md) so, according to this rule

Bugs or issues related with deprecated features and not affecting any other feature are not addressed (they are closed in github.com as soon as they are spotted).

this issue is going to be closed.