Skip to content

Commit

Permalink
introduce register operation at exit for ok-http3 module
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesh-ap committed Dec 17, 2024
1 parent 1374701 commit 02c217e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public static AbstractOperation preprocessSecurityHook(String url, String classN
SSRFOperation operation = new SSRFOperation(url,
className, methodName);
NewRelicSecurity.getAgent().getSecurityMetaData().getMetaData().setFromJumpRequiredInStackTrace(3);
NewRelicSecurity.getAgent().registerOperation(operation);
return operation;
} catch (Throwable e) {
if (e instanceof NewRelicSecurityException) {
Expand All @@ -51,7 +50,7 @@ public static void registerExitOperation(boolean isProcessingAllowed, AbstractOp
) {
return;
}
NewRelicSecurity.getAgent().registerExitEvent(operation);
NewRelicSecurity.getAgent().registerOperation(operation);
} catch (Throwable e) {
NewRelicSecurity.getAgent().log(LogLevel.FINEST, String.format(GenericHelper.EXIT_OPERATION_EXCEPTION_MESSAGE, OKHTTP_3_0_0, e.getMessage()), e, OkhttpHelper.class.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public Response execute() {
returnVal = Weaver.callOriginal();
} finally {
if(isLockAcquired){
OkhttpHelper.registerExitOperation(isLockAcquired, operation);
releaseLock();
}
}
OkhttpHelper.registerExitOperation(isLockAcquired, operation);
return returnVal;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static AbstractOperation preprocessSecurityHook(String url, String classN
}
SSRFOperation ssrfOperation = new SSRFOperation(url, className, methodName);
NewRelicSecurity.getAgent().getSecurityMetaData().getMetaData().setFromJumpRequiredInStackTrace(3);
NewRelicSecurity.getAgent().registerOperation(ssrfOperation);
return ssrfOperation;
} catch (Throwable e) {
if (e instanceof NewRelicSecurityException) {
Expand All @@ -50,7 +49,7 @@ public static void registerExitOperation(boolean isProcessingAllowed, AbstractOp
) {
return;
}
NewRelicSecurity.getAgent().registerExitEvent(operation);
NewRelicSecurity.getAgent().registerOperation(operation);
} catch (Throwable e) {
NewRelicSecurity.getAgent().log(LogLevel.FINEST, String.format(GenericHelper.EXIT_OPERATION_EXCEPTION_MESSAGE, OKHTTP_3_5_0, e.getMessage()), e, OkhttpHelper.class.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public void writeRequestHeaders(Request request) {
Weaver.callOriginal();
} finally {
if (isLockAcquired) {
OkhttpHelper.registerExitOperation(isLockAcquired, operation);
releaseLock();
}
}
OkhttpHelper.registerExitOperation(isLockAcquired, operation);
}

private void releaseLock() {
Expand Down

0 comments on commit 02c217e

Please sign in to comment.