Skip to content

Commit 974e8cc

Browse files
author
Shamal Faily
committed
Fix uncontrolled control input vulnerability
1 parent fb69a6c commit 974e8cc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

dockerLaTeX/LaTeXApi.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@
44

55
app = Flask(__name__)
66

7+
allowedCommands = set(['docbook2html','docbook2rtf','dblatex','pandoc'])
8+
79
@app.route('/latexApi', methods=['POST'])
810
def index():
911
try:
1012
dockBookCmd = request.values.get('docBookCmd')
13+
if not docBookCmd:
14+
abort(400)
15+
if (docBookCmd.split(' ')[0] not in allowedCommands):
16+
abort(400)
1117
os.system(dockBookCmd)
1218
return "Success"
13-
except:
19+
except Exception:
1420
abort(500)
1521

16-
1722
if __name__ == '__main__':
18-
app.run(host="0.0.0.0", debug=True)
23+
app.run(host="0.0.0.0")

0 commit comments

Comments
 (0)