forked from rDrama/rDrama
reduce commit hash from 12 chars to 7
parent
71f4797027
commit
9e0a3fd6b9
|
@ -11,7 +11,6 @@ from files.routes.wrappers import *
|
||||||
from files.__main__ import app, cache, limiter
|
from files.__main__ import app, cache, limiter
|
||||||
|
|
||||||
def git_head():
|
def git_head():
|
||||||
short_len = 12
|
|
||||||
# Note: doing zero sanitization. Git branch names are extremely permissive.
|
# Note: doing zero sanitization. Git branch names are extremely permissive.
|
||||||
# However, they forbid '..', so I don't see an obvious dir traversal attack.
|
# However, they forbid '..', so I don't see an obvious dir traversal attack.
|
||||||
# Also, a malicious branch name would mean someone already owned the server
|
# Also, a malicious branch name would mean someone already owned the server
|
||||||
|
@ -21,7 +20,7 @@ def git_head():
|
||||||
head_txt = head_f.read()
|
head_txt = head_f.read()
|
||||||
head_path = git_regex.match(head_txt).group(1)
|
head_path = git_regex.match(head_txt).group(1)
|
||||||
with open('.git/' + head_path, encoding='utf_8') as ref_f:
|
with open('.git/' + head_path, encoding='utf_8') as ref_f:
|
||||||
gitref = ref_f.read()[0:short_len]
|
gitref = ref_f.read()[:7]
|
||||||
except:
|
except:
|
||||||
return '<unable to read>', ''
|
return '<unable to read>', ''
|
||||||
return (gitref, head_txt)
|
return (gitref, head_txt)
|
||||||
|
|
Loading…
Reference in New Issue