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

Unix timestamps after Sep 13 2020 are rejected as graph start/end arguments #3245

Closed
nuno-silva opened this issue Feb 9, 2020 · 7 comments
Closed
Assignees
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@nuno-silva
Copy link
Contributor

Describe the bug

The graph_start and graph_end request variables in graph_image.php only accept values less than 1600000000, which is Sun Sep 13 12:26:40 2020 in UTC (just 7 months from now!).

Note: at least graph_json.php, graph_xport.php and remote_agent.php are also affected.

To Reproduce
Steps to reproduce the behaviour:

  1. Obtain the ID of any graph.
  2. Open http://host.example.com/cacti/graph_image.php?local_graph_id=123&graph_end=1600000000&disable_cache=true.
  3. Bug: graph will not display the desired timespan and will instead ignore the graph_end variable.
  4. Repeat step 2 using 1599999999 if you wanna see it working, or just look at my screenshots.

Expected behavior
The example URL should display a timespan ranging from <today> until Sep 13 2020.

Screenshots

  • graph_image.php using graph_end=1599999999

1599999999

  • graph_image.php using graph_end=1600000000

1600000000

Desktop:
N/A

Smartphone:
N/A

Additional context
Relevant lines of code:

cacti/graph_image.php

Lines 82 to 90 in bb619ef

/* override: graph start time (unix time) */
if (!isempty_request_var('graph_start') && get_request_var('graph_start') < 1600000000) {
$graph_data_array['graph_start'] = get_request_var('graph_start');
}
/* override: graph end time (unix time) */
if (!isempty_request_var('graph_end') && get_request_var('graph_end') < 1600000000) {
$graph_data_array['graph_end'] = get_request_var('graph_end');
}

My suggestion is to compare these timestamps with something like now + 1 year instead of an hard-coded one. I don't mind preparing a pull request to fix this after further discussion about a solution.

@netniV netniV changed the title Hard-coded Unix timestamps make graph_image.php reject dates after Sep 13 2020 Unix timestamps after Sep 13 2020 are rejected as graph start/end arguments Feb 22, 2020
@netniV netniV self-assigned this Feb 22, 2020
@netniV netniV added bug Undesired behaviour resolved A fixed issue labels Feb 22, 2020
@netniV netniV added this to the 1.2.10 milestone Feb 22, 2020
@netniV netniV closed this as completed Feb 22, 2020
@netniV
Copy link
Member

netniV commented Feb 22, 2020

Should now be resolved, thanks!

@nuno-silva
Copy link
Contributor Author

Thank you for the fix, but you just moved the problem 16 years into the future 😛

@netniV
Copy link
Member

netniV commented Feb 22, 2020

I did, well spotted 👍

If you're still using this version of the software then, I'd worry 😱

@nuno-silva
Copy link
Contributor Author

Well, I'd worry, too, but my point is that someone will have to deal with this again in the future before the 16 years, no matter the version 😛

@netniV
Copy link
Member

netniV commented Feb 22, 2020

It does, but by then we will hopefully be all on 64-bit so we can then go above the 32-bit barrier :)

@paulgevers
Copy link
Contributor

@netniV I guess this issue is present in (much) older versions of Cacti. Do you happen to know when it was introduced? I probably need to fix Cacti in the stable and oldstable releases as well as let the Ubuntu people know about it.

@TheWitness
Copy link
Member

This setting goes back to at least 0.8.7. So, anything after that has this clipping boundary to future times.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

4 participants