Skip to content

Commit ad7b8a9

Browse files
committed
Fixes #7226: Exempt GraphQL API requests from CSRF inspection
1 parent a226f06 commit ad7b8a9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/release-notes/version-3.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# NetBox v3.0
22

3+
## v3.0.3 (FUTURE)
4+
5+
### Bug Fixes
6+
7+
* [#7226](https://github.com/netbox-community/netbox/issues/7226) - Exempt GraphQL API requests from CSRF inspection
8+
9+
---
10+
311
## v3.0.2 (2021-09-08)
412

513
### Bug Fixes

netbox/netbox/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django.conf import settings
22
from django.conf.urls import include
33
from django.urls import path, re_path
4+
from django.views.decorators.csrf import csrf_exempt
45
from django.views.static import serve
56
from drf_yasg import openapi
67
from drf_yasg.views import get_schema_view
@@ -63,7 +64,7 @@
6364
re_path(r'^api/swagger(?P<format>.json|.yaml)$', schema_view.without_ui(), name='schema_swagger'),
6465

6566
# GraphQL
66-
path('graphql/', GraphQLView.as_view(graphiql=True, schema=schema), name='graphql'),
67+
path('graphql/', csrf_exempt(GraphQLView.as_view(graphiql=True, schema=schema)), name='graphql'),
6768

6869
# Serving static media in Django to pipe it through LoginRequiredMiddleware
6970
path('media/<path:path>', serve, {'document_root': settings.MEDIA_ROOT}),

0 commit comments

Comments
 (0)