Session script not resolving

67 views
Skip to first unread message

Bernie Jordaan

unread,
Sep 4, 2025, 9:12:08 AMSep 4
to ZAP User Group

Hi,

We are using Zap 2.16.1 with the automation framework in CI/CD pipelines on Azure DevOps as a vulnerability assessment tool. Recently our site got updated and login via username and password is now only available on API.

I am trying to use script-based authentication and session management, but for some reason when running the automation plan Zap is unable to resolve the session management script unless I provide it with a full path to the script which isn't ideal since the path on the CI/CD pipeline isn't a fixed path. The path for the session script, Auth script, openapi, graphql files are the same except for the filename. The other files can resolve without an issue.

If I run the automation plan locally through the Zap GUI it runs and the scripts are used without any errors albeit specifying the full path to the scripts.

Error screenshots:

If I cause the auth script name to be invalid I get an error message that it can’t read the script, but it converted the environment variable ${apiFilesDirectory} to a path.

Other things I tried was updating the folder name so that it does not have a space in the name, specifying the path in automation script with quotes “” and without. As a workaround I tried specifying only partial path but that did not work.

There might be a bug in the session script path resolving?

I have attached the auth, session scripts and automation plan.

Any assistance is appreciated

Regards

Bernie

 

SessionHandler.txt
zap-quick-scan-automation.template.yaml
ZapAuthScript.txt

Bernie Jordaan

unread,
Sep 8, 2025, 4:28:53 AMSep 8
to ZAP User Group
PathInfoPartialPath-Session-script-error.pngRe-Adding the screenshots


PathInfoSession-script.png

SessionScript-error1.png

Force invalid path auth script

PathInfoInvalidAuth-script.png
InvalidAuth-script-errors.png

Partial path for session script

Using partial path

DevOps\Pipelines\templates\tools\zap-scan-utilities
PathInfoPartialPath-Session-script.png

PathInfoPartialPath-Session-script-error.png
Directory listing from build server DevOps\Pipelines\templates\tools\zap-scan-utilities

DirectoryListing.png

kingthorin+zap

unread,
Sep 9, 2025, 9:35:40 AMSep 9
to ZAP User Group
Did you load the scripts before you tried to use the scripts?

Bernie Jordaan

unread,
Sep 9, 2025, 10:18:18 AMSep 9
to zaprox...@googlegroups.com
Hi,

Previously I haven't because when running the automation plan locally I didn't need to load them outside of the context setup. However I did try adding script add steps to the automation plan after context and alert steps. It made no difference. The automation plan still fails with the same error

Here is the script add step code

- type: script
  parameters:
    name: SessionHandler.js
    type: session
    action: add
    engine: "ECMAScript : Graal.js"
    source: "${apiFilesDirectory}\\SessionHandler.js"

Attached is the full automation plan with the update 



--
ZAP by Checkmarx: https://www.zaproxy.org/
---
You received this message because you are subscribed to a topic in the Google Groups "ZAP User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/zaproxy-users/JQ8AMtJ2WeQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to zaproxy-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/zaproxy-users/53919adc-bf2f-498a-879d-721320f6b826n%40googlegroups.com.
zap-quick-scan-automation.template.yaml

Simon Bennetts

unread,
Sep 15, 2025, 7:05:36 AM (8 days ago) Sep 15
to ZAP User Group
This looks like its a bug in ZAP.
We're investigating and will report back with our findings.

Thanks for reporting this problem,

Simon

Simon Bennetts

unread,
Sep 15, 2025, 11:51:46 AM (8 days ago) Sep 15
to ZAP User Group
This should be fixed in the latest ZAP Weekly.
Can you try it out and see if it works for you?

Cheers,

Simon

Bernie Jordaan

unread,
Sep 16, 2025, 3:45:30 AM (8 days ago) Sep 16
to zaprox...@googlegroups.com
Thanks Simon,

Just to clarify, is it the ZAP weekly build that got released yesterday or would it be the one for next week?

Regards

Bernie Jordaan

kingthorin+zap

unread,
Sep 16, 2025, 6:26:13 AM (7 days ago) Sep 16
to ZAP User Group
Yesterday's

Bernie Jordaan

unread,
Sep 18, 2025, 3:37:59 AM (6 days ago) Sep 18
to zaprox...@googlegroups.com
Thanks everyone. I got the latest weekly release and it works

kingthorin+zap

unread,
Sep 18, 2025, 11:12:36 AM (5 days ago) Sep 18
to ZAP User Group
Thanks for letting us know :)
Reply all
Reply to author
Forward
0 new messages