Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in POST v2/op/update forbidden chars are allowed in the "id" field #2661

Closed
iariasleon opened this issue Nov 14, 2016 · 2 comments
Closed

in POST v2/op/update forbidden chars are allowed in the "id" field #2661

iariasleon opened this issue Nov 14, 2016 · 2 comments

Comments

@iariasleon
Copy link
Contributor

iariasleon commented Nov 14, 2016

in POST v2/op/update forbidden chars are allowed in the "id" field.See similar issue: #2666.

Dataset used

      | entities_id |
      |-------------|
      | house<flat> |
      | house=flat  |
      | house"flat" |
      | house'flat' |
      | house;flat  |
      | house(flat) |
      | house_?     |
      | house_&     |
      | house_/     |
      | house_#     |

Update batch operation request

url: POST http://localhost:1026/v2/op/update
headers:
    Content-Type: application/json
    Fiware-Service: test_op_update_entities_id_error
    Fiware-ServicePath: /test
payload: {"entities": [{"type": "house", "temperature": {"type": "celsius", "value": "4", "metadata": {"alarm": {"type": "hot", "value": "warning"}}}, "id": "house<flat>"}], "actionType": "APPEND"}

Update batch operation response

http code: 204 - No Content
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: 78aaccc8-aa4b-11e6-a1c4-005056a20feb
   Date: Mon, 14 Nov 2016 09:19:40 GMT
payload:

Expected response

http code: 400 - Bad Request
{"error":"BadRequest","description":"Invalid characters in entity id"}

docs in mongo

`{ "_id" : { "id" : "house<flat>", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house=flat", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house\"flat\"", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house'flat'", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house;flat", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house(flat)", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house_?", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house_&", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house_/", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "house_#", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
{ "_id" : { "id" : "my house", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479115180, "modDate" : 1479115180, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479115180, "modDate" : 1479115180 }
@fgalan
Copy link
Member

fgalan commented Nov 15, 2016

Fixed by PR #2679.

@iariasleon
Copy link
Contributor Author

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants