graphql-http 2.0.5__tar.gz → 2.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {graphql_http-2.0.5 → graphql_http-2.0.6}/PKG-INFO +1 -1
  2. graphql_http-2.0.6/VERSION +1 -0
  3. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/server.py +19 -4
  4. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/PKG-INFO +1 -1
  5. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_auth.py +41 -0
  6. graphql_http-2.0.5/VERSION +0 -1
  7. {graphql_http-2.0.5 → graphql_http-2.0.6}/.coverage +0 -0
  8. {graphql_http-2.0.5 → graphql_http-2.0.6}/.github/workflows/python-package.yml +0 -0
  9. {graphql_http-2.0.5 → graphql_http-2.0.6}/.gitignore +0 -0
  10. {graphql_http-2.0.5 → graphql_http-2.0.6}/LICENSE +0 -0
  11. {graphql_http-2.0.5 → graphql_http-2.0.6}/README.md +0 -0
  12. {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/README.md +0 -0
  13. {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/advanced_server.py +0 -0
  14. {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/auth_server.py +0 -0
  15. {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/basic_server.py +0 -0
  16. {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/graphql_api_server.py +0 -0
  17. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/__init__.py +0 -0
  18. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/error.py +0 -0
  19. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/graphiql/index.html +0 -0
  20. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/helpers.py +0 -0
  21. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/SOURCES.txt +0 -0
  22. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/dependency_links.txt +0 -0
  23. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/requires.txt +0 -0
  24. {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/top_level.txt +0 -0
  25. {graphql_http-2.0.5 → graphql_http-2.0.6}/pyproject.toml +0 -0
  26. {graphql_http-2.0.5 → graphql_http-2.0.6}/setup.cfg +0 -0
  27. {graphql_http-2.0.5 → graphql_http-2.0.6}/test_server.py +0 -0
  28. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/__init__.py +0 -0
  29. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/app.py +0 -0
  30. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/app_federation.py +0 -0
  31. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/conftest.py +0 -0
  32. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_cors.py +0 -0
  33. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_federation.py +0 -0
  34. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_graphql_api.py +0 -0
  35. {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_server.py +0 -0
  36. {graphql_http-2.0.5 → graphql_http-2.0.6}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphql_http
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: HTTP Server for GraphQL.
5
5
  Author-email: Robert Parker <rob@parob.com>
6
6
  License: MIT
@@ -0,0 +1 @@
1
+ 2.0.6
@@ -494,16 +494,31 @@ class GraphQLHTTP:
494
494
  def __init__(self):
495
495
  super().__init__()
496
496
  self.depth = 0
497
+ self.in_operation = False
498
+
499
+ def enter_operation_definition(self, node, *_):
500
+ # We're now inside an operation (query/mutation/subscription)
501
+ self.in_operation = True
502
+
503
+ def leave_operation_definition(self, node, *_):
504
+ # Leaving the operation
505
+ self.in_operation = False
506
+
507
+ def enter_fragment_definition(self, node, *_):
508
+ # Skip fragment definitions - they're not part of the actual query execution
509
+ return False
497
510
 
498
511
  def enter_selection_set(self, node, *_):
499
- self.depth += 1
512
+ if self.in_operation:
513
+ self.depth += 1
500
514
 
501
515
  def leave_selection_set(self, node, *_):
502
- self.depth -= 1
516
+ if self.in_operation:
517
+ self.depth -= 1
503
518
 
504
519
  def enter_field(self, node: FieldNode, *_):
505
- # Only collect fields at depth 1 (root level fields)
506
- if self.depth == 1 and hasattr(node, 'name') and hasattr(node.name, 'value'):
520
+ # Only collect fields at depth 1 within actual operations
521
+ if self.in_operation and self.depth == 1 and hasattr(node, 'name') and hasattr(node.name, 'value'):
507
522
  root_field_names.add(node.name.value)
508
523
 
509
524
  visit(document, RootFieldCollector())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphql_http
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: HTTP Server for GraphQL.
5
5
  Author-email: Robert Parker <rob@parob.com>
6
6
  License: MIT
@@ -310,3 +310,44 @@ class TestGraphQLHTTPAuthentication:
310
310
  result = response.json()
311
311
  assert "errors" in result
312
312
  assert "Authorization header is missing" in result["errors"][0]["message"]
313
+
314
+ def test_full_introspection_query_with_auth_bypass(self, schema):
315
+ """Test that the standard full introspection query works with auth bypass.
316
+
317
+ This tests the large introspection query that GraphiQL and other tools use
318
+ to fetch the complete schema information.
319
+ """
320
+ from graphql import get_introspection_query
321
+
322
+ server = GraphQLHTTP(
323
+ schema=schema,
324
+ auth_enabled=True,
325
+ auth_bypass_during_introspection=True,
326
+ auth_jwks_uri="https://example.com/.well-known/jwks.json",
327
+ auth_issuer="https://example.com/",
328
+ auth_audience="test-audience"
329
+ )
330
+ client = server.client()
331
+
332
+ # Get the standard introspection query
333
+ introspection_query = get_introspection_query()
334
+
335
+ # This should work without authentication
336
+ response = client.post(
337
+ "/graphql",
338
+ json={"query": introspection_query}
339
+ )
340
+
341
+ assert response.status_code == 200
342
+ result = response.json()
343
+
344
+ # Should get valid introspection data, not an auth error
345
+ assert "errors" not in result or len(result["errors"]) == 0
346
+ assert "data" in result
347
+ assert "__schema" in result["data"]
348
+
349
+ # Verify we get expected introspection structure
350
+ schema_data = result["data"]["__schema"]
351
+ assert "queryType" in schema_data
352
+ assert "types" in schema_data
353
+ assert "directives" in schema_data
@@ -1 +0,0 @@
1
- 2.0.5
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes