duo-labs / duo-labs/cloudmapper

timezone issue in iso_date

Open
#962 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.3k
Forks
836
PR merge metrics
No merged PRs in 30d

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`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.