Skip to content

Timestamp on generated reports are wrong #8591

@Dramelac

Description

@Dramelac

Steps to Reproduce

  1. Self host your prowler and deploy every container (don't stop or restart the worker container)
  2. Create a cloud provider with scheduled scan
  3. Wait few days (without restarting the worker container) for multiple output report to be generated
  4. Every report will have their timestamp to the date of container start/first scan (so without container restart, every report will be generated to the same day)

Expected behavior

Every report should have the TIMESTAMP date of the date of generation/scan and not be limited to the date of container start / first scan.

Actual Result with Screenshots or Logs

I've found the root cause here:

timestamp = datetime.today()
timestamp_utc = datetime.now(timezone.utc).replace(tzinfo=timezone.utc)

Those definition of timestamp and timestamp_utc are static. The value will be set during first execution and never updated..
They must be changed to a function to return a dynamic response of the actual current date.

Example of generated report with the wrong date:
Image
In here, my first scan was on Aug 18 but my lasted scan on Aug 27 don't have the correct date and still show the Aug 18 timestamp.

How did you install Prowler?

Docker (docker pull toniblyx/prowler)

Environment Resource

Self-hosted docker container

OS used

Linux

Prowler version

v5.10.2

Pip version

N/A

Context

No response

Metadata

Metadata

Assignees

Labels

bugseverity/mediumResults in some unexpected or undesired behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions