Skip to content
This repository was archived by the owner on Jul 4, 2024. It is now read-only.

Conversation

@aegiap
Copy link
Contributor

@aegiap aegiap commented Sep 11, 2018

The GANDI public API has a more strict password validation since a couple of release. This change allow to be more compliant with the new validation. We have to be sure of the presence of one ponctuation item and a digit in the creation of the password.

Signed-off-by: aegiap aegiap@gandi.net

Signed-off-by: aegiap <aegiap@gandi.net>
@aegiap
Copy link
Contributor Author

aegiap commented Sep 11, 2018

cc @MoiTux and @grigouze

@coveralls
Copy link

Coverage Status

Coverage remained the same at ?% when pulling 4255ad3 on passw_compliance into 4b28d93 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at ?% when pulling 4255ad3 on passw_compliance into 4b28d93 on master.

Copy link

@grigouze grigouze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me

@MoiTux
Copy link
Contributor

MoiTux commented Sep 11, 2018

This won't be enough as no things guarantee that number will be here a not only lower or upper case

from  gandi.cli.core.utils.password import mkpassword

def is_acceptable(pwd):
    has_lower = False
    has_upper = False
    has_digit = False
    has_other = False
    for char in pwd:
        if char.islower():
            has_lower = True
        elif char.isupper():
            has_upper = True
        elif char.isdigit():
            has_digit = True
        else:
            has_other = True
    return all([has_lower, has_upper, has_digit, has_other])

test = []
for _ in range(10):
    i = 1
    while True:
        pwd = mkpassword(punctuation=1)
        if not is_acceptable(pwd):
            break
        i += 1
    test.append((i, pwd))

[(3, 'LfGenXx-DOQgQvWx'),
 (3, 'eBXXzp{WXUYRDTki'),
 (10, 'huDYZrQj;hfPtnxg'),
 (5, 'Pp<ZfZXQFFaaEFbv'),
 (2, 'uhXoAuWs-eOorYBo'),
 (2, 'uKgoVVx}CYDsjvcB'),
 (1, 'kSFyncCasZrxgNb#'),
 (7, 'vY(EenDTfTUWjnXH'),
 (31, 'dnpOBqqfnARC$NLD'),
 (15, 'WczZFbdsFdp&NPZR')]

Here my 7th generation failed at first try

@grigouze
Copy link

grigouze commented Sep 12, 2018

@MoiTux @aegiap

Maybe we can use https://pypi.org/project/StringGenerator/ ?

import strgen
StringGenerator('[\l\d]{16}').render()
u'QR1inYgRDVy9tMQ4'

@MoiTux
Copy link
Contributor

MoiTux commented Sep 15, 2018

@grigouze @aegiap
see #265 which will remove check/validate the password strength from the API but we might need/want to do it locally then

@aegiap aegiap closed this Sep 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants