shorten random string for secret value (#3263)

This commit is contained in:
LawyZheng
2025-08-22 01:23:26 +08:00
committed by GitHub
parent 38e45e2aba
commit 988416829f
4 changed files with 24 additions and 26 deletions

11
skyvern/utils/strings.py Normal file
View File

@@ -0,0 +1,11 @@
import os
import random
import string
RANDOM_STRING_POOL = string.ascii_letters + string.digits
def generate_random_string(length: int = 5) -> str:
# Use the os.urandom(16) as the seed
random.seed(os.urandom(16))
return "".join(random.choices(RANDOM_STRING_POOL, k=length))