capless / warrant

Python library for using AWS Cognito. With support for SRP.
Apache License 2.0
468 stars 192 forks source link

GNU extensions used in call to strftime break non-glibc systems #55

Closed aryounce closed 6 years ago

aryounce commented 6 years ago

This line contains a GNU extension in the format string passed to strftime (specifically the %-d part). This causes the timestamp variable to be an empty string on non-glibc systems (like the Alpine Linux Docker images, which use musl libc).

Removing the hyphen modifier from %-d should be painless on glibc and non-glibc systems alike. Stripping leading zeros does not appear to be required by RFC2616 or RFC822 (which seems to be the format used here). Could this possibly be removed for good?

https://github.com/capless/warrant/blob/3d6aa8c84841a1c7183f702ed7b4ad993c1ff37a/warrant/aws_srp.py#L170

armicron commented 6 years ago

Stripping of leading zero is required by AWS Cognito.

aryounce commented 6 years ago

That is unfortunate. Could %e (which inserts a space instead of zero padding) work in this instance or is Cognito also sensitive to whitespace?

armicron commented 6 years ago

I will check it on Oct 1, but I think it will not work.

armicron commented 6 years ago

%e causes an error

botocore.exceptions.ClientError: An error occurred (InvalidParameterException) when calling the RespondToAuthChallenge operation: TIMESTAMP format should be EEE MMM d HH:mm:ss z yyyy in english.

pvizeli commented 6 years ago

If there is any solution around? We have this problem too with alpine linux based Hass.io systems for Home-Assistant.

balloob commented 6 years ago

I introduced #75 which extracts the method to format the current time so that it is easily monkey patchable.