Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : Package Exclusion Issue with com.nr and com.newrelic #110

Merged
merged 17 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public static IntrospectorServiceManager createAndInitialize(Map<String, Object>
Map<String, Object> sec = new HashMap<>();
sec.put("enable", true);
sec.put("validator_service_url", "ws://192.168.5.138:54321");
sec.put("low-priority-instrumentation", Collections.singletonMap("enabled", true));
config.put("security", sec);

if (configOverrides != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TransformingClassLoader extends URLClassLoader {
"java.lang.ProcessImpl", "java.io", "java.nio", "javax.servlet"
};
private static final String[] PROTECTED_PREFIXES = new String[]{"java.", "javax.", "com.sun.", "sun.",
"org.junit.", "junit.framework", "com.newrelic", "org.xml", "org.w3c"};
"org.junit.", "junit.framework", "com.newrelic.agent", "com.newrelic.api", "org.xml", "org.w3c"};

private static final String[] INTROSPECTOR_MUST_LOADS = new String[]{
// This class needs to be woven.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.agent.security.akka.core.AkkaCoreUtils;
import com.newrelic.agent.security.instrumentation.akka.core.AkkaCoreUtils;
import scala.concurrent.Future;

import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.agent.security.akka.core;
package com.newrelic.agent.security.instrumentation.akka.core;

public class AkkaCoreUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
*
*/

package com.agent.instrumentation.akka.http.core_10
package com.nr.agent.security.instrumentation.akka.http.core_10

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpHeader, HttpRequest, HttpResponse}
import akka.stream.ActorMaterializer
import com.newrelic.agent.security.instrumentation.akka.core.AkkaCoreUtils
import com.newrelic.agent.security.introspec.{InstrumentationTestConfig, SecurityInstrumentationTestRunner, SecurityIntrospector}
import com.newrelic.api.agent.Trace
import com.newrelic.api.agent.security.instrumentation.helpers.ServletHelper
import com.newrelic.api.agent.security.schema.VulnerabilityCaseType
import com.newrelic.api.agent.security.schema.operation.SSRFOperation
import com.nr.agent.security.akka.core.AkkaCoreUtils
import org.junit.runner.RunWith
import org.junit.{After, Assert, Test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.agent.instrumentation.akka.http.core_211_10011
package com.nr.agent.security.instrumentation.akka.http.core_10

import akka.actor.ActorSystem
import akka.event.Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.agent.instrumentation.akka.http.core_10
package com.nr.agent.security.instrumentation.akka.http.core_10

import akka.actor.ActorSystem
import akka.event.Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.agent.security.akka.core.AkkaCoreUtils;
import com.newrelic.agent.security.instrumentation.akka.core.AkkaCoreUtils;
import scala.concurrent.Future;

import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.agent.security.akka.core;
package com.newrelic.agent.security.instrumentation.akka.core;

public class AkkaCoreUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
*
*/

package com.agent.instrumentation.akka.http.core_10
package com.nr.agent.security.instrumentation.akka.http.core_10

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpHeader, HttpRequest, HttpResponse}
import akka.stream.ActorMaterializer
import com.agent.instrumentation.akka.http.core_211_10011.{AkkaServer, PlayServer}
import com.newrelic.agent.security.instrumentation.akka.core.AkkaCoreUtils
import com.newrelic.agent.security.introspec.{InstrumentationTestConfig, SecurityInstrumentationTestRunner, SecurityIntrospector}
import com.newrelic.api.agent.Trace
import com.newrelic.api.agent.security.instrumentation.helpers.ServletHelper
import com.newrelic.api.agent.security.schema.VulnerabilityCaseType
import com.newrelic.api.agent.security.schema.operation.SSRFOperation
import com.nr.agent.security.akka.core.AkkaCoreUtils
import org.junit.runner.RunWith
import org.junit.{After, Assert, Test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.agent.instrumentation.akka.http.core_10
package com.nr.agent.security.instrumentation.akka.http.core_10

import akka.actor.ActorSystem
import akka.event.Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
*
*/

package com.agent.instrumentation.akka.http.core_211_10011
package com.nr.agent.security.instrumentation.akka.http.core_10

import akka.actor.ActorSystem
import akka.event.Logging
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.model._
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Source, _}
import akka.util.Timeout
import com.typesafe.config.ConfigFactory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.instrumentation.security.apache.ldap;
package com.newrelic.agent.security.instrumentation.apache.ldap;

public class LDAPUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.instrumentation.security.apache.ldap.LDAPUtils;
import com.newrelic.agent.security.instrumentation.apache.ldap.LDAPUtils;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.message.SearchRequest;
import org.apache.directory.api.ldap.model.message.SearchScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.instrumentation.security.apache.ldap.LDAPUtils;
import com.newrelic.agent.security.instrumentation.apache.ldap.LDAPUtils;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
import org.apache.directory.api.ldap.model.cursor.SearchCursor;
import org.apache.directory.api.ldap.model.exception.LdapException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.instrumentation.security.apache.ldap;
package com.nr.agent.security.instrumentation.apache.ldap;

import com.newrelic.agent.security.introspec.InstrumentationTestConfig;
import com.newrelic.agent.security.introspec.SecurityInstrumentationTestRunner;
Expand All @@ -25,7 +25,7 @@
import java.util.List;

@RunWith(SecurityInstrumentationTestRunner.class)
@InstrumentationTestConfig(includePrefixes = { "org.apache.directory.ldap.client.api", "com.nr.instrumentation.security.apache.ldap" })
@InstrumentationTestConfig(includePrefixes = { "org.apache.directory.ldap.client.api", "com.newrelic.agent.security.instrumentation.apache.ldap" })
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LdapAsyncConnectionTest {
public static final String DOMAIN_DSN = "dc=example,dc=com";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.instrumentation.security.apache.ldap;
package com.nr.agent.security.instrumentation.apache.ldap;

import com.newrelic.agent.security.introspec.InstrumentationTestConfig;
import com.newrelic.agent.security.introspec.SecurityInstrumentationTestRunner;
Expand Down Expand Up @@ -28,7 +28,7 @@
import java.util.List;

@RunWith(SecurityInstrumentationTestRunner.class)
@InstrumentationTestConfig(includePrefixes = { "org.apache.directory.ldap.client.api", "com.nr.instrumentation.security.apache.ldap" })
@InstrumentationTestConfig(includePrefixes = { "org.apache.directory.ldap.client.api", "com.newrelic.agent.security.instrumentation.apache.ldap" })
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LdapConnectionTest {
public static final String DOMAIN_DSN = "dc=example,dc=com";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.instrumentation.security.xpath.camel;
package com.newrelic.agent.security.instrumentation.xpath.camel;

public class XPATHUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.instrumentation.security.xpath.camel.XPATHUtils;
import com.newrelic.agent.security.instrumentation.xpath.camel.XPATHUtils;
import org.apache.camel.support.builder.Namespaces;

@Weave(type = MatchType.BaseClass, originalName = "org.apache.camel.builder.BuilderSupport")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.instrumentation.security.camel.xpath;
package com.nr.agent.security.instrumentation.xpath.camel;

import com.newrelic.agent.security.introspec.InstrumentationTestConfig;
import com.newrelic.agent.security.introspec.SecurityInstrumentationTestRunner;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nr.instrumentation.security.xpath.commons.jxpath;
package com.newrelic.agent.security.instrumentation.xpath.commons.jxpath;

public class XPATHUtils {
public static final String NR_SEC_CUSTOM_ATTRIB_NAME = "XPATH_OPERATION_LOCK_COMMONS_JXPATH-";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.instrumentation.security.xpath.commons.jxpath.XPATHUtils;
import org.apache.commons.jxpath.ri.EvalContext;
import com.newrelic.agent.security.instrumentation.xpath.commons.jxpath.XPATHUtils;

import java.util.Iterator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.nr.agent.security.instrumentation.xpath.commons.jxpath;

import com.newrelic.agent.security.introspec.InstrumentationTestConfig;
import com.newrelic.agent.security.introspec.SecurityInstrumentationTestRunner;
import com.newrelic.agent.security.introspec.SecurityIntrospector;
Expand All @@ -6,7 +8,6 @@
import com.newrelic.api.agent.security.schema.operation.XPathOperation;
import org.apache.commons.jxpath.Container;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.ri.compiler.Expression;
import org.apache.commons.jxpath.xml.DocumentContainer;
import org.junit.Assert;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.newrelic.api.agent.security.schema.AbstractOperation;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.agent.security.dynamodb_1_11_390.DynamoDBUtil;
import com.newrelic.agent.security.instrumentation.dynamodb_1_11_390.DynamoDBUtil;

import java.net.URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.nr.agent.security.dynamodb_1_11_390;
package com.newrelic.agent.security.instrumentation.dynamodb_1_11_390;

import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.nr.instrumentation.security.dynamodb453;
package com.nr.agent.security.instrumentation.dynamodb_1_11_390;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
Expand Down Expand Up @@ -90,7 +90,6 @@ public class DynamoServer extends ExternalResource {

private void setUp() throws Exception {
System.setProperty("sqlite4java.library.path", "src/test/resources/libs/");

server = ServerRunner.createServerFromCommandLineArgs(new String[]{ "-inMemory", "-port", String.valueOf(PORT) });
server.start();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package com.nr.instrumentation.security.dynamodb453;
package com.nr.agent.security.instrumentation.dynamodb_1_11_390;

import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.AttributeValueUpdate;
import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest;
import com.amazonaws.services.dynamodbv2.model.GetItemRequest;
import com.amazonaws.services.dynamodbv2.model.KeysAndAttributes;
import com.amazonaws.services.dynamodbv2.model.PutItemRequest;
import com.amazonaws.services.dynamodbv2.model.PutRequest;
import com.amazonaws.services.dynamodbv2.model.QueryRequest;
import com.amazonaws.services.dynamodbv2.model.ScanRequest;
import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest;
import com.newrelic.agent.security.introspec.InstrumentationTestConfig;
import com.newrelic.agent.security.introspec.SecurityInstrumentationTestRunner;
import com.newrelic.agent.security.introspec.SecurityIntrospector;
Expand All @@ -29,7 +21,7 @@

@RunWith(SecurityInstrumentationTestRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@InstrumentationTestConfig(includePrefixes = {"com.nr.agent.security.dynamodb_1_11_453", "com.amazonaws.services"})
@InstrumentationTestConfig(includePrefixes = {"com.newrelic.agent.security.instrumentation.dynamodb_1_11_390", "com.amazonaws.services.dynamodbv2_1_11_390"})
public class DynamodbTest {
@ClassRule
public static DynamoServer dynamo = new DynamoServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.newrelic.api.agent.security.schema.AbstractOperation;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.agent.security.dynamodb_1_11_453.DynamoDBUtil;
import com.newrelic.agent.security.instrumentation.dynamodb_1_11_453.DynamoDBUtil;

import java.net.URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.nr.agent.security.dynamodb_1_11_453;
package com.newrelic.agent.security.instrumentation.dynamodb_1_11_453;

import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.nr.instrumentation.security.dynamodb459;
package com.nr.agent.security.instrumentation.dynamodb_1_11_453;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
Expand Down Expand Up @@ -90,6 +90,7 @@ public class DynamoServer extends ExternalResource {

private void setUp() throws Exception {
System.setProperty("sqlite4java.library.path", "src/test/resources/libs/");

server = ServerRunner.createServerFromCommandLineArgs(new String[]{ "-inMemory", "-port", String.valueOf(PORT) });
server.start();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package com.nr.instrumentation.security.dynamodb390;
package com.nr.agent.security.instrumentation.dynamodb_1_11_453;

import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.AttributeValueUpdate;
import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest;
import com.amazonaws.services.dynamodbv2.model.GetItemRequest;
import com.amazonaws.services.dynamodbv2.model.KeysAndAttributes;
import com.amazonaws.services.dynamodbv2.model.PutItemRequest;
import com.amazonaws.services.dynamodbv2.model.PutRequest;
import com.amazonaws.services.dynamodbv2.model.QueryRequest;
import com.amazonaws.services.dynamodbv2.model.ScanRequest;
import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest;
import com.newrelic.agent.security.introspec.InstrumentationTestConfig;
import com.newrelic.agent.security.introspec.SecurityInstrumentationTestRunner;
import com.newrelic.agent.security.introspec.SecurityIntrospector;
Expand All @@ -29,7 +21,7 @@

@RunWith(SecurityInstrumentationTestRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@InstrumentationTestConfig(includePrefixes = {"com.nr.agent.security.dynamodb_1_11_390", "com.amazonaws.services.dynamodbv2_1_11_390"})
@InstrumentationTestConfig(includePrefixes = {"com.newrelic.agent.security.instrumentation.dynamodb_1_11_453", "com.amazonaws.services"})
public class DynamodbTest {
@ClassRule
public static DynamoServer dynamo = new DynamoServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.newrelic.api.agent.security.schema.AbstractOperation;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.nr.agent.security.dynamodb_1_11_459.DynamoDBUtil;
import com.newrelic.agent.security.instrumentation.dynamodb_1_11_459.DynamoDBUtil;

import java.net.URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.nr.agent.security.dynamodb_1_11_459;
package com.newrelic.agent.security.instrumentation.dynamodb_1_11_459;

import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

package com.nr.instrumentation.security.dynamodb390;
package com.nr.agent.security.instrumentation.dynamodb_1_11_459;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
Expand Down
Loading
Loading