github-advanced-security[bot] commented on code in PR #19056:
URL: https://github.com/apache/druid/pull/19056#discussion_r3947323195
##########
extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/DefaultK8sApiClient.java:
##########
@@ -263,8 +264,14 @@
return true;
} else if (item != null && item.type != null &&
item.type.equals(WatchResult.BOOKMARK)) {
// Events with type BOOKMARK will only contain resourceVersion
and no metadata. See
- // Kubernetes API documentation for details.
- LOGGER.debug("BOOKMARK event fired, no nothing, only update
resourceVersion");
+ // Kubernetes API documentation for details. Build a response
carrying just the
+ //updated resourceVersion; otherwise obj would still hold the
previous event (or
+ // null on the first event), corrupting the caller's
resourceVersion tracking.
+ LOGGER.debug("BOOKMARK event fired, only updating
resourceVersion");
+ obj = new Watch.Response<>(
+ WatchResult.BOOKMARK,
+ new DiscoveryDruidNodeAndResourceVersion(
+
item.object.getMetadata().getResourceVersion(), null));
Review Comment:
## CodeQL / Dereferenced variable may be null
Variable [object](1) may be null at this access as suggested by [this](2)
null guard.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11939)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]