Re: [PR] [TINKERPOP-3061] fix: failing authentication when multiple initially requests are executed concurrently [tinkerpop]

2024-03-27 Thread via GitHub


Cole-Greer commented on code in PR #2525:
URL: https://github.com/apache/tinkerpop/pull/2525#discussion_r1542198439


##
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java:
##
@@ -163,6 +171,46 @@ public void 
shouldFailAuthenticateWithPlainTextBadUsername() throws Exception {
 }
 }
 
+@Test
+public void 
shouldFailAuthenticateWithUnAuthenticatedRequestAfterMaxDeferrableDuration() 
throws Exception {

Review Comment:
   Hi Tien, I want to be absolutely certain that we aren’t going to lose any of 
these deferred requests in the case of errors. If the server fails to send a 
response the drivers will just be left hanging indefinitely. If I’m 
understanding this test right, the first 3 requests are all expected to 
succeed, and then after a delay the final request is submitted and fails. Would 
it also be possible to setup a test such that there are multiple pending 
requests in the server’s deferred requests queue at the time that auth fails, 
and then we can verify that the correct error message gets sent to all 
currently pending requests?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(tinkerpop) branch valentyn/streaming-serializers updated: tests and cleanup

2024-03-27 Thread valentyn
This is an automated email from the ASF dual-hosted git repository.

valentyn pushed a commit to branch valentyn/streaming-serializers
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/valentyn/streaming-serializers 
by this push:
 new 427171970e tests and cleanup
427171970e is described below

commit 427171970e6a5c30e2716af07ceab8116f04733c
Author: Valentyn Kahamlyk 
AuthorDate: Wed Mar 27 16:23:26 2024 -0700

tests and cleanup
---
 .../server/handler/HttpGremlinEndpointHandler.java | 60 +-
 .../server/GremlinServerHttpIntegrateTest.java | 18 +++
 .../util/ser/GraphBinaryMessageSerializerV4.java   | 25 +++--
 .../util/ser/GraphSONMessageSerializerV4.java  |  5 --
 .../util/ser/GraphSONMessageSerializerV4Test.java  |  9 +---
 .../binary/GraphBinaryMessageSerializerV4Test.java |  2 -
 6 files changed, 70 insertions(+), 49 deletions(-)

diff --git 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
index 2a84db2ffb..3b990599db 100644
--- 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
+++ 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
@@ -114,6 +114,10 @@ import static 
io.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED;
 import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
 import static io.netty.handler.codec.http.HttpResponseStatus.OK;
 import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
+import static 
org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.CHUNKING_NOT_SUPPORTED;
+import static 
org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.FINISHED;
+import static 
org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.FINISHING;
+import static 
org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.STREAMING;
 import static 
org.apache.tinkerpop.gremlin.server.handler.HttpHandlerUtil.sendTrailingHeaders;
 import static 
org.apache.tinkerpop.gremlin.server.handler.HttpHandlerUtil.writeErrorFrame;
 
@@ -244,7 +248,7 @@ public class HttpGremlinEndpointHandler extends 
ChannelInboundHandlerAdapter {
 
 final RequestState requestState = serializer.getValue1() 
instanceof MessageChunkSerializer
 ? RequestState.NOT_STARTED
-: RequestState.CHUNKING_NOT_SUPPORTED;
+: CHUNKING_NOT_SUPPORTED;
 
 final Context requestCtx = new Context(requestMessage, ctx, 
settings, graphManager, gremlinExecutor,
 gremlinExecutor.getScheduledExecutorService(), 
requestState);
@@ -400,8 +404,9 @@ public class HttpGremlinEndpointHandler extends 
ChannelInboundHandlerAdapter {
 final Map args = message.getArgs();
 final String language = args.containsKey(Tokens.ARGS_LANGUAGE) ? 
(String) args.get(Tokens.ARGS_LANGUAGE) : "gremlin-groovy";
 final GremlinScriptEngine scriptEngine = 
gremlinExecutor.getScriptEngineManager().getEngineByName(language);
-final Object result = scriptEngine.eval((String) 
message.getArg(Tokens.ARGS_GREMLIN),
-mergeBindingsFromRequest(context, 
graphManager.getAsBindings()));
+
+final Bindings bindings = mergeBindingsFromRequest(context, 
graphManager.getAsBindings());
+final Object result = scriptEngine.eval((String) 
message.getArg(Tokens.ARGS_GREMLIN), bindings);
 
 handleIterator(context, IteratorUtils.asIterator(result), serializer);
 }
@@ -653,10 +658,9 @@ public class HttpGremlinEndpointHandler extends 
ChannelInboundHandlerAdapter {
 return;
 }
 
-// the batch size can be overridden by the request !!!
-final int resultIterationBatchSize = 2;
-//(Integer) msg.optionalArgs(Tokens.ARGS_BATCH_SIZE)
-//.orElse(settings.resultIterationBatchSize);
+// the batch size can be overridden by the request
+final int resultIterationBatchSize = (Integer) 
msg.optionalArgs(Tokens.ARGS_BATCH_SIZE)
+.orElse(settings.resultIterationBatchSize);
 List aggregate = new ArrayList<>(resultIterationBatchSize);
 
 // use an external control to manage the loop as opposed to just 
checking hasNext() in the while.  this
@@ -726,7 +730,9 @@ public class HttpGremlinEndpointHandler extends 
ChannelInboundHandlerAdapter {
 
 try {
 // only need to reset the aggregation list if there's 
more stuff to write
-if (hasMore) { aggregate = new 
ArrayList<>(resultIterationBatchSize); }
+if (hasMore) {
+  

(tinkerpop) branch valentyn/streaming-serializers updated: test cleanup

2024-03-27 Thread valentyn
This is an automated email from the ASF dual-hosted git repository.

valentyn pushed a commit to branch valentyn/streaming-serializers
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/valentyn/streaming-serializers 
by this push:
 new caee19ebd7 test cleanup
caee19ebd7 is described below

commit caee19ebd77e325f69891a790b66714c5fa3836e
Author: Valentyn Kahamlyk 
AuthorDate: Wed Mar 27 12:42:51 2024 -0700

test cleanup
---
 .../util/ser/GraphSONMessageSerializerV3Test.java  |  4 +-
 .../util/ser/GraphSONMessageSerializerV4Test.java  | 23 +++
 .../binary/GraphBinaryMessageSerializerV4Test.java | 44 ++
 3 files changed, 44 insertions(+), 27 deletions(-)

diff --git 
a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV3Test.java
 
b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV3Test.java
index 24cf8391bf..9398840036 100644
--- 
a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV3Test.java
+++ 
b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV3Test.java
@@ -408,12 +408,12 @@ public class GraphSONMessageSerializerV3Test {
 assertEquals(ResponseStatusCode.SUCCESS, 
response.getStatus().getCode());
 }
 
-private ResponseMessage convert(final Object toSerialize, 
MessageSerializer serializer) throws SerializationException {
+protected ResponseMessage convert(final Object toSerialize, 
MessageSerializer serializer) throws SerializationException {
 final ByteBuf bb = 
serializer.serializeResponseAsBinary(responseMessageBuilder.result(toSerialize).create(),
 allocator);
 return serializer.deserializeResponse(bb);
 }
 
-private ResponseMessage convert(final Object toSerialize) throws 
SerializationException {
+protected ResponseMessage convert(final Object toSerialize) throws 
SerializationException {
 return convert(toSerialize, this.serializer);
 }
 }
diff --git 
a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java
 
b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java
index 27cb804a3b..7d77e07b37 100644
--- 
a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java
+++ 
b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java
@@ -60,13 +60,7 @@ public class GraphSONMessageSerializerV4Test extends 
GraphSONMessageSerializerV3
 final ByteBuf bb2 = serializer.writeChunk(Arrays.asList("chunk", 2), 
allocator);
 final ByteBuf bb3 = serializer.writeFooter(response, allocator);
 
-final ByteBuf bbCombined = allocator.buffer(bb0.readableBytes() + 
bb1.readableBytes() +
-bb2.readableBytes() + bb3.readableBytes());
-
-bbCombined.writeBytes(bb0);
-bbCombined.writeBytes(bb1);
-bbCombined.writeBytes(bb2);
-bbCombined.writeBytes(bb3);
+final ByteBuf bbCombined = 
allocator.buffer().writeBytes(bb0).writeBytes(bb1).writeBytes(bb2).writeBytes(bb3);
 
 final ResponseMessage deserialized = 
serializer.deserializeResponse(bbCombined);
 
@@ -89,13 +83,7 @@ public class GraphSONMessageSerializerV4Test extends 
GraphSONMessageSerializerV3
 final ByteBuf bb2 = serializer.writeChunk(Arrays.asList("chunk", 2), 
allocator);
 final ByteBuf bb3 = serializer.writeErrorFooter(response, allocator);
 
-final ByteBuf bbCombined = allocator.buffer(bb0.readableBytes() + 
bb1.readableBytes() +
-bb2.readableBytes() + bb3.readableBytes());
-
-bbCombined.writeBytes(bb0);
-bbCombined.writeBytes(bb1);
-bbCombined.writeBytes(bb2);
-bbCombined.writeBytes(bb3);
+final ByteBuf bbCombined = 
allocator.buffer().writeBytes(bb0).writeBytes(bb1).writeBytes(bb2).writeBytes(bb3);
 
 final ResponseMessage deserialized = 
serializer.deserializeResponse(bbCombined);
 
@@ -106,9 +94,8 @@ public class GraphSONMessageSerializerV4Test extends 
GraphSONMessageSerializerV3
 assertEquals("OK", deserialized.getStatus().getMessage());
 }
 
-private static String getString(final ByteBuf bb) {
-final String result =  bb.readCharSequence(bb.readableBytes(), 
CharsetUtil.UTF_8).toString();
-bb.resetReaderIndex();
-return result;
+@Override
+protected ResponseMessage convert(final Object toSerialize) throws 
SerializationException {
+return convert(toSerialize, this.serializer);
 }
 }
diff --git 
a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java
 
b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java
index 

(tinkerpop) branch valentyn/streaming-serializers updated: GraphBinary streaming draft

2024-03-27 Thread valentyn
This is an automated email from the ASF dual-hosted git repository.

valentyn pushed a commit to branch valentyn/streaming-serializers
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/valentyn/streaming-serializers 
by this push:
 new 090ef4c5ea GraphBinary streaming draft
090ef4c5ea is described below

commit 090ef4c5ea2cd59c8ec8765491d53c15a121c120
Author: Valentyn Kahamlyk 
AuthorDate: Wed Mar 27 12:27:33 2024 -0700

GraphBinary streaming draft
---
 .../gremlin/structure/io/binary/DataType.java  |   1 +
 .../gremlin/structure/io/binary/Marker.java|  41 +
 .../io/binary/TypeSerializerRegistry.java  |   1 +
 .../io/binary/types/SingleTypeSerializer.java  |   3 +
 .../server/handler/HttpGremlinEndpointHandler.java |   8 +-
 .../gremlin/server/handler/HttpHandlerUtil.java|   2 +-
 .../server/GremlinServerHttpIntegrateTest.java |  55 +-
 .../gremlin/util/message/ResponseMessage.java  |  15 ++
 .../util/ser/GraphBinaryMessageSerializerV1.java   |  12 +-
 .../util/ser/GraphBinaryMessageSerializerV4.java   | 188 +
 .../util/ser/GraphSONMessageSerializerV4.java  |  14 +-
 .../gremlin/util/ser/MessageChunkSerializer.java   |  10 +-
 .../tinkerpop/gremlin/util/ser/SerTokens.java  |   1 +
 .../tinkerpop/gremlin/util/ser/Serializers.java|   7 +-
 .../util/ser/GraphSONMessageSerializerV4Test.java  |  43 +
 .../binary/GraphBinaryMessageSerializerV4Test.java | 164 ++
 16 files changed, 506 insertions(+), 59 deletions(-)

diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java
index e3fd09f16a..246a266fbe 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java
@@ -90,6 +90,7 @@ public enum DataType {
 ZONEOFFSET(0X8E),
 
 CUSTOM(0),
+MARKER(0XFD),
 UNSPECIFIED_NULL(0XFE);
 
 private final int code;
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/Marker.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/Marker.java
new file mode 100644
index 00..8f7beaab63
--- /dev/null
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/Marker.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.structure.io.binary;
+
+public class Marker {
+private final byte value;
+
+public static Marker END_OF_STREAM = new Marker((byte)0);
+
+private Marker(final byte value) {
+this.value = value;
+}
+
+public byte getValue() {
+return value;
+}
+
+public static Marker of(final byte value) {
+if (value != 0) {
+throw new IllegalArgumentException();
+}
+return END_OF_STREAM;
+}
+}
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
index 9958179318..428bfb4b24 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
@@ -189,6 +189,7 @@ public class TypeSerializerRegistry {
 new RegistryEntry<>(Tree.class, new TreeSerializer()),
 new RegistryEntry<>(Metrics.class, new MetricsSerializer()),
 new RegistryEntry<>(TraversalMetrics.class, new 
TraversalMetricsSerializer()),
+new RegistryEntry<>(Marker.class, 
SingleTypeSerializer.MarkerSerializer),
 
 // TransformSerializer implementations
 new RegistryEntry<>(Map.Entry.class, new MapEntrySerializer()),
diff --git 

Re: [PR] [TINKERPOP-3061] fix: failing authentication when multiple initially requests are executed concurrently [tinkerpop]

2024-03-27 Thread via GitHub


tien commented on code in PR #2525:
URL: https://github.com/apache/tinkerpop/pull/2525#discussion_r1541269520


##
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java:
##
@@ -75,106 +79,159 @@ public SaslAuthenticationHandler(final Authenticator 
authenticator, final Author
 
 @Override
 public void channelRead(final ChannelHandlerContext ctx, final Object msg) 
throws Exception {
-if (msg instanceof RequestMessage){
-final RequestMessage requestMessage = (RequestMessage) msg;
-
-final Attribute negotiator = 
((AttributeMap) ctx).attr(StateKey.NEGOTIATOR);
-final Attribute request = ((AttributeMap) 
ctx).attr(StateKey.REQUEST_MESSAGE);
-if (negotiator.get() == null) {
-try {
-// First time through so save the request and send an 
AUTHENTICATE challenge with no data
-
negotiator.set(authenticator.newSaslNegotiator(getRemoteInetAddress(ctx)));
-request.set(requestMessage);
-final ResponseMessage authenticate = 
ResponseMessage.build(requestMessage)
-.code(ResponseStatusCode.AUTHENTICATE).create();
-ctx.writeAndFlush(authenticate);
-} catch (Exception ex) {
-// newSaslNegotiator can cause troubles - if we don't 
catch and respond nicely the driver seems
-// to hang until timeout which isn't so nice. treating 
this like a server error as it means that
-// the Authenticator isn't really ready to deal with 
requests for some reason.
-logger.error(String.format("%s is not ready to handle 
requests - check its configuration or related services",
-authenticator.getClass().getSimpleName()), ex);
-
-final ResponseMessage error = 
ResponseMessage.build(requestMessage)
-.statusMessage("Authenticator is not ready to 
handle requests")
-.code(ResponseStatusCode.SERVER_ERROR).create();
-ctx.writeAndFlush(error);
-}
-} else {
-if (requestMessage.getOp().equals(Tokens.OPS_AUTHENTICATION) 
&& requestMessage.getArgs().containsKey(Tokens.ARGS_SASL)) {
-
-final Object saslObject = 
requestMessage.getArgs().get(Tokens.ARGS_SASL);
-final byte[] saslResponse;
-
-if(saslObject instanceof String) {
-saslResponse = BASE64_DECODER.decode((String) 
saslObject);
-} else {
-final ResponseMessage error = 
ResponseMessage.build(request.get())
-.statusMessage("Incorrect type for : " + 
Tokens.ARGS_SASL + " - base64 encoded String is expected")
-
.code(ResponseStatusCode.REQUEST_ERROR_MALFORMED_REQUEST).create();
-ctx.writeAndFlush(error);
-return;
-}
-
-try {
-final byte[] saslMessage = 
negotiator.get().evaluateResponse(saslResponse);
-if (negotiator.get().isComplete()) {
-final AuthenticatedUser user = 
negotiator.get().getAuthenticatedUser();
-
ctx.channel().attr(StateKey.AUTHENTICATED_USER).set(user);
-// User name logged with the remote socket address 
and authenticator classname for audit logging
-if (settings.enableAuditLog) {
-String address = 
ctx.channel().remoteAddress().toString();
-if (address.startsWith("/") && 
address.length() > 1) address = address.substring(1);
-final String[] authClassParts = 
authenticator.getClass().toString().split("[.]");
-auditLogger.info("User {} with address {} 
authenticated by {}",
-user.getName(), address, 
authClassParts[authClassParts.length - 1]);
-}
-// If we have got here we are authenticated so 
remove the handler and pass
-// the original message down the pipeline for 
processing
-ctx.pipeline().remove(this);
-final RequestMessage original = request.get();
-ctx.fireChannelRead(original);
-} else {
-// not done here - send back the sasl message for 
next challenge.
-final Map metadata = new 
HashMap<>();
-metadata.put(Tokens.ARGS_SASL, 

(tinkerpop) branch dependabot/npm_and_yarn/gremlin-javascript/src/main/javascript/gremlin-javascript/3.6-dev/mocha-10.4.0 created (now 511ead41b2)

2024-03-27 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch 
dependabot/npm_and_yarn/gremlin-javascript/src/main/javascript/gremlin-javascript/3.6-dev/mocha-10.4.0
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


  at 511ead41b2 Bump mocha in 
/gremlin-javascript/src/main/javascript/gremlin-javascript

No new revisions were added by this update.



[PR] Bump mocha from 10.3.0 to 10.4.0 in /gremlin-javascript/src/main/javascript/gremlin-javascript [tinkerpop]

2024-03-27 Thread via GitHub


dependabot[bot] opened a new pull request, #2530:
URL: https://github.com/apache/tinkerpop/pull/2530

   Bumps [mocha](https://github.com/mochajs/mocha) from 10.3.0 to 10.4.0.
   
   Release notes
   Sourced from https://github.com/mochajs/mocha/releases;>mocha's releases.
   
   v10.4.0
   10.4.0 / 2024-03-26
   :tada: Enhancements
   
   https://redirect.github.com/mochajs/mocha/pull/4829;>#4829 
feat: include .cause stacks in the error stack traces (https://github.com/voxpelli;>@​voxpelli)
   https://redirect.github.com/mochajs/mocha/pull/4985;>#4985 
feat: add file path to xunit reporter (https://github.com/bmish;>@​bmish)
   
   :bug: Fixes
   
   https://redirect.github.com/mochajs/mocha/pull/5074;>#5074 
fix: harden error handling in lib/cli/run.js (https://github.com/stalet;>@​stalet)
   
   :nut_and_bolt: Other
   
   https://redirect.github.com/mochajs/mocha/pull/5077;>#5077 
chore: add mtfoley/pr-compliance-action (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5060;>#5060 
chore: migrate ESLint config to flat config (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5095;>#5095 
chore: revert https://redirect.github.com/mochajs/mocha/pull/5069;>#5069 to restore 
Netlify builds (https://github.com/voxpelli;>@​voxpelli)
   https://redirect.github.com/mochajs/mocha/pull/5097;>#5097 
docs: add sponsored to sponsorship link rels (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5093;>#5093 
chore: add 'status: in triage' label to issue templates and docs (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5083;>#5083 
docs: fix CHANGELOG.md headings to start with a root-level h1 (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5100;>#5100 
chore: fix header generation and production build crashes  (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5104;>#5104 
chore: bump ESLint ecmaVersion to 2020 (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5116;>#5116 
fix: eleventy template builds crash with 'unexpected token at : string, 
msg...' (https://github.com/LcsK;>@​LcsK)
   https://redirect.github.com/mochajs/mocha/pull/4869;>#4869 
docs: fix documentation concerning glob expansion on UNIX (https://github.com/binki;>@​binki)
   https://redirect.github.com/mochajs/mocha/pull/5122;>#5122 
test: fix xunit integration test (https://github.com/voxpelli;>@​voxpelli)
   https://redirect.github.com/mochajs/mocha/pull/5123;>#5123 
chore: activate dependabot for workflows (https://github.com/voxpelli;>@​voxpelli)
   https://redirect.github.com/mochajs/mocha/pull/5125;>#5125 
build(deps): bump the github-actions group with 2 updates (https://github.com/dependabot;>@​dependabot)
   
   
   
   
   Changelog
   Sourced from https://github.com/mochajs/mocha/blob/master/CHANGELOG.md;>mocha's 
changelog.
   
   10.4.0 / 2024-03-26
   :tada: Enhancements
   
   https://redirect.github.com/mochajs/mocha/pull/4829;>#4829 
feat: include .cause stacks in the error stack traces (https://github.com/voxpelli;>@​voxpelli)
   https://redirect.github.com/mochajs/mocha/pull/4985;>#4985 
feat: add file path to xunit reporter (https://github.com/bmish;>@​bmish)
   
   :bug: Fixes
   
   https://redirect.github.com/mochajs/mocha/pull/5074;>#5074 
fix: harden error handling in lib/cli/run.js (https://github.com/stalet;>@​stalet)
   
   :nut_and_bolt: Other
   
   https://redirect.github.com/mochajs/mocha/pull/5077;>#5077 
chore: add mtfoley/pr-compliance-action (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5060;>#5060 
chore: migrate ESLint config to flat config (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5095;>#5095 
chore: revert https://redirect.github.com/mochajs/mocha/pull/5069;>#5069 to restore 
Netlify builds (https://github.com/voxpelli;>@​voxpelli)
   https://redirect.github.com/mochajs/mocha/pull/5097;>#5097 
docs: add sponsored to sponsorship link rels (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5093;>#5093 
chore: add 'status: in triage' label to issue templates and docs (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5083;>#5083 
docs: fix CHANGELOG.md headings to start with a root-level h1 (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5100;>#5100 
chore: fix header generation and production build crashes  (https://github.com/JoshuaKGoldberg;>@​JoshuaKGoldberg)
   https://redirect.github.com/mochajs/mocha/pull/5104;>#5104 
chore: 

Re: [PR] [TINKERPOP-3061] fix: failing authentication when multiple initially requests are executed concurrently [tinkerpop]

2024-03-27 Thread via GitHub


FlorianHockmann commented on code in PR #2525:
URL: https://github.com/apache/tinkerpop/pull/2525#discussion_r1540816027


##
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java:
##
@@ -27,8 +27,7 @@
 import org.apache.tinkerpop.gremlin.util.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.util.message.ResponseStatusCode;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;

Review Comment:
   Please revert this change. [Our dev docs explicitly mention that TinkerPop 
doesn't use wildcard 
imports](https://tinkerpop.apache.org/docs/current/dev/developer/#_code_style).



##
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java:
##
@@ -218,9 +266,19 @@ public void 
shouldAuthenticateAndWorkWithVariablesOverGraphSONV1Serialization()
 
 private static void assertConnection(final Cluster cluster, final Client 
client) throws InterruptedException, ExecutionException {

Review Comment:
   This method is used in 4 different tests, such as 
`shouldAuthenticateWithPlainText`. These 4 tests will now fail if submitting 
multiple requests initially in parallel isn't working.
   I think it would be good if we could keep these tests as simple as possible 
so they don't include parallelization of initial requests. A test like 
`shouldAuthenticateWithPlainText` should really only fail if _authenticate with 
plain text_ isn't working, not if submitting multiple requests in parallel 
isn't working.
   
   Long story short, I think it would be good if you could revert the changes 
to this method and instead write a new test specifically for the 
parallelization issue.



##
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java:
##
@@ -75,106 +79,159 @@ public SaslAuthenticationHandler(final Authenticator 
authenticator, final Author
 
 @Override
 public void channelRead(final ChannelHandlerContext ctx, final Object msg) 
throws Exception {
-if (msg instanceof RequestMessage){
-final RequestMessage requestMessage = (RequestMessage) msg;
-
-final Attribute negotiator = 
((AttributeMap) ctx).attr(StateKey.NEGOTIATOR);
-final Attribute request = ((AttributeMap) 
ctx).attr(StateKey.REQUEST_MESSAGE);
-if (negotiator.get() == null) {
-try {
-// First time through so save the request and send an 
AUTHENTICATE challenge with no data
-
negotiator.set(authenticator.newSaslNegotiator(getRemoteInetAddress(ctx)));
-request.set(requestMessage);
-final ResponseMessage authenticate = 
ResponseMessage.build(requestMessage)
-.code(ResponseStatusCode.AUTHENTICATE).create();
-ctx.writeAndFlush(authenticate);
-} catch (Exception ex) {
-// newSaslNegotiator can cause troubles - if we don't 
catch and respond nicely the driver seems
-// to hang until timeout which isn't so nice. treating 
this like a server error as it means that
-// the Authenticator isn't really ready to deal with 
requests for some reason.
-logger.error(String.format("%s is not ready to handle 
requests - check its configuration or related services",
-authenticator.getClass().getSimpleName()), ex);
-
-final ResponseMessage error = 
ResponseMessage.build(requestMessage)
-.statusMessage("Authenticator is not ready to 
handle requests")
-.code(ResponseStatusCode.SERVER_ERROR).create();
-ctx.writeAndFlush(error);
-}
-} else {
-if (requestMessage.getOp().equals(Tokens.OPS_AUTHENTICATION) 
&& requestMessage.getArgs().containsKey(Tokens.ARGS_SASL)) {
-
-final Object saslObject = 
requestMessage.getArgs().get(Tokens.ARGS_SASL);
-final byte[] saslResponse;
-
-if(saslObject instanceof String) {
-saslResponse = BASE64_DECODER.decode((String) 
saslObject);
-} else {
-final ResponseMessage error = 
ResponseMessage.build(request.get())
-.statusMessage("Incorrect type for : " + 
Tokens.ARGS_SASL + " - base64 encoded String is expected")
-
.code(ResponseStatusCode.REQUEST_ERROR_MALFORMED_REQUEST).create();
-ctx.writeAndFlush(error);
-return;
-}
-
-try {
-final byte[] saslMessage = 
negotiator.get().evaluateResponse(saslResponse);
-if 

Re: [PR] TINKERPOP-3063 Fix bug in Gremlin.Net authentication for parallel requests [tinkerpop]

2024-03-27 Thread via GitHub


FlorianHockmann closed pull request #2522: TINKERPOP-3063 Fix bug in 
Gremlin.Net authentication for parallel requests
URL: https://github.com/apache/tinkerpop/pull/2522


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] TINKERPOP-3063 Fix bug in Gremlin.Net authentication for parallel requests [tinkerpop]

2024-03-27 Thread via GitHub


FlorianHockmann commented on PR #2522:
URL: https://github.com/apache/tinkerpop/pull/2522#issuecomment-2022583104

   Closing this as it was superseded by #2525 which fixes the problem on the 
server side so the workaround I implemented here for the .NET driver isn't 
needed any more.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] TINKERPOP-3063 Fix bug in Gremlin.Net authentication for parallel requests [tinkerpop]

2024-03-27 Thread via GitHub


FlorianHockmann commented on PR #2522:
URL: https://github.com/apache/tinkerpop/pull/2522#issuecomment-2022386126

   > Do you have any thoughts on the server side solution by @tien in 
https://github.com/apache/tinkerpop/pull/2525? If the server fix fully 
addresses the issue, then it should make the changes here as well as equivalent 
GLV changes unnecessary.
   
   I'm just back from vacation which is why I couldn't review the PR yet.
   But I agree in general that a server fix is definitely better in general 
than implementing workarounds in all GLV drivers. I'll try to review #2525 
today.
   If it fixes the issue, then we of course don't need this PR any more. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org