-
Notifications
You must be signed in to change notification settings - Fork 265
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
expires
field in POST v2/subscriptions API should not allow the datetime before current time
#4541
Comments
Hi @fgalan , |
I think the current behaviour is correct, as long as the It would be weird than an user created a subscription with expiration date in the past but nothing in the Orion API (https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md) precludes that as far as I remember (please tell me otherwise). From my opinion, this issue should be closed, as it is expected behaviour. |
Yes. you are right. |
There is another observation I had: curl -v localhost:1026/v2/subscriptions -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
"description": "A subscription to get info about Room1",
"subject": {
"entities": [
{
"id": "Room1",
"type": "Room"
}
],
"condition": {
"attrs": [
"pressure"
]
}
},
"notification": {
"http": {
"url": "http://localhost:1028/accumulate"
},
"attrs": [
"pressure"
]
},
"expires": "2050-67-50T14:00:00.00Z"
}
EOF Other invalid values of
|
That one seems to be a buggy behaviour. Invalided dates should not be allowed in any place. What do you get when you do a GET /v2/subscriptions/{id} in the just created subscription with a wrong date in expiration? |
Example-1: Subscription curl -v localhost:1026/v2/subscriptions -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
"description": "A subscription to get info about Room1",
"subject": {
"entities": [
{
"id": "Room1",
"type": "Room"
}
],
"condition": {
"attrs": [
"pressure"
]
}
},
"notification": {
"http": {
"url": "http://localhost:1028/accumulate"
},
"attrs": [
"pressure"
]
},
"expires": "2010-43-57T32:00:00.00Z"
}
EOF GET API Response:
Example-2: Subscription curl -v localhost:1026/v2/subscriptions -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
"description": "A subscription to get info about Room1",
"subject": {
"entities": [
{
"id": "Room1",
"type": "Room"
}
],
"condition": {
"attrs": [
"pressure"
]
}
},
"notification": {
"http": {
"url": "http://localhost:1028/accumulate"
},
"attrs": [
"pressure"
]
},
"expires": "2022-53-67T32:66:13.00Z"
}
EOF GET API Response:
|
@fgalan Please provide your opinion on this. Thanks:) |
So
Something weird is happending... Orion should return a 400 Bad Request error when wrong dates are used in Maybe you could have a look and solve it in a PR, please? It should be easy... please have a look to parseContextAtribute.cpp and how parse8601Time() is used to check for valid dates. |
Thanks for the confirmation. |
After merging PR #4554 I understand this issue should be closed, shouldn't it? |
yes |
Closed as fixed in PR #4554 |
Bug description
I have run
POST v2/subscriptions
API with older datetime inexpires
field, and subscription created successfully (subscription should be created with olderexpires
datetime value):How to reproduce it
Steps to reproduce the behavior (as an example)
2010-01-01T14:00:00.00Z
:Expected behavior
subscription should not be created, and a clear message should be returned to user, something like "invalid/older
expires
field date value, Correct theexpires
datetime in your subscription"The text was updated successfully, but these errors were encountered: