@@ -42,7 +42,7 @@ def get_token_from_request(request):
4242
4343
4444def ensure_slashes (path : str ):
45- """Ensure that slashes are suroudning the passed path."""
45+ """Ensure that slashes are surrounding the passed path."""
4646 if not path .startswith ('/' ):
4747 path = f'/{ path } '
4848 if not path .endswith ('/' ):
@@ -59,6 +59,7 @@ def ensure_slashes(path: str):
5959
6060paths_ignore_handling = [
6161 '/api/' ,
62+ '/plugin/' ,
6263 reverse ('auth-check' ),
6364 settings .MEDIA_URL ,
6465 settings .STATIC_URL ,
@@ -68,7 +69,7 @@ def ensure_slashes(path: str):
6869paths_own_security = [
6970 '/api/' , # DRF handles API
7071 '/o/' , # oAuth2 library - has its own auth model
71- '/anymail/' , # Mails - wehbhooks etc
72+ '/anymail/' , # Mails - webhooks etc
7273 '/accounts/' , # allauth account management - has its own auth model
7374 '/assets/' , # Web assets - only used for testing, no security model needed
7475 ensure_slashes (
@@ -322,16 +323,16 @@ def process_request(self, request):
322323
323324 # treat the accessed scheme and host
324325 accessed_scheme = request ._current_scheme_host
325- referer = urlsplit (accessed_scheme )
326+ referrer = urlsplit (accessed_scheme )
326327
327328 site_url = urlsplit (settings .SITE_URL )
328329
329330 # Check if the accessed URL matches the SITE_URL setting
330331 site_url_match = (
331332 (
332333 # Exact match on domain
333- is_same_domain (referer .netloc , site_url .netloc )
334- and referer .scheme == site_url .scheme
334+ is_same_domain (referrer .netloc , site_url .netloc )
335+ and referrer .scheme == site_url .scheme
335336 )
336337 or (
337338 # Lax protocol match, accessed URL starts with SITE_URL
@@ -341,7 +342,7 @@ def process_request(self, request):
341342 or (
342343 # Lax protocol match, same domain
343344 settings .SITE_LAX_PROTOCOL_CHECK
344- and referer .hostname == site_url .hostname
345+ and referrer .hostname == site_url .hostname
345346 )
346347 )
347348
@@ -367,7 +368,7 @@ def process_request(self, request):
367368 trusted_origins_match = (
368369 # Matching domain found in allowed origins
369370 any (
370- is_same_domain (referer .netloc , host )
371+ is_same_domain (referrer .netloc , host )
371372 for host in [
372373 urlsplit (origin ).netloc .lstrip ('*' )
373374 for origin in settings .CSRF_TRUSTED_ORIGINS
@@ -377,7 +378,7 @@ def process_request(self, request):
377378 # Lax protocol match allowed
378379 settings .SITE_LAX_PROTOCOL_CHECK
379380 and any (
380- referer .hostname == urlsplit (origin ).hostname
381+ referrer .hostname == urlsplit (origin ).hostname
381382 for origin in settings .CSRF_TRUSTED_ORIGINS
382383 )
383384 )
0 commit comments