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

Timestamp format is invalid causing API requests to fail #320

Open
VDubber opened this issue Sep 30, 2024 · 0 comments
Open

Timestamp format is invalid causing API requests to fail #320

VDubber opened this issue Sep 30, 2024 · 0 comments
Labels
Cloud Guard Issue pertains to the Cloud Guard service

Comments

@VDubber
Copy link

VDubber commented Sep 30, 2024

Hello,

I have found an issue for how some Dates are being formatted. This bug is found in a common library function so I believe the impact to be significant.
I found this while trying to listProblems from the CloudGuard client. I was passing a JS Date for the timeFirstDetectedGreaterThanOrEqualTo parameter and receiving a 400 Invalid Date error.

This line here is the issue.

Consider the following:

let validDate = new Date('2024-08-28T08:15:34Z'); => Wed Aug 28 2024 02:15:34 GMT-0600 (Mountain Daylight Time)
let invalidString =formatDateToRFC3339(validDate); => 2024-08-28T2:15:34Z (notice that the hour is a single digit)
new Date(invalidString); => Invalid Date

Please consider using ("0" + date.getHours()).slice(-2) or something similar to make sure hours contains two digits.

@VDubber VDubber changed the title Timestamp format is invalid Timestamp format is invalid causing API requests to fail Oct 2, 2024
@richachugh11 richachugh11 added the Cloud Guard Issue pertains to the Cloud Guard service label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cloud Guard Issue pertains to the Cloud Guard service
Projects
None yet
Development

No branches or pull requests

2 participants