Skip to content

Commit de5f7c7

Browse files
authored
Merge pull request #43 from Enapter/security-fix-hardware-id-randomness-9181080693173774899
🔒 [security] Fix insecure randomness for Hardware ID
2 parents c311b04 + bc24f81 commit de5f7c7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/enapter/http/api/devices/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import random
1+
import secrets
22
import time
33
from typing import AsyncGenerator
44

@@ -161,4 +161,4 @@ def random_device_name(device_type: DeviceType) -> str:
161161

162162

163163
def random_hardware_id() -> str:
164-
return "V" + "".join(f"{b:02X}" for b in random.randbytes(16))
164+
return "V" + secrets.token_hex(16).upper()

0 commit comments

Comments
 (0)