- Update to v21.4 * This is a special release to help control introspection queries. This release adds a default check for introspection queries, to check that they are sensible. This feature is a backport of #3526 and #3527. This release also adds an optional maximum result nodes limit, which is a backport of #3525. * What's Changed + 21.x Backport PR 3526 and PR 3527 by @dondonz in #3529 + 21.x backport 3525 max result nodes by @dondonz in #3528 - Modify patch: * java8.patch + add some new occurrences OBS-URL: https://build.opensuse.org/request/show/1159820 OBS-URL: https://build.opensuse.org/package/show/Java:packages/graphql-java?expand=0&rev=8
180 lines
11 KiB
Diff
180 lines
11 KiB
Diff
diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/normalized/ExecutableNormalizedField.java graphql-java-21.0/src/main/java/graphql/normalized/ExecutableNormalizedField.java
|
|
--- graphql-java-21.0.orig/src/main/java/graphql/normalized/ExecutableNormalizedField.java 2023-09-01 13:45:52.666395044 +0200
|
|
+++ graphql-java-21.0/src/main/java/graphql/normalized/ExecutableNormalizedField.java 2023-09-01 14:07:53.265510599 +0200
|
|
@@ -16,6 +16,7 @@
|
|
import graphql.schema.GraphQLOutputType;
|
|
import graphql.schema.GraphQLSchema;
|
|
import graphql.schema.GraphQLUnionType;
|
|
+import graphql.schema.GraphQLUnmodifiedType;
|
|
import graphql.util.FpKit;
|
|
import graphql.util.MutableRef;
|
|
import org.jetbrains.annotations.NotNull;
|
|
@@ -187,7 +188,7 @@
|
|
}
|
|
|
|
public void forEachFieldDefinition(GraphQLSchema schema, Consumer<GraphQLFieldDefinition> consumer) {
|
|
- var fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName);
|
|
+ GraphQLFieldDefinition fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName);
|
|
if (fieldDefinition != null) {
|
|
consumer.accept(fieldDefinition);
|
|
return;
|
|
@@ -211,7 +212,7 @@
|
|
* Internally there are cases where we know it is safe to use this, so this exists.
|
|
*/
|
|
private GraphQLFieldDefinition getOneFieldDefinition(GraphQLSchema schema) {
|
|
- var fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName);
|
|
+ GraphQLFieldDefinition fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName);
|
|
if (fieldDefinition != null) {
|
|
return fieldDefinition;
|
|
}
|
|
@@ -512,14 +513,14 @@
|
|
private Set<GraphQLInterfaceType> getInterfacesCommonToAllOutputTypes(GraphQLSchema schema) {
|
|
// Shortcut for performance
|
|
if (objectTypeNames.size() == 1) {
|
|
- var fieldDef = getOneFieldDefinition(schema);
|
|
- var outputType = unwrapAll(fieldDef.getType());
|
|
+ GraphQLFieldDefinition fieldDef = getOneFieldDefinition(schema);
|
|
+ GraphQLUnmodifiedType outputType = unwrapAll(fieldDef.getType());
|
|
|
|
if (outputType instanceof GraphQLObjectType) {
|
|
return new LinkedHashSet<>((List) ((GraphQLObjectType) outputType).getInterfaces());
|
|
} else if (outputType instanceof GraphQLInterfaceType) {
|
|
- var result = new LinkedHashSet<>((List) ((GraphQLInterfaceType) outputType).getInterfaces());
|
|
- result.add(outputType);
|
|
+ Set<GraphQLInterfaceType> result = new LinkedHashSet<>((List) ((GraphQLInterfaceType) outputType).getInterfaces());
|
|
+ result.add((GraphQLInterfaceType) outputType);
|
|
return result;
|
|
} else {
|
|
return Collections.emptySet();
|
|
@@ -528,7 +529,7 @@
|
|
|
|
MutableRef<Set<GraphQLInterfaceType>> commonInterfaces = new MutableRef<>();
|
|
forEachFieldDefinition(schema, (fieldDef) -> {
|
|
- var outputType = unwrapAll(fieldDef.getType());
|
|
+ GraphQLUnmodifiedType outputType = unwrapAll(fieldDef.getType());
|
|
|
|
List<GraphQLInterfaceType> outputTypeInterfaces;
|
|
if (outputType instanceof GraphQLObjectType) {
|
|
diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java graphql-java-21.0/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java
|
|
--- graphql-java-21.0.orig/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java 2023-09-01 13:45:52.673061757 +0200
|
|
+++ graphql-java-21.0/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java 2023-09-01 14:18:28.283228972 +0200
|
|
@@ -1988,7 +1988,7 @@
|
|
*
|
|
* @see #getTraversalOrder(List)
|
|
*/
|
|
- private static final List<EditOperation.Operation> OPERATION_TRAVERSAL_ORDER = List.of(
|
|
+ private static final List<EditOperation.Operation> OPERATION_TRAVERSAL_ORDER = java.util.Arrays.asList(
|
|
EditOperation.Operation.CHANGE_VERTEX,
|
|
EditOperation.Operation.INSERT_VERTEX,
|
|
EditOperation.Operation.DELETE_VERTEX,
|
|
@@ -2002,7 +2002,7 @@
|
|
*
|
|
* @see #getTraversalOrder(List)
|
|
*/
|
|
- private static final List<String> TYPE_TRAVERSAL_ORDER = List.of(
|
|
+ private static final List<String> TYPE_TRAVERSAL_ORDER = java.util.Arrays.asList(
|
|
// These are all top level declarations
|
|
SchemaGraph.SCHEMA,
|
|
SchemaGraph.OBJECT,
|
|
diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java graphql-java-21.0/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java
|
|
--- graphql-java-21.0.orig/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java 2023-09-01 13:45:52.673061757 +0200
|
|
+++ graphql-java-21.0/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java 2023-09-01 14:11:52.880498400 +0200
|
|
@@ -209,11 +209,11 @@
|
|
//
|
|
// This is a Java 9+ approach to method look up allowing private access
|
|
//
|
|
- try {
|
|
- return MethodHandles.privateLookupIn(targetClass, lookupMe);
|
|
- } catch (IllegalAccessException e) {
|
|
+// try {
|
|
+// return MethodHandles.privateLookupIn(targetClass, lookupMe);
|
|
+// } catch (IllegalAccessException e) {
|
|
return lookupMe;
|
|
- }
|
|
+// }
|
|
}
|
|
|
|
}
|
|
diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/schema/SchemaTransformer.java graphql-java-21.0/src/main/java/graphql/schema/SchemaTransformer.java
|
|
--- graphql-java-21.0.orig/src/main/java/graphql/schema/SchemaTransformer.java 2023-09-01 13:45:52.669728400 +0200
|
|
+++ graphql-java-21.0/src/main/java/graphql/schema/SchemaTransformer.java 2023-09-01 13:53:09.762743168 +0200
|
|
@@ -195,7 +195,7 @@
|
|
Map<GraphQLSchemaElement, List<GraphQLSchemaElement>> reverseDependencies = new LinkedHashMap<>();
|
|
Map<String, List<GraphQLSchemaElement>> typeRefReverseDependencies = new LinkedHashMap<>();
|
|
|
|
- TraverserVisitor<GraphQLSchemaElement> nodeTraverserVisitor = new TraverserVisitor<>() {
|
|
+ TraverserVisitor<GraphQLSchemaElement> nodeTraverserVisitor = new TraverserVisitor<GraphQLSchemaElement>() {
|
|
@Override
|
|
public TraversalControl enter(TraverserContext<GraphQLSchemaElement> context) {
|
|
GraphQLSchemaElement currentSchemaElement = context.thisNode();
|
|
diff -up graphql-java-21.3/src/main/java/graphql/execution/instrumentation/dataloader/FieldLevelTrackingApproach.java.p00 graphql-java-21.3/src/main/java/graphql/execution/instrumentation/dataloader/FieldLevelTrackingApproach.java
|
|
--- graphql-java-21.3/src/main/java/graphql/execution/instrumentation/dataloader/FieldLevelTrackingApproach.java.p00 2023-10-29 02:23:28.507854072 +0300
|
|
+++ graphql-java-21.3/src/main/java/graphql/execution/instrumentation/dataloader/FieldLevelTrackingApproach.java 2023-10-29 02:23:42.416023206 +0300
|
|
@@ -189,7 +189,7 @@ public class FieldLevelTrackingApproach
|
|
CallStack callStack = (CallStack) rawState;
|
|
ResultPath path = parameters.getEnvironment().getExecutionStepInfo().getPath();
|
|
int level = path.getLevel();
|
|
- return new InstrumentationContext<>() {
|
|
+ return new InstrumentationContext<Object>() {
|
|
|
|
@Override
|
|
public void onDispatched(CompletableFuture<Object> result) {
|
|
diff -up graphql-java-21.3/src/main/java/graphql/normalized/ExecutableNormalizedOperationToAstCompiler.java.p01 graphql-java-21.3/src/main/java/graphql/normalized/ExecutableNormalizedOperationToAstCompiler.java
|
|
--- graphql-java-21.3/src/main/java/graphql/normalized/ExecutableNormalizedOperationToAstCompiler.java.p01 2023-10-29 02:25:32.453361342 +0300
|
|
+++ graphql-java-21.3/src/main/java/graphql/normalized/ExecutableNormalizedOperationToAstCompiler.java 2023-10-29 02:30:00.084615900 +0300
|
|
@@ -99,7 +99,7 @@ public class ExecutableNormalizedOperati
|
|
@Nullable String operationName,
|
|
@NotNull List<ExecutableNormalizedField> topLevelFields,
|
|
@Nullable VariablePredicate variablePredicate) {
|
|
- return compileToDocument(schema,operationKind,operationName,topLevelFields,Map.of(),variablePredicate);
|
|
+ return compileToDocument(schema,operationKind,operationName,topLevelFields,java.util.Collections.emptyMap(),variablePredicate);
|
|
}
|
|
|
|
/**
|
|
diff -up graphql-java-21.4/src/main/java/graphql/introspection/GoodFaithIntrospection.java.p01 graphql-java-21.4/src/main/java/graphql/introspection/GoodFaithIntrospection.java
|
|
--- graphql-java-21.4/src/main/java/graphql/introspection/GoodFaithIntrospection.java.p01 2024-03-20 14:28:06.287481694 +0300
|
|
+++ graphql-java-21.4/src/main/java/graphql/introspection/GoodFaithIntrospection.java 2024-03-20 14:38:54.767615425 +0300
|
|
@@ -63,15 +63,17 @@ public class GoodFaithIntrospection {
|
|
return ENABLED_STATE.getAndSet(flag);
|
|
}
|
|
|
|
- private static final Map<FieldCoordinates, Integer> ALLOWED_FIELD_INSTANCES = Map.of(
|
|
- coordinates("Query", "__schema"), 1
|
|
- , coordinates("Query", "__type"), 1
|
|
-
|
|
- , coordinates("__Type", "fields"), 1
|
|
- , coordinates("__Type", "inputFields"), 1
|
|
- , coordinates("__Type", "interfaces"), 1
|
|
- , coordinates("__Type", "possibleTypes"), 1
|
|
- );
|
|
+ private static final Map<FieldCoordinates, Integer> ALLOWED_FIELD_INSTANCES;
|
|
+ static
|
|
+ {
|
|
+ ALLOWED_FIELD_INSTANCES=new java.util.HashMap<>();
|
|
+ ALLOWED_FIELD_INSTANCES.put(coordinates("Query", "__schema"), 1);
|
|
+ ALLOWED_FIELD_INSTANCES.put(coordinates("Query", "__type"), 1);
|
|
+ ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "fields"), 1);
|
|
+ ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "inputFields"), 1);
|
|
+ ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "interfaces"), 1);
|
|
+ ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "possibleTypes"), 1);
|
|
+ }
|
|
|
|
public static Optional<ExecutionResult> checkIntrospection(ExecutionContext executionContext) {
|
|
if (isIntrospectionEnabled(executionContext.getGraphQLContext())) {
|
|
diff -up graphql-java-21.4/src/main/java/graphql/schema/visibility/NoIntrospectionGraphqlFieldVisibility.java.p01 graphql-java-21.4/src/main/java/graphql/schema/visibility/NoIntrospectionGraphqlFieldVisibility.java
|
|
--- graphql-java-21.4/src/main/java/graphql/schema/visibility/NoIntrospectionGraphqlFieldVisibility.java.p01 2024-03-20 14:34:17.100132704 +0300
|
|
+++ graphql-java-21.4/src/main/java/graphql/schema/visibility/NoIntrospectionGraphqlFieldVisibility.java 2024-03-20 14:34:37.740391591 +0300
|
|
@@ -17,10 +17,10 @@ import static graphql.schema.visibility.
|
|
* can be used instead
|
|
*/
|
|
@PublicApi
|
|
-@Deprecated(since = "2024-03-16")
|
|
+@Deprecated
|
|
public class NoIntrospectionGraphqlFieldVisibility implements GraphqlFieldVisibility {
|
|
|
|
- @Deprecated(since = "2024-03-16")
|
|
+ @Deprecated
|
|
public static NoIntrospectionGraphqlFieldVisibility NO_INTROSPECTION_FIELD_VISIBILITY = new NoIntrospectionGraphqlFieldVisibility();
|
|
|
|
|