mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-01 20:41:22 +01:00
Replance python ran lib to secrets
Secrets is included in python 3.6, so just import and use it Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
parent
b0b63fdeae
commit
6c01049d94
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import string
|
import string
|
||||||
import random
|
import secrets
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from g import DEFAULT_UID, DEFAULT_GID
|
from g import DEFAULT_UID, DEFAULT_GID
|
||||||
@ -76,7 +76,7 @@ def validate_crt_subj(dirty_subj):
|
|||||||
|
|
||||||
|
|
||||||
def generate_random_string(length):
|
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:
|
def prepare_dir(root: str, *args, **kwargs) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user