sonatype-lift[bot] commented on a change in pull request #7363: URL: https://github.com/apache/skywalking/pull/7363#discussion_r675389509
########## File path: apm-sniffer/optional-plugins/optional-spring-plugins/spring-rabbit-2.3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/rabbitmq/RabbitMQConsumerInterceptor.java ########## @@ -0,0 +1,89 @@ +/* + * 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.skywalking.apm.plugin.spring.rabbitmq; + +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.Connection; +import org.apache.skywalking.apm.agent.core.context.CarrierItem; +import org.apache.skywalking.apm.agent.core.context.ContextCarrier; +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.context.tag.Tags; +import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; +import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.MessageProperties; + +import java.lang.reflect.Method; +import java.util.List; + +public class RabbitMQConsumerInterceptor implements InstanceMethodsAroundInterceptor { + public static final String OPERATE_NAME_PREFIX = "RabbitMQ/"; + public static final String CONSUMER_OPERATE_NAME_SUFFIX = "/Consumer"; + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, + MethodInterceptResult result) throws Throwable { + ContextCarrier contextCarrier = new ContextCarrier(); + + Connection connection = ((Channel) allArguments[0]).getConnection(); + String url = connection.getAddress().toString().replace("/", "") + ":" + connection.getPort(); + Object data = allArguments[1]; + Message message = null; + if (data instanceof List) { + message = ((List<Message>) data).get(0); + } else if (data instanceof Message) { + message = (Message) data; + } + MessageProperties msgProperties = message.getMessageProperties(); Review comment: *NULL_DEREFERENCE:* object `message` last assigned on line 51 could be null and is dereferenced at line 57. (at-me [in a reply](https://help.sonatype.com/lift) with `help` or `ignore`) ########## File path: apm-sniffer/optional-plugins/optional-spring-plugins/spring-rabbit-2.3.x-plugin/pom.xml ########## @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + ~ + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.skywalking</groupId> + <artifactId>optional-spring-plugins</artifactId> + <version>8.7.0-SNAPSHOT</version> + </parent> + + <artifactId>apm-spring-rabbit-2.3.x-plugin</artifactId> + + <name>spring-rabbit-2.3.x-plugin</name> + + <properties> + <spring-rabbit.version>2.3.9</spring-rabbit.version> + </properties> + + <dependencies> + <dependency> Review comment: *Critical OSS Vulnerability:* ### pkg:maven/net.minidev/[email protected] 1 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:maven/org.springframework.amqp/[email protected] <!-- Lift_Details --> <details> <summary><b>CRITICAL Vulnerabilities (1)</b></summary> <ul> *** > #### [CVE-2021-27568] An issue was discovered in netplex json-smart-v1 through 2015-10-23 and json-sma... > An issue was discovered in netplex json-smart-v1 through 2015-10-23 and json-smart-v2 through 2.4. An exception is thrown from a function, but it is not caught, as demonstrated by NumberFormatException. When it is not caught, it may cause programs using the library to crash or expose sensitive information. > > **CVSS Score:** 9.1 > > **CVSS Vector:** CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H *** </ul> </details> (at-me [in a reply](https://help.sonatype.com/lift) with `help` or `ignore`) -- 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]
