chore: replace pseudo-random generators with secrets module (#20616)

This commit is contained in:
Bowen Liang
2025-06-06 10:48:28 +08:00
committed by GitHub
parent 4f0c9fdf2b
commit c1a13fa553
8 changed files with 17 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
import json
import logging
import random
import re
import secrets
import string
import subprocess
import time
@@ -176,7 +176,7 @@ def generate_string(n):
letters_digits = string.ascii_letters + string.digits
result = ""
for i in range(n):
result += random.choice(letters_digits)
result += secrets.choice(letters_digits)
return result