mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-05 22:34:29 +01:00
Bypass csrf plugins (#597)
* Add bypass_csrf_protection decorator * Add beta notice * Add test_bypass_csrf_protection
This commit is contained in:
@@ -125,6 +125,19 @@ def get_user_page_menu_bar():
|
||||
return db_pages() + USER_PAGE_MENU_BAR
|
||||
|
||||
|
||||
def bypass_csrf_protection(f):
|
||||
"""
|
||||
Decorator that allows a route to bypass the need for a CSRF nonce on POST requests.
|
||||
|
||||
This should be considered beta and may change in future versions.
|
||||
|
||||
:param f: A function that needs to bypass CSRF protection
|
||||
:return: Returns a function with the _bypass_csrf attribute set which tells CTFd to not require CSRF protection.
|
||||
"""
|
||||
f._bypass_csrf = True
|
||||
return f
|
||||
|
||||
|
||||
def init_plugins(app):
|
||||
"""
|
||||
Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd
|
||||
|
||||
Reference in New Issue
Block a user