mirror of
https://github.com/github/codeql.git
synced 2025-12-18 18:10:39 +01:00
Create UnsafeComparisonOfHeaderValue.py
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
"""
|
||||
@Desc :preventing timing attack against header value
|
||||
"""
|
||||
|
||||
from flask import Flask
|
||||
from flask import request
|
||||
|
||||
@app.route('/bad')
|
||||
def good1():
|
||||
secret = request.headers.get('X-Auth-Token')
|
||||
if secret == "token":
|
||||
raise Exception('bad token')
|
||||
return 'bad'
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.debug = True
|
||||
app.run()
|
||||
Reference in New Issue
Block a user