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/subscriptions, using "notification http url" accepts url malfomed, returning 201 Created #2009

Closed
iariasleon opened this issue Apr 7, 2016 · 7 comments · Fixed by #2866
Assignees
Milestone

Comments

@iariasleon
Copy link
Contributor

iariasleon commented Apr 7, 2016

in POST v2/subscriptions, using notification callback accepts url malfomed

Dataset

      | url                        |
      |----------------------------|
      | http://localhost:900000    |
      | http://localhost:dsfsdf    |
      | http://localhost\my_path   |
      | http://e34.56.45.34        |
      | http://34,56.45.34         |
      | http://34.56.45.34;3454    |
      | http://34.56:3454          |
      | http://.                   |
      | http://..                  |
      | http://../                 |
      | http://?                   |
      | http://??/                 |
      | http://#                   |
      | http://##/                 |
      | http://foo.bar/foo(bar)baz |
      | http://-error-.invalid/    |
      | http://a.b--c.de/          |
      | http://-a.b.co             |
      | http://a.b-.co             |
      | http://0.0.0.0             |
      | http://1.1.1.1.1           |
      | http://3441.2344.1231.1123 |
      | http://123.123.123         |
      | http://3628126748          |
      | http://.www.foo.bar/       |
      | http://www.foo.bar./       |
      | http://.www.foo.bar./      |

subscription request

http code: 201
date: Thu, 07 Apr 2016 16:11:16 GMT
connection: Keep-Alive
content-length: 0
location: /v2/subscriptions/570686a3ee5e5afde9131ba5

expected response

http code: 400
{"error":"BadRequest","description":"Invalid URL in notification callback"}
@fortizc
Copy link
Contributor

fortizc commented Apr 8, 2016

I check this when I develop the WS support. If I use "ws://" Orion response me with a "Invalid URI" message, then I had to add some code in order to use "ws://" first here 5932dc2 and then improved here ea76cbb

@iariasleon iariasleon changed the title in POST v2/subscriptions, using notification callback accepts url malfomed in POST v2/subscriptions, using "notification http url" accepts url malfomed, returning 201 Created Apr 27, 2016
@iariasleon
Copy link
Contributor Author

Re-tested in the CB version. It issue still fails and returns 201-Created

  "version" : "1.2.0-next",
  "git_hash" : "d81dcf28e

@iariasleon
Copy link
Contributor Author

Re-tested with CB version:

  "version" : "1.3.0-next"
  "git_hash" : "b7f1fb9f7c8918deb0faa298b8370a0d1d132d8f"

All cases included in the Dataset continue to fail, they are returned 201-Created http code and the subscription are created. Except the http://foo.bar/foo(bar)baz case that returns 400-Bad Request but the error description is: forbidden characters in http field /url/.

It would be useful to use a regular expression to accept these urls (http and httpCustom)

@iariasleon
Copy link
Contributor Author

Re-tested with CB version. It issue still fails and returns 201-Created:

  "version" : "1.6.0-next",
  "git_hash" : "e8a4ced4a17adfce9317064a28be1f1840a0ed82"

Except in these two cases, that return a 400 - Bad Request an this desciption error "forbidden characters in http field /url/" correctly.

      | http://34.56.45.34;3454    |
      | http://foo.bar/foo(bar)baz |

Failed Dataset

      | url                        |
      |----------------------------|
      | http://localhost:900000    |
      | http://localhost:dsfsdf    |
      | http://localhost\my_path   |
      | http://e34.56.45.34        |
      | http://34,56.45.34         |
      | http://34.56:3454          |
      | http://.                   |
      | http://..                  |
      | http://../                 |
      | http://?                   |
      | http://??/                 |
      | http://#                   |
      | http://##/                 |
      | http://-error-.invalid/    |
      | http://a.b--c.de/          |
      | http://-a.b.co             |
      | http://a.b-.co             |
      | http://0.0.0.0             |
      | http://1.1.1.1.1           |
      | http://3441.2344.1231.1123 |
      | http://123.123.123         |
      | http://3628126748          |
      | http://.www.foo.bar/       |
      | http://www.foo.bar./       |
      | http://.www.foo.bar./      |

mongo doc example (they are 25 docs)

{ "_id" : ObjectId("5881f3c5d5cc581e38b1f951"), "expiration" : NumberLong(1459864800), "reference" : "http://localhost:900000", "custom" : false, "throttling" : NumberLong(0), "servicePath" : "/test", "status" : "active", "entities" : [ { "id" : ".*", "isPattern" : "true" } ], "attrs" : [ "temperature" ], "metadata" : [ ], "blacklist" : false, "conditions" : [ "temperature" ], "expression" : { "q" : "", "mq" : "", "geometry" : "", "coords" : "", "georel" : "" }, "format" : "normalized" }

@fgalan
Copy link
Member

fgalan commented Jan 30, 2017

Fixed by PR #2855. Please @iariasleon re-check.

Take into account that some of the examples you use (http://1.1.1.1.1) correspond actually to valid URLs when the string is interpreted as hostname and not ip.

@iariasleon
Copy link
Contributor Author

Re-tested and only these tests are failing:

      | http://-error-.invalid/                      |
      | http://-a.b.co                               |
      | http://a.b-.co                               |
      ...
      | https://localhost123456789012345678901234567890123456789012345678901234567890.my:1234                                                                                                                                                                                            |  

And about the reference used:

  • "Labels such as 2600 and 3abc may be used in hostnames, but -hi-, _hi_ and *h*i are invalid."
  • " Each label must be between 1 and 63 characters long and the entire hostname (including the delimiting dots but not a trailing dot) has a maximum of 253 ASCII characters"

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

Successfully merging a pull request may close this issue.

4 participants