mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00: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:
parent
aaddccfdb1
commit
9079ec459c
1 changed files with 2 additions and 2 deletions
|
@ -26,7 +26,7 @@ if term:
|
|||
os.environ['TERM'] = term
|
||||
|
||||
import subprocess
|
||||
import re, socket, cgi, select, time, glob, random, string
|
||||
import re, socket, cgi, select, time, glob, random, string, binascii
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
|
@ -859,7 +859,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
|
||||
|
|
Loading…
Reference in a new issue