File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed
addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 9191import org .zaproxy .zap .users .User ;
9292import org .zaproxy .zap .utils .Pair ;
9393import org .zaproxy .zap .utils .Stats ;
94+ import org .zaproxy .zest .core .v1 .ZestComment ;
95+ import org .zaproxy .zest .core .v1 .ZestScript ;
96+ import org .zaproxy .zest .core .v1 .ZestStatement ;
9497
9598public class AuthUtils {
9699
@@ -146,6 +149,8 @@ public class AuthUtils {
146149
147150 private static final String INPUT_TAG = "input" ;
148151
152+ private static final String RECORDING_LOGOUT = "ZAP Recording LOGOUT" ;
153+
149154 private static final HttpRequestConfig REDIRECT_NOTIFIER_CONFIG =
150155 HttpRequestConfig .builder ()
151156 .setRedirectionValidator (
@@ -1362,4 +1367,16 @@ public static boolean isRelevantToAuthDiags(HttpMessage msg) {
13621367 || host .contains ("mozilla" )
13631368 || host .contains ("safebrowsing-cache" ));
13641369 }
1370+
1371+ public static void disableLogoutStatements (ZestScript zestScript ) {
1372+ boolean disable = false ;
1373+ for (ZestStatement stmt : zestScript .getStatements ()) {
1374+ if (disable ) {
1375+ stmt .setEnabled (false );
1376+ } else if (stmt instanceof ZestComment comment
1377+ && RECORDING_LOGOUT .equals (comment .getComment ())) {
1378+ disable = true ;
1379+ }
1380+ }
1381+ }
13651382}
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ public void insertDiagnostics(ZestScript zestScript) {
149149
150150 for (int i = 0 ; i < zestScript .getStatements ().size (); i ++) {
151151 ZestStatement stmt = zestScript .getStatements ().get (i );
152- if (stmt instanceof ZestClientElementClear ) {
152+ if (! stmt . isEnabled () || stmt instanceof ZestClientElementClear ) {
153153 continue ;
154154 }
155155
Original file line number Diff line number Diff line change @@ -414,6 +414,7 @@ public WebSession authenticate(
414414 zestScript .add (
415415 new ZestActionSleep (TimeUnit .SECONDS .toMillis (getLoginPageWait ())));
416416 removeCloseStatements (zestScript );
417+ AuthUtils .disableLogoutStatements (zestScript );
417418 } else {
418419 LOGGER .warn ("Expected authScript to be a Zest script" );
419420 return null ;
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ public void browserLaunched(SeleniumScriptUtils ssUtils) {
8181 paramsValues .put (USERNAME , credentials .getParam (USERNAME ));
8282 paramsValues .put (PASSWORD , credentials .getParam (PASSWORD ));
8383 ZestScript zs = csaMethod .getZestScript ();
84+ AuthUtils .disableLogoutStatements (zs );
8485 runner .setup (user , zs );
8586 runner .run (zs , paramsValues );
8687
You can’t perform that action at this time.
0 commit comments