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.
- {graphql_http-2.0.5 → graphql_http-2.0.6}/PKG-INFO +1 -1
- graphql_http-2.0.6/VERSION +1 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/server.py +19 -4
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/PKG-INFO +1 -1
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_auth.py +41 -0
- graphql_http-2.0.5/VERSION +0 -1
- {graphql_http-2.0.5 → graphql_http-2.0.6}/.coverage +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/.github/workflows/python-package.yml +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/.gitignore +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/LICENSE +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/README.md +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/README.md +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/advanced_server.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/auth_server.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/basic_server.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/examples/graphql_api_server.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/__init__.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/error.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/graphiql/index.html +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http/helpers.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/SOURCES.txt +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/dependency_links.txt +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/requires.txt +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/graphql_http.egg-info/top_level.txt +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/pyproject.toml +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/setup.cfg +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/test_server.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/__init__.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/app.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/app_federation.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/conftest.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_cors.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_federation.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_graphql_api.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/tests/test_server.py +0 -0
- {graphql_http-2.0.5 → graphql_http-2.0.6}/uv.lock +0 -0
|
@@ -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.
|
|
512
|
+
if self.in_operation:
|
|
513
|
+
self.depth += 1
|
|
500
514
|
|
|
501
515
|
def leave_selection_set(self, node, *_):
|
|
502
|
-
self.
|
|
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
|
|
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())
|
|
@@ -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
|
graphql_http-2.0.5/VERSION
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|