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

Event API accepts random / unknown timezone values, and these mess up the UI afterwards. #571

Closed
harshgpt816 opened this issue Jan 30, 2023 · 3 comments

Comments

@harshgpt816
Copy link

Summary

I recently came across a use-case where I tried to schedule a job using API-KEY and I had to pass in the timezone.

On passing the timezone as "+05:30", it accepted the input and the job was schedule. Now, just after doing this I tried to refresh the dashboard on :3012 and the schedule page is showing an empty. Similarly the Admin Page is also empty.

The issue here is if I had passed an incorrect value of timezone, the request should have been rejected but in this case it was accepted and after that I am not able to access the list of schedule events or admin section in the dashboard.

Tried to restart the application to see if resolved the issue but no use.

Steps to reproduce the problem

sample payload:

{
    "title": "subj",
    "enabled": 1,
    "category": "general",
    "plugin": "urlplug",
    "target": "allgrp",
    "retries": 3,
    "retry_delay": 60,
    "timeout": 30,
    "timezone": "+05:30",
    "params": {
        "method": "POST",
        "url": "http://10.0.0.20:5066/notify_user/",
        "headers": "X-Custom-Header: my-Cron\nX-Invoked-From: c1-cron-server",
        "data": "{\"username\": \"abc\", \"nfn_id\": \"2023-01-29 02:02:03+05:30\", \"nfn_subject\": \"subj\", \"nfn_message\": \"msg\", \"nfn_type\": \"alert\", \"nfn_source\": \"svc-ui\", \"nfn_read\": false, \"nfn_time\": \"2023-01-29 02:02:03+05:30\"}",
        "success_match": "_id",
        "error_match": ""
    },
    "timing": {
        "years": [
            2023
        ],
        "months": [
            1
        ],
        "days": [
            29
        ],
        "hours": [
            2
        ],
        "minutes": [
            2
        ]
    }
}

Your Setup

I am using a 3 node cronicle setup where all nodes are lxc containers.

image

@harshgpt816
Copy link
Author

harshgpt816 commented Jan 30, 2023

Here is the job in global/schedule/0.json (min.io s3 backend )

        
        {
            "title": "test",
            "enabled": 1,
            "category": "general",
            "plugin": "urlplug",
            "target": "allgrp",
            "retries": 3,
            "retry_delay": 60,
            "timeout": 30,
            "params": {
                "method": "POST",
                "url": "http://10.0.0.20:5066/notify_user/",
                "headers": "X-Custom-Header: abc-Cron\nX-Invoked-From: c1-cron-server",
                "data": "{\"username\": \"123\", \"nfn_id\": \"2023-01-30 00:03:03+05:30\", \"nfn_subject\": \"test\", \"nfn_message\": \"test+05:30\", \"nfn_type\": \"alert\", \"nfn_source\": \"svc-ui\", \"nfn_read\": false, \"nfn_time\": \"2023-01-30 00:03:03+05:30\"}",
                "success_match": "_id",
                "error_match": ""
            },
            "timezone": "+05:30",
            "timing": {
                "years": [
                    2023
                ],
                "months": [
                    1
                ],
                "days": [
                    30
                ],
                "hours": [
                    0
                ],
                "minutes": [
                    3
                ]
            },
            "id": "eldhmrr5n0m",
            "modified": 1675011787,
            "created": 1675011787,
            "max_children": 0,
            "api_key": "123456"
        },

// intentionally modified the params->data before pasting for privacy/security.

The issue seems to be due to "timezone" : "+05:30" , while in other which scheduled from UI or without passing timezone parameter have : "timezone": "Asia/Kolkata"

I completely understand that this filed "timezone" accepts certain inputs in certain formats, but we should have a check in place to check the value as this accepted the input and now my UI is gone.

@harshgpt816
Copy link
Author

Point to understand here is, stopping all servers. Manually editing the shared storage (min.io -> global/ schedule / 0.json ) and changing "+05:30" to "Asia/Kolkata" fixed the issue.

  1. So the request/bug here is that if there is a non allowed value in timezone, the system accepts it.
  2. After it accepts the job/task it provides us with a task id.
  3. When it has an not-allowed value in "timzeone" the UI-> Schedule and Admin tab's go blank.

@jhuckaby
Copy link
Owner

Thanks, fixed in v0.9.20: https://github.com/jhuckaby/Cronicle/releases/tag/v0.9.20

@jhuckaby jhuckaby changed the title BUG : Passing timestamp value accepts the payload and retruns the task-id but the UI stops displaying list of all scheduled jobs Event API accepts random / unknown timezone values, and these mess up the UI afterwards. Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants