Skip to content

timezone issue in iso_date #962

Description

Note the Network Visualization functionality (command prepare) is no longer maintained.

Please mention the following:

  • What command was run? -> python cloudmapper.py audit

  • Are you working out of a virtualenv environment, Docker, or something else? -> virtualenv

  • Which branch? -> main

Exception was:

Exception:
unconverted data remains: Z

Traceback (most recent call last):
 File "/tmp/airflow/cloudmapper/shared/audit.py", line 1195, in audit
   audit_users(findings, region)
 File "/tmp/airflow/cloudmapper/shared/audit.py", line 409, in audit_users
   user_age = days_between(collection_date, user["user_creation_time"])
 File "/tmp/airflow/cloudmapper/shared/common.py", line 348, in days_between
   d2 = iso_date(s2)
 File "/tmp/airflow/cloudmapper/shared/common.py", line 342, in iso_date
   return datetime.datetime.strptime(d.split("+")[0], time_format)
 File "/usr/local/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
   tt, fraction, gmtoff_fraction = _strptime(data_string, format)
 File "/usr/local/lib/python3.9/_strptime.py", line 352, in _strptime
   raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: Z

The reason seems to be that these commands

aws iam generate-credential-report 
aws iam get-credential-report

return data which have timestamps which end with Z instead of +00:00 - which are both valid values. And https://github.com/duo-labs/cloudmapper/blob/main/shared/common.py#L342 assumes that it ends with +00:00.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions