Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security edits and more #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions good/libuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ def login(username, password, **kwargs):


def user_create(username, password=None):

conn = sqlite3.connect('db_users.sqlite')
conn.set_trace_callback(print)
conn.row_factory = sqlite3.Row
c = conn.cursor()
c.execute("INSERT INTO users (username, password, salt, failures, mfa_enabled, mfa_secret) VALUES ('%s', '%s', '%s', '%d', '%d', '%s')" %(username, '', '', 0, 0, ''))

# Используем placeholders для безопасного выполнения запроса
query = """
INSERT INTO users (username, password, salt, failures, mfa_enabled, mfa_secret)
VALUES (?, ?, ?, ?, ?, ?)
"""
c.execute(query, (username, '', '', 0, 0, ''))
conn.commit()

if password:
Expand Down
2 changes: 1 addition & 1 deletion good/vulpy-ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def do_home():
def before_request():
g.session = libsession.load(request)

app.run(debug=True, host='127.0.1.1', ssl_context=('/tmp/acme.cert', '/tmp/acme.key'))
app.run(debug=True, host='127.0.0.1', ssl_context=('/tmp/acme.cert', '/tmp/acme.key'))
2 changes: 1 addition & 1 deletion good/vulpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ def add_csp_headers(response):
response.headers['Content-Security-Policy'] = csp
return response

app.run(debug=True, host='127.0.1.1', port=5001, extra_files='csp.txt')
app.run(debug=True, host='127.0.0.1', port=5001, extra_files='csp.txt')