Merge pull request #9683 from ninjadq/upgrade_python_rand_gen

Replance python ran lib to secrets
This commit is contained in:
Daniel Jiang 2019-10-31 21:51:38 +08:00 committed by GitHub
commit 02dab35a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import os
import string
import random
import secrets
from pathlib import Path
from g import DEFAULT_UID, DEFAULT_GID
@ -76,7 +76,7 @@ def validate_crt_subj(dirty_subj):
def generate_random_string(length):
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))
return ''.join(secrets.choice(string.ascii_letters + string.digits) for _ in range(length))
def prepare_dir(root: str, *args, **kwargs) -> str: