Skip to content

Commit

Permalink
fix security warning: swap secrets for random when generating share IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
pjbedard committed Sep 12, 2024
1 parent 0cbfd2d commit 572b471
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/managers/SharesManager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import random
import secrets
import string
from threading import Lock
from sqlalchemy import select, insert, update, delete, func
Expand All @@ -9,7 +9,7 @@

def generate_share_id():
# SHARE_ID_REGEX = '[a-z]{3}-[a-z]{3}-[a-z]{3}'
return '-'.join(''.join(random.choices(string.ascii_lowercase, k=3)) for _ in range(3))
return '-'.join(''.join(secrets.choice(string.ascii_lowercase) for _ in range(3)) for _ in range(3))

class SharesManager:
_instance = None
Expand Down

0 comments on commit 572b471

Please sign in to comment.