mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-23 04:51:16 -03:00
webconfig: fixes for token security
* Use 16-byte tokens * Use os.urandom (random.getrandbits shouldn't be used for security) * Convert to hex correctly
This commit is contained in:
committed by
David Adam
parent
78e2b7cc08
commit
3e2d68a059
@@ -17,7 +17,7 @@ else:
|
||||
from urllib.parse import parse_qs
|
||||
import webbrowser
|
||||
import subprocess
|
||||
import re, socket, os, sys, cgi, select, time, glob, random, string
|
||||
import re, socket, os, sys, cgi, select, time, glob, random, string, binascii
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
@@ -654,7 +654,7 @@ where = os.path.dirname(sys.argv[0])
|
||||
os.chdir(where)
|
||||
|
||||
# Generate a 16-byte random key as a hexadecimal string
|
||||
authkey = hex(random.getrandbits(16*4))[2:]
|
||||
authkey = binascii.b2a_hex(os.urandom(16))
|
||||
|
||||
# Try to find a suitable port
|
||||
PORT = 8000
|
||||
|
||||
Reference in New Issue
Block a user